From 74cb65a658157d77eca5971f3da9a4a49bc543b7 Mon Sep 17 00:00:00 2001 From: Neshura Date: Mon, 8 Jan 2024 08:42:17 +0000 Subject: [PATCH 1/6] Add User Variable to Service File --- ...flare-dns-updater.service => cloudflare-dns-updater@.service} | 1 + 1 file changed, 1 insertion(+) rename debian/{cloudflare-dns-updater.service => cloudflare-dns-updater@.service} (87%) diff --git a/debian/cloudflare-dns-updater.service b/debian/cloudflare-dns-updater@.service similarity index 87% rename from debian/cloudflare-dns-updater.service rename to debian/cloudflare-dns-updater@.service index cf21d93..226f0f4 100644 --- a/debian/cloudflare-dns-updater.service +++ b/debian/cloudflare-dns-updater@.service @@ -5,6 +5,7 @@ After=network-online.target [Service] Type=simple +User=%i ExecStart=/usr/local/bin/cloudflare-dns-updater Restart=always RestartSec=3 From ba34228cbd0e8946ab73a5ea389cf7cf4dd6ba5d Mon Sep 17 00:00:00 2001 From: Neshura Date: Mon, 8 Jan 2024 08:42:44 +0000 Subject: [PATCH 2/6] Remove User Service File --- debian/cloudflare-dns-updater-user.service | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 debian/cloudflare-dns-updater-user.service diff --git a/debian/cloudflare-dns-updater-user.service b/debian/cloudflare-dns-updater-user.service deleted file mode 100644 index e83260c..0000000 --- a/debian/cloudflare-dns-updater-user.service +++ /dev/null @@ -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=default.target \ No newline at end of file From 46bf5dc50d4e62a6a607cef50e703c241e6912f2 Mon Sep 17 00:00:00 2001 From: Neshura Date: Mon, 8 Jan 2024 08:43:04 +0000 Subject: [PATCH 3/6] Remove deprecated scripts for User Service File --- debian/postinst | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 debian/postinst diff --git a/debian/postinst b/debian/postinst deleted file mode 100644 index 8a473f8..0000000 --- a/debian/postinst +++ /dev/null @@ -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 From bbee00c9f9628283b83ae3e8769c47c4d7a3a1dd Mon Sep 17 00:00:00 2001 From: Neshura Date: Mon, 8 Jan 2024 08:43:08 +0000 Subject: [PATCH 4/6] Remove deprecated scripts for User Service File --- debian/postrm | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 debian/postrm diff --git a/debian/postrm b/debian/postrm deleted file mode 100644 index 9f6feef..0000000 --- a/debian/postrm +++ /dev/null @@ -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 From 9d5c3fcc231d689204c91b2b3a081151cbef1cf0 Mon Sep 17 00:00:00 2001 From: Neshura Date: Mon, 8 Jan 2024 08:43:14 +0000 Subject: [PATCH 5/6] Remove deprecated scripts for User Service File --- debian/prerm | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 debian/prerm diff --git a/debian/prerm b/debian/prerm deleted file mode 100644 index 967f973..0000000 --- a/debian/prerm +++ /dev/null @@ -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 From dec68349208830313b58652ade4740b4faed1f75 Mon Sep 17 00:00:00 2001 From: Neshura Date: Mon, 8 Jan 2024 08:43:43 +0000 Subject: [PATCH 6/6] Remove User Service file from cargo deb config --- Cargo.toml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9985f14..ebe5ffb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,12 +16,7 @@ assets = [ "target/release/cloudflare-dns-updater", "/usr/local/bin/cloudflare-dns-updater", "755", - ], - [ - "debian/cloudflare-dns-updater-user.service", - "/lib/systemd/user/cloudflare-dns-updater.service", - "755", - ], + ] ] systemd-units = { enable = false }