summaryrefslogtreecommitdiff
path: root/linux/deb
diff options
context:
space:
mode:
Diffstat (limited to 'linux/deb')
-rwxr-xr-xlinux/deb/02-fs-spring-boot-kamal/package/DEBIAN/postinst47
-rwxr-xr-xlinux/deb/02-fs-spring-boot-kamal/package/DEBIAN/postrm9
-rwxr-xr-xlinux/deb/02-fs-spring-boot-kamal/package/DEBIAN/prerm2
3 files changed, 32 insertions, 26 deletions
diff --git a/linux/deb/02-fs-spring-boot-kamal/package/DEBIAN/postinst b/linux/deb/02-fs-spring-boot-kamal/package/DEBIAN/postinst
index 430ba0a..67fffe0 100755
--- a/linux/deb/02-fs-spring-boot-kamal/package/DEBIAN/postinst
+++ b/linux/deb/02-fs-spring-boot-kamal/package/DEBIAN/postinst
@@ -28,21 +28,32 @@ chmod 750 /etc/fs-spring-boot-kamal
chmod 640 /etc/fs-spring-boot-kamal/application.yaml
chmod 640 /etc/fs-spring-boot-kamal/environment.env
-# Reload systemd service configurations
-systemctl daemon-reload
-
-# Enable service as boot time
-#systemctl enable fs-spring-boot-kamal
-
-# Restart service
-#systemctl restart fs-spring-boot-kamal
-
-echo "[INFO] fs-spring-boot-kamal service installed."
-echo "[INFO] Update /etc/fs-spring-boot-kamal/application.yaml to update the configuration."
-echo "[INFO] By default, TCP port 8085 is used by the installed server."
-echo "[INFO] To enable service start at boot time:"
-echo "[INFO] systemctl enable fs-spring-boot-kamal"
-echo "[INFO] To start the service if not running:"
-echo "[INFO] systemctl start fs-spring-boot-kamal"
-echo "[INFO] To allow access from remote systems, you may have to enable firewall for example by running:"
-echo "[INFO] ufw allow 8085/tcp"
+if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
+ if [ -d /run/systemd/system ]; then
+ # Reload systemd service configurations
+ systemctl daemon-reload > /dev/null || true
+
+ if [ -n "$2" ]; then
+ # Upgrade
+ # Restart service
+ if systemctl is-enabled fs-spring-boot-kamal > /dev/null; then
+ systemctl start fs-spring-boot-kamal
+ fi
+ else
+ # First install (not upgrade)
+ # Enable service to start at boot time
+ systemctl enable fs-spring-boot-kamal
+ # Start service
+ systemctl start fs-spring-boot-kamal
+ fi
+ fi
+fi
+
+if [ "$1" == "configure" ] && [ -z "$2" ]; then
+ # Code here executes only during package install (but not during upgrade)
+ echo "[INFO] fs-spring-boot-kamal service installed."
+ echo "[INFO] Update /etc/fs-spring-boot-kamal/application.yaml to update the configuration."
+ echo "[INFO] By default, TCP port 8085 is used by the installed server."
+ echo "[INFO] To allow access from remote systems, you may have to enable firewall for example by running:"
+ echo "[INFO] ufw allow 8085/tcp"
+fi
diff --git a/linux/deb/02-fs-spring-boot-kamal/package/DEBIAN/postrm b/linux/deb/02-fs-spring-boot-kamal/package/DEBIAN/postrm
index 81484c0..194b357 100755
--- a/linux/deb/02-fs-spring-boot-kamal/package/DEBIAN/postrm
+++ b/linux/deb/02-fs-spring-boot-kamal/package/DEBIAN/postrm
@@ -2,18 +2,13 @@
set -e
# Check if the package is being purged (erased entirely including configs)
-if [ "$1" = "purge" ]; then
+if [ -z "$DPKG_ROOT" ] && [ "$1" = "purge" ] ; then
+ update-rc.d fs-spring-boot-kamal remove >/dev/null
deluser --quiet fs-spring-boot-kamal || true
fi
-# Run commands during simple remove or upgrade
-#if [ "$1" = "remove" ] || [ "$1" = "upgrade" ]; then
-
-#fi
-
# Reload systemd service configuration files.
systemctl daemon-reload
# postrm script must exit with 0
exit 0
-
diff --git a/linux/deb/02-fs-spring-boot-kamal/package/DEBIAN/prerm b/linux/deb/02-fs-spring-boot-kamal/package/DEBIAN/prerm
index b9a5971..7cb5d88 100755
--- a/linux/deb/02-fs-spring-boot-kamal/package/DEBIAN/prerm
+++ b/linux/deb/02-fs-spring-boot-kamal/package/DEBIAN/prerm
@@ -1,7 +1,7 @@
#!/bin/bash
set -e
-# Stop associated services before files are removed
+# Stop service before files are removed
systemctl stop fs-spring-boot-kamal || true
# prerm script must exit with 0