From 83a6ae69ae1519d70f085e821718c65897c5b3bd Mon Sep 17 00:00:00 2001 From: Lloyd Date: Tue, 24 Feb 2026 11:36:46 +0000 Subject: [PATCH] Add sudo and create sudoers directory for service management in install and upgrade functions --- manage.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/manage.sh b/manage.sh index 7d0e5e6..f5a28c2 100755 --- a/manage.sh +++ b/manage.sh @@ -254,7 +254,7 @@ install_repeater() { echo ">>> Installing system dependencies..." apt-get update -qq - DEBIAN_FRONTEND=noninteractive apt-get install -y libffi-dev libusb-1.0-0 policykit-1 jq pip python3-rrdtool wget swig build-essential python3-dev + DEBIAN_FRONTEND=noninteractive apt-get install -y libffi-dev libusb-1.0-0 sudo policykit-1 jq pip python3-rrdtool wget swig build-essential python3-dev pip install --break-system-packages setuptools_scm 2>&1 || true # Install mikefarah yq v4 if not already installed @@ -342,6 +342,7 @@ EOF # Also configure sudoers as fallback for service restart echo ">>> Configuring sudoers for service management..." + mkdir -p /etc/sudoers.d cat > /etc/sudoers.d/pymc-repeater <<'EOF' # Allow repeater user to manage the pymc-repeater service without password repeater ALL=(root) NOPASSWD: /usr/bin/systemctl restart pymc-repeater, /usr/bin/systemctl stop pymc-repeater, /usr/bin/systemctl start pymc-repeater, /usr/bin/systemctl status pymc-repeater @@ -542,7 +543,7 @@ upgrade_repeater() { echo "[3/9] Updating system dependencies..." apt-get update -qq - apt-get install -y libffi-dev libusb-1.0-0 policykit-1 jq pip python3-rrdtool wget swig build-essential python3-dev + apt-get install -y libffi-dev libusb-1.0-0 sudo policykit-1 jq pip python3-rrdtool wget swig build-essential python3-dev pip install --break-system-packages setuptools_scm >/dev/null 2>&1 || true # Install mikefarah yq v4 if not already installed @@ -634,6 +635,7 @@ polkit.addRule(function(action, subject) { EOF chmod 0644 /etc/polkit-1/rules.d/10-pymc-repeater.rules # Also configure sudoers as fallback for service restart + mkdir -p /etc/sudoers.d cat > /etc/sudoers.d/pymc-repeater <<'EOF' # Allow repeater user to manage the pymc-repeater service without password repeater ALL=(root) NOPASSWD: /usr/bin/systemctl restart pymc-repeater, /usr/bin/systemctl stop pymc-repeater, /usr/bin/systemctl start pymc-repeater, /usr/bin/systemctl status pymc-repeater