Merge pull request #2 from santilococo/testNeededFlag

Test needed flag
This commit is contained in:
Santiago Lo Coco 2022-01-04 01:53:13 -03:00 committed by GitHub
commit 70da042b77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 8 deletions

View File

@ -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)