Convert systemd unit to user script via custom install scripts
All checks were successful
Run Tests on Code / run-tests (push) Successful in 14s
All checks were successful
Run Tests on Code / run-tests (push) Successful in 14s
This commit is contained in:
parent
e1dd7c0046
commit
6b847ba34e
3 changed files with 65 additions and 0 deletions
33
debian/postinst
vendored
Normal file
33
debian/postinst
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
# Automatically added by cargo-deb
|
||||
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
|
||||
if deb-systemd-helper --user debian-installed cloudflare-dns-updater.service; then
|
||||
# This will only remove masks created by d-s-h on package removal.
|
||||
deb-systemd-helper --user unmask cloudflare-dns-updater.service >/dev/null || true
|
||||
|
||||
if deb-systemd-helper --user --quiet was-enabled cloudflare-dns-updater.service; then
|
||||
# Create new symlinks, if any.
|
||||
deb-systemd-helper --user enable cloudflare-dns-updater.service >/dev/null || true
|
||||
fi
|
||||
fi
|
||||
|
||||
# Update the statefile to add new symlinks (if any), which need to be cleaned
|
||||
# up on purge. Also remove old symlinks.
|
||||
deb-systemd-helper --user update-state cloudflare-dns-updater.service >/dev/null || true
|
||||
fi
|
||||
# End automatically added section
|
||||
# Automatically added by cargo-deb
|
||||
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
|
||||
if [ -d /run/systemd/system ]; then
|
||||
USER="$(who | head -1 | awk '{print $1;}')"
|
||||
runuser -l $USER -c "XDG_RUNTIME_DIR=/run/user/$(id -u $USER) systemctl --user daemon-reload >/dev/null || true"
|
||||
if [ -n "$2" ]; then
|
||||
_dh_action=restart
|
||||
else
|
||||
_dh_action=start
|
||||
fi
|
||||
runuser -l $USER -c "XDG_RUNTIME_DIR=/run/user/$(id -u $USER) deb-systemd-invoke --user $_dh_action cloudflare-dns-updater.service >/dev/null || true"
|
||||
fi
|
||||
fi
|
||||
# End automatically added section
|
24
debian/postrm
vendored
Normal file
24
debian/postrm
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
# Automatically added by cargo-deb
|
||||
if [ -d /run/systemd/system ]; then
|
||||
USER="$(who | head -1 | awk '{print $1;}')"
|
||||
runuser -l $USER -c "XDG_RUNTIME_DIR=/run/user/$(id -u $USER) systemctl --user daemon-reload >/dev/null || true"
|
||||
fi
|
||||
# End automatically added section
|
||||
# Automatically added by cargo-deb
|
||||
if [ "$1" = "remove" ]; then
|
||||
if [ -x "/usr/bin/deb-systemd-helper" ]; then
|
||||
USER="$(who | head -1 | awk '{print $1;}')"
|
||||
runuser -l $USER -c "XDG_RUNTIME_DIR=/run/user/$(id -u $USER) deb-systemd-helper --user mask cloudflare-dns-updater.service >/dev/null || true"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$1" = "purge" ]; then
|
||||
if [ -x "/usr/bin/deb-systemd-helper" ]; then
|
||||
USER="$(who | head -1 | awk '{print $1;}')"
|
||||
runuser -l $USER -c "XDG_RUNTIME_DIR=/run/user/$(id -u $USER) deb-systemd-helper --user purge cloudflare-dns-updater.service >/dev/null || true"
|
||||
runuser -l $USER -c "XDG_RUNTIME_DIR=/run/user/$(id -u $USER) deb-systemd-helper --user unmask cloudflare-dns-updater.service >/dev/null || true"
|
||||
fi
|
||||
fi
|
||||
# End automatically added section
|
8
debian/prerm
vendored
Normal file
8
debian/prerm
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
# Automatically added by cargo-deb
|
||||
if [ -d /run/systemd/system ] && [ "$1" = remove ]; then
|
||||
USER="$(who | head -1 | awk '{print $1;}')"
|
||||
runuser -l $USER -c "XDG_RUNTIME_DIR=/run/user/$(id -u $USER) deb-systemd-invoke --user stop cloudflare-dns-updater.service >/dev/null || true"
|
||||
fi
|
||||
# End automatically added section
|
Loading…
Reference in a new issue