Patched some stuff for root

master
John Hammond 2019-10-01 08:27:21 -04:00
parent 8f87c44784
commit c9f3f0c74f
1 changed files with 9 additions and 1 deletions

View File

@ -62,6 +62,7 @@ DEPENDENCIES="\
############################################################## ##############################################################
function create_new_user(){ function create_new_user(){
pacman -Sy sudo --noconfirm
id -u $NEW_USER > /dev/null id -u $NEW_USER > /dev/null
if [ $? -eq 1 ] if [ $? -eq 1 ]
@ -79,6 +80,7 @@ function create_new_user(){
groupadd sudo groupadd sudo
usermod -aG sudo $NEW_USER usermod -aG sudo $NEW_USER
sed -i 's/# %sudo/%sudo/g' /etc/sudoers sed -i 's/# %sudo/%sudo/g' /etc/sudoers
echo "$NEW_USER ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
chown $NEW_USER:$NEW_USER /home/$NEW_USER chown $NEW_USER:$NEW_USER /home/$NEW_USER
chown -R $NEW_USER:$NEW_USER $(pwd) chown -R $NEW_USER:$NEW_USER $(pwd)
@ -86,6 +88,10 @@ function create_new_user(){
cd /home/$NEW_USER/archlinux cd /home/$NEW_USER/archlinux
} }
function cleanup(){
sed -i "s/$NEW_USER ALL=(ALL) NOPASSWD: ALL//g" /etc/sudoers
}
############################################################### ###############################################################
@ -150,7 +156,7 @@ function install_yay(){
chown $NEW_USER:$NEW_USER /opt/yay chown $NEW_USER:$NEW_USER /opt/yay
cd yay cd yay
sudo -u $NEW_USER bash -c 'cd /opt/yay/ && makepkg -si' sudo -u $NEW_USER bash -c 'cd /opt/yay/ && yes|makepkg -si'
popd popd
sudo -u $NEW_USER bash -c 'yes|yay' sudo -u $NEW_USER bash -c 'yes|yay'
} }
@ -215,3 +221,5 @@ configure_vim
configure_git configure_git
prepare_opt prepare_opt
install_yay install_yay
cleanup