From 635c6224517b3a1ea97ea2fe05f2f39e1432fce6 Mon Sep 17 00:00:00 2001 From: Yigit Colakoglu Date: Mon, 5 Apr 2021 00:07:06 +0300 Subject: [PATCH] Sudo fix --- arch-setup/chroot.sh | 6 +----- local/bin/dmenu-logout | 16 ++++------------ 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/arch-setup/chroot.sh b/arch-setup/chroot.sh index 0529259b..82c09c3d 100755 --- a/arch-setup/chroot.sh +++ b/arch-setup/chroot.sh @@ -203,12 +203,8 @@ fi mkdir -p /etc/sudoers.d echo "Defaults env_reset,pwfeedback" >> /etc/sudoers.d/wheel echo "%wheel ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/nopwd +echo "$username $hostname =NOPASSWD: /sbin/shutdown ,/sbin/halt,/sbin/reboot,/sbin/hibernate, /bin/pacman -Syyuw --noconfirm" > /etc/sudoers.d/wheel -if [ -f "/install/artix" ]; then - echo "$username $hostname =NOPASSWD: /usr/bin/systemctl poweroff,/usr/bin/systemctl halt,/usr/bin/systemctl reboot,/usr/bin/systemctl hibernate,/bin/pacman -Syyuw --noconfirm" > /etc/sudoers.d/wheel -else - echo "$username $hostname =NOPASSWD: /usr/bin/systemctl poweroff,/usr/bin/systemctl halt,/usr/bin/systemctl reboot,/usr/bin/systemctl hibernate,/bin/pacman -Syyuw --noconfirm" > /etc/sudoers.d/wheel -fi sudo -u $username bash -c "git clone https://aur.archlinux.org/yay.git /tmp/yay" sudo -u $username bash -c "(cd /tmp/yay; makepkg --noconfirm -si)" diff --git a/local/bin/dmenu-logout b/local/bin/dmenu-logout index 87a1097e..1de59040 100755 --- a/local/bin/dmenu-logout +++ b/local/bin/dmenu-logout @@ -13,11 +13,6 @@ killprogs() { pkill -x redshift } -# Restart function -# shellcheck source=/dev/null -restart() { - reboot -} # Logout function logout() { @@ -39,23 +34,20 @@ poweroff" selection=$(printf '%s' "$items" | $DMENU) case $selection in - restart) - restart - ;; logout) logout ;; hibernate) - sudo systemctl hibernate + loginctl hibernate ;; suspend) - sudo systemctl suspend + sudo /sbin/sleep ;; reboot) - sudo systemctl reboot + sudo /sbin/reboot ;; halt|poweroff|shutdown) - sudo systemctl poweroff + sudo /sbin/shutdown ;; esac