Commit 66193a348c9dc94bf6cafbc6b805642f705b9c00

Authored by Igor Kulikov
1 parent ab494596

Improve debian packaging scripts.

@@ -160,6 +160,13 @@ buildDeb { @@ -160,6 +160,13 @@ buildDeb {
160 user pkgName 160 user pkgName
161 permissionGroup pkgName 161 permissionGroup pkgName
162 162
  163 + // Copy the system unit files
  164 + from("${buildDir}/control/${pkgName}.service") {
  165 + addParentDirs = false
  166 + fileMode 0644
  167 + into "/lib/systemd/system"
  168 + }
  169 +
163 directory(pkgLogFolder, 0755) 170 directory(pkgLogFolder, 0755)
164 link("/etc/init.d/${pkgName}", "${pkgInstallFolder}/bin/${pkgName}.jar") 171 link("/etc/init.d/${pkgName}", "${pkgInstallFolder}/bin/${pkgName}.jar")
165 link("${pkgInstallFolder}/bin/${pkgName}.yml", "${pkgInstallFolder}/conf/${pkgName}.yml") 172 link("${pkgInstallFolder}/bin/${pkgName}.yml", "${pkgInstallFolder}/conf/${pkgName}.yml")
1 #!/bin/sh 1 #!/bin/sh
2 2
  3 +set -e
  4 +
3 chown -R ${pkg.name}: ${pkg.logFolder} 5 chown -R ${pkg.name}: ${pkg.logFolder}
4 chown -R ${pkg.name}: ${pkg.installFolder} 6 chown -R ${pkg.name}: ${pkg.installFolder}
5 -update-rc.d ${pkg.name} defaults 7 +systemctl --no-reload enable ${pkg.name}.service >/dev/null 2>&1 || :
6 8
  9 +exit 0
1 #!/bin/sh 1 #!/bin/sh
2 2
3 -update-rc.d -f ${pkg.name} remove 3 +set -e
  4 +
  5 +systemctl --no-reload disable --now ${pkg.name}.service > /dev/null 2>&1 || :
  6 +
  7 +exit 0
1 #!/bin/sh 1 #!/bin/sh
2 2
  3 +set -e
  4 +
3 if ! getent group ${pkg.name} >/dev/null; then 5 if ! getent group ${pkg.name} >/dev/null; then
4 addgroup --system ${pkg.name} 6 addgroup --system ${pkg.name}
5 fi 7 fi
@@ -16,3 +18,5 @@ if ! getent passwd ${pkg.name} >/dev/null; then @@ -16,3 +18,5 @@ if ! getent passwd ${pkg.name} >/dev/null; then
16 -gecos "Thingsboard application" \ 18 -gecos "Thingsboard application" \
17 ${pkg.name} 19 ${pkg.name}
18 fi 20 fi
  21 +
  22 +exit 0
1 #!/bin/sh 1 #!/bin/sh
2 2
  3 +set -e
  4 +
3 if [ -e /var/run/${pkg.name}/${pkg.name}.pid ]; then 5 if [ -e /var/run/${pkg.name}/${pkg.name}.pid ]; then
4 service ${pkg.name} stop 6 service ${pkg.name} stop
5 fi 7 fi
  8 +
  9 +exit 0