From d860f1d40247a30556f819a06cbf87cda43c938e Mon Sep 17 00:00:00 2001 From: Orazio Date: Sat, 24 Oct 2020 13:41:07 +0200 Subject: [PATCH] Add systemd override for wg-quick units that don't yet implement reload - Discussed on pull request 1164 --- auto_install/install.sh | 7 +++++++ files/etc/systemd/system/wg-quick@.service.d/override.conf | 2 ++ scripts/uninstall.sh | 4 ++++ 3 files changed, 13 insertions(+) create mode 100644 files/etc/systemd/system/wg-quick@.service.d/override.conf diff --git a/auto_install/install.sh b/auto_install/install.sh index 1e2d083..7ed1c33 100755 --- a/auto_install/install.sh +++ b/auto_install/install.sh @@ -2037,6 +2037,13 @@ confOVPN(){ } confWireGuard(){ + # Reload job type is not yet available in wireguard-tools shipped with Ubuntu 20.04 + if ! grep -q 'ExecReload' /usr/lib/systemd/system/wg-quick@.service; then + echo "::: Adding additional reload job type for wg-quick unit" + $SUDOE install -m 644 "${pivpnFilesDir}"/files/etc/systemd/system/wg-quick@.service.d/override.conf /etc/systemd/system/wg-quick@.service.d/override.conf + $SUDO systemctl daemon-reload + fi + if [ -d /etc/wireguard ]; then # Backup the wireguard folder WIREGUARD_BACKUP="wireguard_$(date +%Y-%m-%d-%H%M%S).tar.gz" diff --git a/files/etc/systemd/system/wg-quick@.service.d/override.conf b/files/etc/systemd/system/wg-quick@.service.d/override.conf new file mode 100644 index 0000000..54e6bb8 --- /dev/null +++ b/files/etc/systemd/system/wg-quick@.service.d/override.conf @@ -0,0 +1,2 @@ +[Service] +ExecReload=/bin/bash -c 'exec /usr/bin/wg syncconf %i <(exec /usr/bin/wg-quick strip %i)' diff --git a/scripts/uninstall.sh b/scripts/uninstall.sh index 7b00b78..4e04f05 100755 --- a/scripts/uninstall.sh +++ b/scripts/uninstall.sh @@ -146,6 +146,10 @@ removeAll(){ ${UPDATE_PKG_CACHE} &> /dev/null & spinner $! fi + if [ -f /etc/systemd/system/wg-quick@.service.d/override.conf ]; then + rm -f /etc/systemd/system/wg-quick@.service.d/override.conf + fi + elif [ "${i}" = "unattended-upgrades" ]; then rm -rf /var/log/unattended-upgrades