diff --git a/install.sh b/install.sh index 4687c98..3fdad6c 100755 --- a/install.sh +++ b/install.sh @@ -210,21 +210,29 @@ installPackage() { fi ;; B) - runInChroot "pacman -Q ${1}" 2>&1 | debug - [ $? -eq 0 ] && [ "$2" != "R" ] && return + flag="" + if [ "$2" != "R" ]; then + runInChroot "pacman -Q ${1}" 2>&1 | debug + [ $? -eq 0 ] && return + flag="--needed" + fi if [ $debugFlagToStdout = true ] || [ $debugFlag = true ]; then - runInChroot "script -qec \"pacman -S --noconfirm ${1}\" /dev/null" 2>&1 | debug + runInChroot "script -qec \"pacman -S $flag --noconfirm ${1}\" /dev/null" 2>&1 | debug else - runInChroot "pacman -S --noconfirm ${1}" 2>&1 | debug + runInChroot "pacman -S $flag --noconfirm ${1}" 2>&1 | debug fi ;; C) - runInChroot "sudo -u $username paru -Q ${1}" 2>&1 | debug - [ $? -eq 0 ] && [ "$2" != "R" ] && return + flag="" + if [ "$2" != "R" ]; then + runInChroot "sudo -u $username paru -Q ${1}" 2>&1 | debug + [ $? -eq 0 ] && return + flag="--needed" + fi if [ $debugFlagToStdout = true ] || [ $debugFlag = true ]; then - runInChroot "script -qec \"sudo -u $username paru -S --noconfirm --skipreview ${1}\" /dev/null" 2>&1 | debug + runInChroot "script -qec \"sudo -u $username paru -S $flag --noconfirm --skipreview ${1}\" /dev/null" 2>&1 | debug else - runInChroot "sudo -u $username paru -S --noconfirm --skipreview ${1}" 2>&1 | debug + runInChroot "sudo -u $username paru -S $flag --noconfirm --skipreview ${1}" 2>&1 | debug fi ;; D)