From b34989191587115a33fa6fad4290ce3599cf1549 Mon Sep 17 00:00:00 2001 From: Akemi Izuko Date: Sat, 23 Dec 2023 20:14:07 -0700 Subject: [PATCH] Update: sudoer for xremap.service --- bin/switch_keyboards.sh | 2 +- post_install.sh | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/bin/switch_keyboards.sh b/bin/switch_keyboards.sh index 6f8c0dd..3a55b28 100755 --- a/bin/switch_keyboards.sh +++ b/bin/switch_keyboards.sh @@ -69,5 +69,5 @@ case "$(echo "$1" | awk '{print tolower($0)}')" in ;; esac -systemctl restart xremap +sudo /usr/bin/systemctl restart xremap.service sleep 2 diff --git a/post_install.sh b/post_install.sh index 8906dbc..8c72f26 100755 --- a/post_install.sh +++ b/post_install.sh @@ -145,6 +145,7 @@ xremap_checks() { check_xremap_etc check_xremap_executable check_xremap_systemd + check_xremap_sudoer } check_xremap_config() { @@ -207,6 +208,18 @@ check_xremap_systemd() { return $return_code } +check_xremap_sudoer() { + local return_code=0 + + if ! sudo -l | grep -Eq 'NOPASSWD:[[:space:]]+/usr/bin/systemctl restart xremap.service'; then + printf "ERR: xremap.service not passwordless for sudoers\n" + printf "\t $ please echo \"%wheel ALL=NOPASSWD: /usr/bin/systemctl restart xremap.service\" >> /etc/sudoers.d/xremap\n" + return_code=1 + fi + + return $return_code +} + #################### # Browsers #################### @@ -300,9 +313,9 @@ check_vimiv_plugin() { if ! [[ -e /usr/lib/qt/plugins/imageformats/libqavif.so ]]; then printf "ERR: Missing avif support for vimiv\n" cat <