Add autostart option for GUI
Gitea/Java-Installer/pipeline/head This commit looks good
Details
Gitea/Java-Installer/pipeline/head This commit looks good
Details
parent
84a827de40
commit
41f71857b7
|
@ -6,17 +6,17 @@ plugins {
|
||||||
|
|
||||||
// Set version of programm //
|
// Set version of programm //
|
||||||
|
|
||||||
version = "1.0.2"
|
version = "1.0.3"
|
||||||
def version = "1.0.2"
|
def version = "1.0.3"
|
||||||
|
|
||||||
group = "de.rpjosh"
|
group = "de.rpjosh"
|
||||||
|
|
||||||
// ----- //
|
// ----- //
|
||||||
|
|
||||||
// Set correct encoding
|
// Set correct encoding
|
||||||
compileJava.options.encoding = 'ISO-8859-1'
|
compileJava.options.encoding = 'UTF-8'
|
||||||
tasks.withType(Javadoc) {
|
tasks.withType(Javadoc) {
|
||||||
options.encoding = 'ISO-8859-1'
|
options.encoding = 'UTF-8'
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceCompatibility = 11
|
sourceCompatibility = 11
|
||||||
|
|
|
@ -106,6 +106,11 @@ public class InstallConfig {
|
||||||
protected String serviceRestart;
|
protected String serviceRestart;
|
||||||
protected Integer serviceRestartSec;
|
protected Integer serviceRestartSec;
|
||||||
|
|
||||||
|
// GUI autostart //
|
||||||
|
protected boolean createGuiAutostart;
|
||||||
|
protected String guiAutostartUser;
|
||||||
|
protected String guiAutostartFlags;
|
||||||
|
|
||||||
// ----- //
|
// ----- //
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -341,6 +346,18 @@ public class InstallConfig {
|
||||||
this.serviceRestartSec = serviceRestartSec;
|
this.serviceRestartSec = serviceRestartSec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [Linux] Creates an auto start for your GUI application that will be started directly after the window manager was loaded
|
||||||
|
*
|
||||||
|
* @param user User for which the GUI should be started
|
||||||
|
* @param startFlags Execution flags to add to the launch script like "--minimized"
|
||||||
|
*/
|
||||||
|
public void createGuiAutostart(String user, String startFlags) {
|
||||||
|
this.createGuiAutostart = true;
|
||||||
|
this.guiAutostartUser = user;
|
||||||
|
this.guiAutostartFlags= startFlags;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Removal options //
|
// Removal options //
|
||||||
|
|
||||||
|
|
|
@ -471,6 +471,13 @@ public class Installer {
|
||||||
// create a systemd unit file //
|
// create a systemd unit file //
|
||||||
if (conf.createUnitFile) this.createUnitFile();
|
if (conf.createUnitFile) this.createUnitFile();
|
||||||
|
|
||||||
|
// create a GUI auto start file //
|
||||||
|
if (conf.createGuiAutostart) {
|
||||||
|
// Currently only Gnome is supported
|
||||||
|
String pathMenu = "/home/" + conf.guiAutostartUser + "/.config/autostart/" + conf.getApplicationNameShort() + ".desktop";
|
||||||
|
this.createDesktopShortcut(pathMenu, conf.guiAutostartFlags);
|
||||||
|
}
|
||||||
|
|
||||||
// create a uninstaller //
|
// create a uninstaller //
|
||||||
try {
|
try {
|
||||||
String batchFileUninstall = "#!/bin/bash" + "\n"
|
String batchFileUninstall = "#!/bin/bash" + "\n"
|
||||||
|
@ -519,6 +526,11 @@ public class Installer {
|
||||||
+ "systemctl daemon-reload" + "\n"
|
+ "systemctl daemon-reload" + "\n"
|
||||||
+ "\n";
|
+ "\n";
|
||||||
}
|
}
|
||||||
|
// remove autostart entry
|
||||||
|
if (conf.createGuiAutostart) {
|
||||||
|
batchFileUninstall
|
||||||
|
+= "rm -f \"" + "/home/" + conf.guiAutostartUser + "/.config/autostart/" + conf.getApplicationNameShort() + ".desktop\"" + "\n";
|
||||||
|
}
|
||||||
|
|
||||||
batchFileUninstall += "\necho \"\"";
|
batchFileUninstall += "\necho \"\"";
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue