Merge pull request 'Closes #34' (#35) from systemd-fix into main
All checks were successful
Run Tests on Code / run-tests (push) Successful in 8s
All checks were successful
Run Tests on Code / run-tests (push) Successful in 8s
Reviewed-on: #35
This commit is contained in:
commit
9dfd21ce8d
6 changed files with 3 additions and 94 deletions
|
@ -16,12 +16,7 @@ assets = [
|
||||||
"target/release/cloudflare-dns-updater",
|
"target/release/cloudflare-dns-updater",
|
||||||
"/usr/local/bin/cloudflare-dns-updater",
|
"/usr/local/bin/cloudflare-dns-updater",
|
||||||
"755",
|
"755",
|
||||||
],
|
]
|
||||||
[
|
|
||||||
"debian/cloudflare-dns-updater-user.service",
|
|
||||||
"/lib/systemd/user/cloudflare-dns-updater.service",
|
|
||||||
"755",
|
|
||||||
],
|
|
||||||
]
|
]
|
||||||
systemd-units = { enable = false }
|
systemd-units = { enable = false }
|
||||||
|
|
||||||
|
|
13
debian/cloudflare-dns-updater.service
vendored
13
debian/cloudflare-dns-updater.service
vendored
|
@ -1,13 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description="Application for automatically updating Cloudflare DNS records"
|
|
||||||
After=syslog.target
|
|
||||||
After=network-online.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=simple
|
|
||||||
ExecStart=/usr/local/bin/cloudflare-dns-updater
|
|
||||||
Restart=always
|
|
||||||
RestartSec=3
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
|
@ -5,9 +5,10 @@ After=network-online.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
|
User=%i
|
||||||
ExecStart=/usr/local/bin/cloudflare-dns-updater
|
ExecStart=/usr/local/bin/cloudflare-dns-updater
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=3
|
RestartSec=3
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=default.target
|
WantedBy=multi-user.target
|
36
debian/postinst
vendored
36
debian/postinst
vendored
|
@ -1,36 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
#DEBHELPER#
|
|
||||||
|
|
||||||
# Also enable User Service
|
|
||||||
|
|
||||||
# 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
|
|
27
debian/postrm
vendored
27
debian/postrm
vendored
|
@ -1,27 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
#DEBHELPER#
|
|
||||||
|
|
||||||
# Also enable User Service
|
|
||||||
|
|
||||||
# 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
|
|
11
debian/prerm
vendored
11
debian/prerm
vendored
|
@ -1,11 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
#DEBHELPER#
|
|
||||||
|
|
||||||
# Also enable User Service
|
|
||||||
|
|
||||||
# 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