1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package com.hazendaz.maven.makeself;
19
20 import java.io.BufferedInputStream;
21 import java.io.BufferedReader;
22 import java.io.File;
23 import java.io.IOException;
24 import java.io.InputStream;
25 import java.io.InputStreamReader;
26 import java.nio.charset.StandardCharsets;
27 import java.nio.file.Files;
28 import java.nio.file.Path;
29 import java.nio.file.StandardCopyOption;
30 import java.nio.file.attribute.PosixFilePermission;
31 import java.nio.file.attribute.PosixFilePermissions;
32 import java.util.ArrayList;
33 import java.util.Arrays;
34 import java.util.List;
35 import java.util.Map;
36 import java.util.Set;
37
38 import javax.inject.Inject;
39
40 import org.apache.commons.compress.archivers.ArchiveEntry;
41 import org.apache.commons.compress.archivers.ArchiveInputStream;
42 import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
43 import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
44 import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream;
45 import org.apache.commons.io.FilenameUtils;
46 import org.apache.maven.plugin.AbstractMojo;
47 import org.apache.maven.plugin.MojoExecutionException;
48 import org.apache.maven.plugin.MojoFailureException;
49 import org.apache.maven.plugins.annotations.LifecyclePhase;
50 import org.apache.maven.plugins.annotations.Mojo;
51 import org.apache.maven.plugins.annotations.Parameter;
52 import org.apache.maven.project.MavenProject;
53 import org.apache.maven.project.MavenProjectHelper;
54 import org.eclipse.aether.RepositorySystem;
55 import org.eclipse.aether.RepositorySystemSession;
56 import org.eclipse.aether.artifact.Artifact;
57 import org.eclipse.aether.artifact.DefaultArtifact;
58 import org.eclipse.aether.repository.RemoteRepository;
59 import org.eclipse.aether.resolution.ArtifactRequest;
60 import org.eclipse.aether.resolution.ArtifactResolutionException;
61 import org.eclipse.aether.resolution.ArtifactResult;
62
63
64
65
66 @Mojo(name = "makeself", defaultPhase = LifecyclePhase.VERIFY, requiresProject = false)
67 public class MakeselfMojo extends AbstractMojo {
68
69
70
71
72 private static final boolean WINDOWS = System.getProperty("os.name").startsWith("Windows");
73
74
75
76
77 private static final String PERMISSIONS = "rwxr-xr--";
78
79
80
81
82 private static final boolean ATTACH_ARTIFACT = true;
83
84
85
86
87 private String gitPath = "";
88
89
90
91
92 @Parameter(defaultValue = "makeself", property = "archiveDir", required = true)
93 private String archiveDir;
94
95
96
97
98 @Parameter(defaultValue = "makeself.sh", property = "fileName", required = true)
99 private String fileName;
100
101
102
103
104 @Parameter(defaultValue = "Makeself self-extractable archive", property = "label", required = true)
105 private String label;
106
107
108
109
110
111
112 @Parameter(defaultValue = "./makeself.sh", property = "startupScript", required = true)
113 private String startupScript;
114
115
116
117
118
119
120
121
122 @Parameter(defaultValue = "sh", property = "extension")
123 private String extension;
124
125
126
127
128
129
130
131
132 @Parameter(property = "classifier")
133 private String classifier;
134
135
136
137
138
139
140
141
142
143 @Parameter(property = "inlineScript")
144 private boolean inlineScript;
145
146
147
148
149
150
151
152
153
154
155
156
157
158 @Parameter(property = "scriptArgs")
159 private List<String> scriptArgs;
160
161
162
163
164
165
166 @Parameter(property = "version")
167 private Boolean version;
168
169
170
171
172 @Parameter(property = "help")
173 private Boolean help;
174
175
176
177
178
179
180 @Parameter(property = "tarQuietly")
181 private Boolean tarQuietly;
182
183
184
185
186
187
188 @Parameter(property = "quiet")
189 private Boolean quiet;
190
191
192
193
194 @Parameter(property = "gzip")
195 private Boolean gzip;
196
197
198
199
200
201
202 @Parameter(property = "bzip2")
203 private Boolean bzip2;
204
205
206
207
208
209
210
211
212 @Parameter(property = "bzip3")
213 private Boolean bzip3;
214
215
216
217
218
219
220 @Parameter(property = "pbzip2")
221 private Boolean pbzip2;
222
223
224
225
226
227
228 @Parameter(property = "xz")
229 private Boolean xz;
230
231
232
233
234
235
236 @Parameter(property = "lzo")
237 private Boolean lzo;
238
239
240
241
242
243
244 @Parameter(property = "lz4")
245 private Boolean lz4;
246
247
248
249
250 @Parameter(property = "zstd")
251 private Boolean zstd;
252
253
254
255
256 @Parameter(property = "pigz")
257 private Boolean pigz;
258
259
260
261
262 @Parameter(property = "base64")
263 private Boolean base64;
264
265
266
267
268
269 @Parameter(property = "gpgEncrypt")
270 private Boolean gpgEncrypt;
271
272
273
274
275 @Parameter(property = "gpgAsymmetricEncryptSign")
276 private Boolean gpgAsymmetricEncryptSign;
277
278
279
280
281
282 @Parameter(property = "sslEncrypt")
283 private Boolean sslEncrypt;
284
285
286
287
288 @Parameter(property = "sslPasswd")
289 private String sslPasswd;
290
291
292
293
294
295
296 @Parameter(property = "sslPassSrc")
297 private String sslPassSrc;
298
299
300
301
302 @Parameter(property = "sslNoMd")
303 private Boolean sslNoMd;
304
305
306
307
308
309 @Parameter(property = "compress")
310 private Boolean compress;
311
312
313
314
315 @Parameter(property = "complevel")
316 private Integer complevel;
317
318
319
320
321
322
323 @Parameter(property = "nochown")
324 private Boolean nochown;
325
326
327
328
329
330
331 @Parameter(property = "chown")
332 private Boolean chown;
333
334
335
336
337 @Parameter(property = "nocomp")
338 private Boolean nocomp;
339
340
341
342
343
344
345
346 @Parameter(property = "threads")
347 private Integer threads;
348
349
350
351
352
353
354 @Parameter(property = "notemp")
355 private Boolean notemp;
356
357
358
359
360
361
362 @Parameter(property = "needroot")
363 private Boolean needroot;
364
365
366
367
368
369 @Parameter(property = "current")
370 private Boolean current;
371
372
373
374
375
376 @Parameter(property = "follow")
377 private Boolean follow;
378
379
380
381
382
383
384 @Parameter(property = "noprogress")
385 private Boolean noprogress;
386
387
388
389
390
391
392 @Parameter(property = "append")
393 private Boolean append;
394
395
396
397
398
399
400 @Parameter(property = "headerFile")
401 private String headerFile;
402
403
404
405
406
407
408
409 @Parameter(property = "preextractScript")
410 private String preextractScript;
411
412
413
414
415
416 @Parameter(property = "cleanupScript")
417 private String cleanupScript;
418
419
420
421
422
423
424
425 @Parameter(property = "copy")
426 private Boolean copy;
427
428
429 @Parameter(property = "nox11")
430 private Boolean nox11;
431
432
433 @Parameter(property = "nowait")
434 private Boolean nowait;
435
436
437
438
439
440 @Parameter(property = "nomd5")
441 private Boolean nomd5;
442
443
444
445
446
447 @Parameter(property = "nocrc")
448 private Boolean nocrc;
449
450
451
452
453 @Parameter(property = "sha256")
454 private Boolean sha256;
455
456
457
458
459
460
461 @Parameter(property = "signPassphrase")
462 private String signPassphrase;
463
464
465
466
467
468
469 @Parameter(property = "lsmFile")
470 private String lsmFile;
471
472
473
474
475 @Parameter(property = "gpgExtraOpt")
476 private String gpgExtraOpt;
477
478
479
480
481
482 @Parameter(property = "tarFormatOpt")
483 private String tarFormatOpt;
484
485
486
487
488
489
490
491 @Parameter(property = "tarExtraOpt")
492 private String tarExtraOpt;
493
494
495
496
497 @Parameter(property = "untarExtraOpt")
498 private String untarExtraOpt;
499
500
501
502
503
504
505
506 private String extractTargetDir;
507
508
509
510
511
512 @Parameter(property = "keepUmask")
513 private Boolean keepUmask;
514
515
516
517
518 @Parameter(property = "exportConf")
519 private Boolean exportConf;
520
521
522
523
524 @Parameter(property = "packagingDate")
525 private String packagingDate;
526
527
528
529
530 @Parameter(property = "licenseFile")
531 private String licenseFile;
532
533
534
535
536 @Parameter(property = "nooverwrite")
537 private Boolean nooverwrite;
538
539
540
541
542 @Parameter(property = "helpHeaderFile")
543 private String helpHeaderFile;
544
545
546 @Parameter(defaultValue = "false", property = "makeself.skip")
547 private boolean skip;
548
549
550 @Parameter(defaultValue = "false", property = "autoRun")
551 private boolean autoRun;
552
553
554 @Parameter(defaultValue = "${project.build.directory}/", readonly = true)
555 private String buildTarget;
556
557
558 @Parameter(defaultValue = "${project.build.directory}/makeself-tmp/", readonly = true)
559 private File makeselfTempDirectory;
560
561
562 @Inject
563 private MavenProjectHelper projectHelper;
564
565
566 @Inject
567 private RepositorySystem repositorySystem;
568
569
570 @Parameter(defaultValue = "${project}", readonly = true, required = true)
571 private MavenProject project;
572
573
574 @Parameter(defaultValue = "${repositorySystemSession}", readonly = true, required = true)
575 private RepositorySystemSession repoSession;
576
577
578 @Parameter(defaultValue = "${project.remoteProjectRepositories}", readonly = true, required = true)
579 protected List<RemoteRepository> remoteRepositories;
580
581
582 private Path makeself;
583
584
585 private PortableGit portableGit;
586
587 @Override
588 public void execute() throws MojoExecutionException, MojoFailureException {
589
590 if (this.skip) {
591 getLog().info("Makeself is skipped");
592 return;
593 }
594
595
596 Path path = Path.of(buildTarget.concat(archiveDir));
597 if (!Files.exists(path)) {
598 throw new MojoExecutionException("ArchiveDir: missing '" + buildTarget.concat(archiveDir) + "'");
599 }
600
601
602 if (inlineScript) {
603
604 if (scriptArgs == null) {
605 throw new MojoExecutionException("ScriptArgs required when running inlineScript");
606 }
607 } else {
608
609 if (!startupScript.startsWith("./")) {
610 throw new MojoExecutionException("StartupScript required to start with './'");
611 }
612
613
614 path = Path.of(buildTarget.concat(archiveDir).concat(startupScript.substring(1)));
615 if (!Files.exists(path)) {
616 throw new MojoExecutionException("StartupScript: missing '"
617 + buildTarget.concat(archiveDir).concat(startupScript.substring(1)) + "'");
618 }
619 }
620
621
622 this.extractMakeself();
623
624
625 if (MakeselfMojo.WINDOWS) {
626 this.checkGitSetup();
627 }
628
629 try {
630
631 getLog().debug("Execute Bash Version");
632 execute(Arrays.asList(gitPath + "bash", "--version"), !ATTACH_ARTIFACT);
633
634
635 getLog().debug("Execute Makeself Version");
636 execute(Arrays.asList(gitPath + "bash", makeself.toAbsolutePath().toString(), "--version"),
637 !ATTACH_ARTIFACT);
638
639
640 if (isTrue(version)) {
641 return;
642 }
643
644
645 if (isTrue(help)) {
646 getLog().debug("Execute Makeself Help");
647 execute(Arrays.asList(gitPath + "bash", makeself.toAbsolutePath().toString(), "--help"),
648 !ATTACH_ARTIFACT);
649 return;
650 }
651
652
653 getLog().debug("Loading Makeself Basic Configuration");
654 List<String> target = new ArrayList<>(
655 Arrays.asList(gitPath + "bash", makeself.toAbsolutePath().toString()));
656 target.addAll(loadArgs());
657 target.add(buildTarget.concat(archiveDir));
658 target.add(buildTarget.concat(fileName));
659 target.add(label);
660 target.add(startupScript);
661 if (scriptArgs != null) {
662 target.addAll(scriptArgs);
663 }
664
665
666 getLog().info("Running makeself build");
667
668
669 getLog().debug("Execute Makeself Build");
670 execute(target, ATTACH_ARTIFACT);
671
672
673 getLog().debug("Execute Makeself Info on Resulting Shell Script");
674 execute(Arrays.asList(gitPath + "bash", buildTarget.concat(fileName), "--info"), !ATTACH_ARTIFACT);
675
676
677 if (!MakeselfMojo.WINDOWS) {
678 getLog().debug("Execute Makeself List on Resulting Shell Script");
679 execute(Arrays.asList(gitPath + "bash", buildTarget.concat(fileName), "--list"), !ATTACH_ARTIFACT);
680 }
681
682
683 if (this.autoRun) {
684 getLog().info("Auto-run created shell (this may take a few minutes)");
685 execute(Arrays.asList(gitPath + "bash", buildTarget.concat(fileName)), !ATTACH_ARTIFACT);
686 }
687 } catch (IOException e) {
688 getLog().error("", e);
689 } catch (InterruptedException e) {
690 getLog().error("", e);
691
692 Thread.currentThread().interrupt();
693 }
694 }
695
696 private void execute(List<String> target, boolean attach) throws IOException, InterruptedException {
697
698
699 getLog().debug("Execution commands: " + target);
700
701
702 ProcessBuilder processBuilder = new ProcessBuilder(target);
703 processBuilder.redirectErrorStream(true);
704
705
706 if (MakeselfMojo.WINDOWS) {
707 Map<String, String> envs = processBuilder.environment();
708 getLog().debug("Environment Variables: " + envs);
709 final String location = repoSession.getLocalRepository().getBasedir() + File.separator
710 + this.portableGit.getName() + File.separator + this.portableGit.getVersion();
711
712 if (envs.get("Path") != null) {
713 envs.put("Path", location + "/usr/bin;" + envs.get("Path"));
714 getLog().debug("Environment Path Variable: " + envs.get("Path"));
715
716 } else if (envs.get("PATH") != null) {
717 envs.put("PATH",
718 location + "/usr/bin;" + envs.get("PATH").replace("Program Files", "\"Program Files\""));
719 getLog().debug("Environment Path Variable: " + envs.get("PATH"));
720 }
721 }
722
723
724 Process process = processBuilder.start();
725
726
727 try (BufferedReader reader = new BufferedReader(
728 new InputStreamReader(process.getInputStream(), StandardCharsets.UTF_8))) {
729 String line = "";
730 while ((line = reader.readLine()) != null) {
731 getLog().info(line);
732 }
733 getLog().info("");
734 }
735
736
737 int status = process.waitFor();
738 if (status > 0) {
739 getLog().error(String.join(" ", "makeself failed with error status:", String.valueOf(status)));
740 }
741
742
743 if (status == 0 && attach) {
744 projectHelper.attachArtifact(project, this.extension, this.classifier,
745 Path.of(buildTarget, FilenameUtils.getName(fileName)).toFile());
746 }
747 }
748
749
750
751
752 private void extractMakeself() {
753 getLog().debug("Extracting Makeself");
754
755
756 Path makeselfTemp = Path.of(makeselfTempDirectory.getAbsolutePath());
757 if (!Files.exists(makeselfTemp) && !makeselfTemp.toFile().mkdirs()) {
758 getLog().error(String.join(" ", "Unable to make directory", makeselfTempDirectory.getAbsolutePath()));
759 return;
760 }
761 getLog().debug(String.join(" ", "Created directory for", makeselfTempDirectory.getAbsolutePath()));
762
763 ClassLoader classloader = this.getClass().getClassLoader();
764
765
766 makeself = makeselfTempDirectory.toPath().resolve("makeself.sh");
767 if (!Files.exists(makeself)) {
768 getLog().debug("Writing makeself.sh");
769 try (InputStream link = classloader.getResourceAsStream("META-INF/makeself/makeself.sh")) {
770 Path path = makeself.toAbsolutePath();
771 Files.copy(link, path);
772 setFilePermissions(makeself.toFile());
773 setPosixFilePermissions(path);
774 } catch (IOException e) {
775 getLog().error("", e);
776 }
777 }
778
779
780 Path makeselfHeader = makeselfTempDirectory.toPath().resolve("makeself-header.sh");
781 if (!Files.exists(makeselfHeader)) {
782 getLog().debug("Writing makeself-header.sh");
783 try (InputStream link = classloader.getResourceAsStream("META-INF/makeself/makeself-header.sh")) {
784 Path path = makeselfHeader.toAbsolutePath();
785 Files.copy(link, path);
786 setFilePermissions(makeselfHeader.toFile());
787 setPosixFilePermissions(path);
788 } catch (IOException e) {
789 getLog().error("", e);
790 }
791 }
792 }
793
794
795
796
797
798
799
800 private void checkGitSetup() throws MojoFailureException {
801
802 this.portableGit = new PortableGit(getLog());
803
804
805 this.extractPortableGit();
806 }
807
808
809
810
811
812
813
814 private void extractPortableGit() throws MojoFailureException {
815 final String location = repoSession.getLocalRepository().getBasedir() + File.separator
816 + this.portableGit.getName() + File.separator + this.portableGit.getVersion();
817 if (Files.exists(Path.of(location))) {
818 getLog().debug("Existing 'PortableGit' folder found at " + location);
819 gitPath = location + "/usr/bin/";
820 return;
821 }
822
823 getLog().info("Loading portable git");
824 final Artifact artifact = new DefaultArtifact(this.portableGit.getGroupId(), this.portableGit.getArtifactId(),
825 this.portableGit.getClassifier(), this.portableGit.getExtension(), this.portableGit.getVersion());
826 final ArtifactRequest artifactRequest = new ArtifactRequest().setRepositories(this.remoteRepositories)
827 .setArtifact(artifact);
828 ArtifactResult resolutionResult = null;
829 try {
830 resolutionResult = repositorySystem.resolveArtifact(repoSession, artifactRequest);
831 if (!resolutionResult.isResolved()) {
832 throw new MojoFailureException("Unable to resolve artifact: " + artifact.getGroupId() + ":"
833 + artifact.getArtifactId() + ":" + artifact.getVersion() + ":" + artifact.getClassifier() + ":"
834 + artifact.getExtension());
835 }
836 } catch (ArtifactResolutionException e) {
837 throw new MojoFailureException(
838 "Unable to resolve artifact: " + artifact.getGroupId() + ":" + artifact.getArtifactId() + ":"
839 + artifact.getVersion() + ":" + artifact.getClassifier() + ":" + artifact.getExtension());
840 }
841 this.installGit(resolutionResult.getArtifact(), location);
842 }
843
844
845
846
847
848
849
850
851
852 private void installGit(final Artifact artifact, final String location) {
853 Path currentFile = null;
854
855
856
857 try (InputStream inputStream = Files.newInputStream(artifact.getFile().toPath());
858 InputStream bufferedStream = new BufferedInputStream(inputStream);
859 InputStream gzipStream = new GzipCompressorInputStream(bufferedStream);
860 ArchiveInputStream<TarArchiveEntry> tarStream = new TarArchiveInputStream(gzipStream)) {
861 ArchiveEntry entry;
862 String directory = repoSession.getLocalRepository().getBasedir() + File.separator
863 + this.portableGit.getName();
864 while ((entry = tarStream.getNextEntry()) != null) {
865 if (entry.isDirectory()) {
866 continue;
867 }
868 currentFile = Path.of(directory, entry.getName());
869 if (!currentFile.normalize().startsWith(directory)) {
870 throw new IOException("Bad zip entry, possible directory traversal");
871 }
872 Path parent = currentFile.getParent();
873 if (!Files.exists(parent)) {
874 Files.createDirectory(parent);
875 }
876 getLog().debug("Current file: " + currentFile.getFileName());
877 Files.copy(tarStream, currentFile, StandardCopyOption.REPLACE_EXISTING);
878 }
879 } catch (IOException e) {
880 getLog().error("", e);
881 }
882
883 try {
884 if (currentFile != null) {
885
886 getLog().debug("Extract Portable Git");
887 execute(Arrays.asList(currentFile.toString(), "-y", "-o", location), !ATTACH_ARTIFACT);
888 gitPath = location + "/usr/bin/";
889 }
890 } catch (IOException e) {
891 getLog().error("", e);
892 } catch (InterruptedException e) {
893 getLog().error("", e);
894
895 Thread.currentThread().interrupt();
896 }
897 }
898
899 private void setFilePermissions(File file) {
900 if (!file.setExecutable(true, true)) {
901 getLog().error(String.join(" ", "Unable to set executable:", file.getName()));
902 } else {
903 getLog().debug(String.join(" ", "Set executable for", file.getName()));
904 }
905 }
906
907 private void setPosixFilePermissions(Path path) {
908 final Set<PosixFilePermission> permissions = PosixFilePermissions.fromString(PERMISSIONS);
909
910 try {
911 Files.setPosixFilePermissions(path, permissions);
912 getLog().debug(String.join(" ", "Set Posix File Permissions for", path.toString(), "as", PERMISSIONS));
913 } catch (IOException e) {
914 getLog().error("Failed attempted Posix permissions", e);
915 } catch (UnsupportedOperationException e) {
916
917 getLog().debug("Failed attempted Posix permissions", e);
918 }
919 }
920
921
922
923
924
925
926 private List<String> loadArgs() {
927 getLog().debug("Loading arguments");
928
929 List<String> args = new ArrayList<>(50);
930
931
932 if (isTrue(tarQuietly)) {
933 args.add("--tar-quietly");
934 }
935
936
937 if (isTrue(quiet)) {
938 args.add("--quiet");
939 }
940
941
942 if (isTrue(gzip)) {
943 args.add("--gzip");
944 }
945
946
947
948
949 if (isTrue(bzip2)) {
950 args.add("--bzip2");
951 }
952
953
954
955
956 if (isTrue(bzip3)) {
957 args.add("--bzip3");
958 }
959
960
961
962
963 if (isTrue(pbzip2)) {
964 args.add("--pbzip2");
965 }
966
967
968
969
970 if (isTrue(xz)) {
971 args.add("--xz");
972 }
973
974
975
976
977 if (isTrue(lzo)) {
978 args.add("--lzo");
979 }
980
981
982
983
984 if (isTrue(lz4)) {
985 args.add("--lz4");
986 }
987
988
989 if (isTrue(zstd)) {
990 args.add("--zstd");
991 }
992
993
994 if (isTrue(pigz)) {
995 args.add("--pigz");
996 }
997
998
999 if (isTrue(base64)) {
1000 args.add("--base64");
1001 }
1002
1003
1004
1005 if (isTrue(gpgEncrypt)) {
1006 args.add("--gpg-encrypt");
1007 }
1008
1009
1010 if (isTrue(gpgAsymmetricEncryptSign)) {
1011 args.add("--gpg-asymmetric-encrypt-sign");
1012 }
1013
1014
1015
1016 if (isTrue(sslEncrypt)) {
1017 args.add("--ssl-encrypt");
1018 }
1019
1020
1021 if (sslPasswd != null) {
1022 args.add("--ssl-passwd");
1023 args.add(sslPasswd);
1024 }
1025
1026
1027
1028
1029 if (sslPassSrc != null) {
1030 args.add("--ssl-pass-src");
1031 args.add(sslPassSrc);
1032 }
1033
1034
1035 if (isTrue(sslNoMd)) {
1036 args.add("--ssl-no-md");
1037 }
1038
1039
1040
1041 if (isTrue(compress)) {
1042 args.add("--compress");
1043 }
1044
1045
1046 if (complevel != null) {
1047 args.add("--complevel");
1048 args.add(complevel.toString());
1049 }
1050
1051
1052 if (isTrue(nochown)) {
1053 args.add("--nochown");
1054 }
1055
1056
1057 if (isTrue(chown)) {
1058 args.add("--chown");
1059 }
1060
1061
1062 if (isTrue(nocomp)) {
1063 args.add("--nocomp");
1064 }
1065
1066
1067
1068
1069
1070 if (threads != null) {
1071 args.add("--threads");
1072 args.add(threads.toString());
1073 }
1074
1075
1076
1077
1078 if (isTrue(notemp)) {
1079 args.add("--notemp");
1080 }
1081
1082
1083 if (isTrue(needroot)) {
1084 args.add("--needroot");
1085 }
1086
1087
1088
1089 if (isTrue(current)) {
1090 args.add("--current");
1091 }
1092
1093
1094
1095 if (isTrue(follow)) {
1096 args.add("--follow");
1097 }
1098
1099
1100 if (isTrue(noprogress)) {
1101 args.add("--noprogress");
1102 }
1103
1104
1105
1106
1107 if (isTrue(append)) {
1108 args.add("--append");
1109 }
1110
1111
1112
1113
1114 if (headerFile != null) {
1115 args.add("--header");
1116 args.add(headerFile);
1117 }
1118
1119
1120
1121 if (preextractScript != null) {
1122 args.add("--reextract");
1123 args.add(preextractScript);
1124 }
1125
1126
1127
1128 if (cleanupScript != null) {
1129 args.add("--cleanup");
1130 args.add(cleanupScript);
1131 }
1132
1133
1134
1135
1136
1137 if (isTrue(copy)) {
1138 args.add("--copy");
1139 }
1140
1141
1142 if (isTrue(nox11)) {
1143 args.add("--nox11");
1144 }
1145
1146
1147 if (isTrue(nowait)) {
1148 args.add("--nowait");
1149 }
1150
1151
1152
1153 if (isTrue(nomd5)) {
1154 args.add("--nomd5");
1155 }
1156
1157
1158
1159 if (isTrue(nocrc)) {
1160 args.add("--nocrc");
1161 }
1162
1163
1164 if (isTrue(sha256)) {
1165 args.add("--sha256");
1166 }
1167
1168
1169
1170
1171
1172 if (lsmFile != null) {
1173 args.add("--lsm");
1174 args.add(lsmFile);
1175 }
1176
1177
1178 if (gpgExtraOpt != null) {
1179 args.add("--gpg-extra");
1180 args.add(gpgExtraOpt);
1181 }
1182
1183
1184
1185 if (tarFormatOpt != null) {
1186 args.add("--tar-format");
1187 args.add(tarFormatOpt);
1188 }
1189
1190
1191
1192
1193 if (tarExtraOpt != null) {
1194 args.add("--tar-extra");
1195 args.add(tarExtraOpt);
1196 }
1197
1198
1199 if (untarExtraOpt != null) {
1200 args.add("--untar-extra");
1201 args.add(untarExtraOpt);
1202 }
1203
1204
1205 if (signPassphrase != null) {
1206 args.add("--sign");
1207 args.add(signPassphrase);
1208 }
1209
1210
1211
1212 if (extractTargetDir != null) {
1213 args.add("--target");
1214 args.add(extractTargetDir);
1215 }
1216
1217
1218
1219 if (isTrue(keepUmask)) {
1220 args.add("--keep-umask");
1221 }
1222
1223
1224 if (isTrue(exportConf)) {
1225 args.add("--export-conf");
1226 }
1227
1228
1229 if (packagingDate != null) {
1230 args.add("--packaging-date");
1231 args.add(packagingDate);
1232 }
1233
1234
1235 if (licenseFile != null) {
1236 args.add("--license");
1237 args.add(licenseFile);
1238 }
1239
1240
1241 if (isTrue(nooverwrite)) {
1242 args.add("--nooverwrite");
1243 }
1244
1245
1246 if (helpHeaderFile != null) {
1247 args.add("--help-header");
1248 args.add(helpHeaderFile);
1249 }
1250
1251 return args;
1252 }
1253
1254 private boolean isTrue(Boolean value) {
1255 if (value != null) {
1256 return value.booleanValue();
1257 }
1258 return false;
1259 }
1260
1261 }