浏览代码

resolve passwordless aur installation

Casey DeLorme 1 周之前
父节点
当前提交
62ff662e32
共有 1 个文件被更改,包括 6 次插入7 次删除
  1. 6 7
      arch.sh

+ 6 - 7
arch.sh

@@ -144,9 +144,11 @@ ln -sf /usr/bin/vim /usr/local/bin/vi
 sed -i 's/!ccache/ccache/' /etc/makepkg.conf
 sed -i 's/^#MAKEFLAGS.*/MAKEFLAGS="-j$(($(nproc) + 1)) -l$(nproc)"/' /etc/makepkg.conf
 
-# create sudo group and add to sudoers
+# create sudo group
 groupadd -fr sudo
-[ ! -f /etc/sudoers.d/sudo ] && echo '%sudo ALL=(ALL) ALL' > /etc/sudoers.d/sudo
+
+# temporarily make sudo passwordless for automation
+echo '%sudo ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/sudo
 
 # update font cache
 fc-cache -fr
@@ -211,9 +213,6 @@ fi
 su $username -c "mkdir -p ~/code/aur.archlinux.org"
 export user_home="$(getent passwd $username | cut -d: -f6)/"
 
-# temporarily override sudo for this user
-echo "${username} ALL= NOPASSWD: /usr/bin/pacman" > /etc/sudoers.d/${username}
-
 # install qview
 sudo -u $username git clone https://aur.archlinux.org/qview.git ${user_home}/aur.archlinux.org/qview
 (cd ${user_home}/aur.archlinux.org/qview && sudo -u ${username} makepkg -rcsi --noconfirm)
@@ -235,8 +234,8 @@ sudo -u $username git clone https://aur.archlinux.org/vimix-cursors.git ${user_h
 sudo -u $username git clone https://aur.archlinux.org/numix-icon-theme-git.git ${user_home}/aur.archlinux.org/numix-icon-theme-git
 (cd ${user_home}/aur.archlinux.org/numix-icon-theme-git && sudo -u ${username} makepkg -rcsi --noconfirm)
 
-# clear sudo override
-[ -f /etc/sudoers.d/${username} ] && rm /etc/sudoers.d/${username}
+# restore password requirement to sudo group
+echo '%sudo ALL=(ALL) ALL' > /etc/sudoers.d/sudo
 
 # enable services for next reboot
 which acpid &> /dev/null && systemctl enable acpid