Skip to content

Commit 0d6b606

Browse files
committed
Run the scripts before and after with the user that startet the whole process
The user who started the installer will now be used for the before and after scripts - starting an application. The reason is: the original user should be used to allow opening webpages etc. fixes #48
1 parent 8deecad commit 0d6b606

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/com/inet/gradle/setup/dmg/template/runBeforeAfter.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ if [ ! -z "$JAVAEXECUTABLE" ]; then
1414
# if the directory exists, start the run after
1515
if [ -e "$RUNAFTER_WORKINGDIR" ]; then
1616
if [ -z "$RUNAFTER_MAINCLASS" ]; then
17-
$(cd "$RUNAFTER_WORKINGDIR" && "$JAVAEXECUTABLE" -jar "$RUNAFTER_MAINJAR" {{startArgument}})&
17+
$(cd "$RUNAFTER_WORKINGDIR" && sudo -u "${USER:-root}" "$JAVAEXECUTABLE" -jar "$RUNAFTER_MAINJAR" {{startArgument}})&
1818
else
19-
$(cd "$RUNAFTER_WORKINGDIR" && "$JAVAEXECUTABLE" -classpath "$RUNAFTER_MAINJAR" "$RUNAFTER_MAINCLASS" {{startArgument}})&
19+
$(cd "$RUNAFTER_WORKINGDIR" && sudo -u "${USER:-root}" "$JAVAEXECUTABLE" -classpath "$RUNAFTER_MAINJAR" "$RUNAFTER_MAINCLASS" {{startArgument}})&
2020
fi
2121
if [ ! -z "$RUNINBACKGROUND" ]; then
2222
# bring job back into foreground

testBuilds/setupBuilder.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ setupBuilder {
5555
runBeforeUninstall {
5656
mainClass = 'com.inet.testapplication.TestLauncher'
5757
}
58+
runAfter {
59+
mainClass = 'com.inet.testapplication.TestLauncher'
60+
mainJar = 'testBuilds.jar'
61+
}
5862
service {
5963
displayName = "i-net TestLaunch Server"
6064
id = "helpdesk"

0 commit comments

Comments
 (0)