Skip to content

Commit 329f808

Browse files
committed
Fixed deb package
1 parent 9880b96 commit 329f808

File tree

2 files changed

+33
-8
lines changed

2 files changed

+33
-8
lines changed

build.js

+31-6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ importPackage(Packages.groovy.yaml);
77
importPackage(Packages.java.nio.file);
88
importPackage(Packages.java.io);
99
importPackage(Packages.org.yaml.snakeyaml);
10+
importPackage(Packages.javax.swing);
1011

1112
saw.setProperty(Tablesaw.PROP_MULTI_THREAD_OUTPUT, Tablesaw.PROP_VALUE_ON);
1213

@@ -76,17 +77,17 @@ function doRPM(rule)
7677
rpmBuilder.setPrefixes(rpmBaseInstallDir);
7778
rpmBuilder.addDependencyMore("jre", yamlMap.get("min_java_version"));
7879

79-
rpmBuilder.addFile("$rpmBaseInstallDir/bin/topic-monitor", new File("target/stork/bin/topic-monitor"), 0755);
80+
rpmBuilder.addFile(`${rpmBaseInstallDir}/bin/topic-monitor`, new File("target/stork/bin/topic-monitor"), 0755);
8081

81-
rpmBuilder.addFile("$rpmBaseInstallDir/conf/application.conf",
82+
rpmBuilder.addFile(`${rpmBaseInstallDir}/conf/application.conf`,
8283
new File("target/stork/conf/application.conf"), 0644, new Directive(Directive.RPMFILE_CONFIG | Directive.RPMFILE_NOREPLACE));
83-
rpmBuilder.addFile("$rpmBaseInstallDir/conf/logback.xml",
84+
rpmBuilder.addFile(`${rpmBaseInstallDir}/conf/logback.xml`,
8485
new File("target/stork/conf/logback.xml"), 0644, new Directive(Directive.RPMFILE_CONFIG | Directive.RPMFILE_NOREPLACE));
85-
rpmBuilder.addFile("$rpmBaseInstallDir/conf/metrics4j.conf",
86+
rpmBuilder.addFile(`${rpmBaseInstallDir}/conf/metrics4j.conf`,
8687
new File("target/stork/conf/metrics4j.conf"), 0644, new Directive(Directive.RPMFILE_CONFIG | Directive.RPMFILE_NOREPLACE));
8788

88-
addFileSetToRPM(rpmBuilder, "$rpmBaseInstallDir/lib", new RegExFileSet("target/stork/lib", ".*\\.jar"));
89-
addFileSetToRPM(rpmBuilder, "$rpmBaseInstallDir/share", new RegExFileSet("target/stork/share", ".*").recurse());
89+
addFileSetToRPM(rpmBuilder, `${rpmBaseInstallDir}/lib`, new RegExFileSet("target/stork/lib", ".*\\.jar"));
90+
addFileSetToRPM(rpmBuilder, `${rpmBaseInstallDir}/share`, new RegExFileSet("target/stork/share", ".*").recurse());
9091

9192
print(`Building RPM ${rule.getTarget()}`);
9293
outputFile = new FileOutputStream(rule.getTarget());
@@ -110,7 +111,31 @@ debRule = new SimpleRule("package-deb").setDescription("Build Deb Package")
110111

111112
function doDeb(rule)
112113
{
114+
//Prompt the user for the sudo password
115+
//TODO: package using jdeb
116+
var jpf = new JPasswordField();
117+
var password = saw.getProperty("sudo");
113118

119+
if (password == null)
120+
{
121+
var resp = JOptionPane.showConfirmDialog(null,
122+
jpf, "Enter sudo password:",
123+
JOptionPane.OK_CANCEL_OPTION);
124+
125+
if (resp == 0)
126+
password = jpf.getText();
127+
}
128+
129+
if (password != null)
130+
{
131+
var sudo = saw.createAsyncProcess(rpmDir, `sudo -S alien --scripts --bump=0 --to-deb ${rpmFile}`);
132+
sudo.run();
133+
//pass the password to the process on stdin
134+
sudo.sendMessage(password+"\n");
135+
sudo.waitForProcess();
136+
if (sudo.getExitCode() != 0)
137+
throw new TablesawException("Unable to run alien application");
138+
}
114139
}
115140

116141

pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
</configuration>
123123
</plugin>
124124
<!-- Build uber jar, if used with stork it will package an uber jar into the gz with all the other classes as well-->
125-
<!--<plugin>
125+
<plugin>
126126
<artifactId>maven-shade-plugin</artifactId>
127127
<version>3.2.1</version>
128128
<executions>
@@ -145,7 +145,7 @@
145145
</configuration>
146146
</execution>
147147
</executions>
148-
</plugin>-->
148+
</plugin>
149149
<plugin>
150150
<groupId>com.fizzed</groupId>
151151
<artifactId>stork-maven-plugin</artifactId>

0 commit comments

Comments
 (0)