Add validations

This commit is contained in:
Santiago Lo Coco 2021-12-27 12:05:37 -03:00
parent 6205cb2815
commit ad12222ed1
1 changed files with 8 additions and 3 deletions

View File

@ -101,7 +101,12 @@ installPackage() {
# whiptail --msgbox "Installing '$1'." 0 0 # whiptail --msgbox "Installing '$1'." 0 0
case ${2} in case ${2} in
Y) Y)
runInChroot "paru -S ${1} > /dev/null 2>&1" if [ ! -z $username ]; then
whiptail --msgbox "Important packages cannot be installed with paru." 0 0
logStep "${3}"
exit 1
fi
runInChroot "sudo -u $username paru -S ${1} > /dev/null 2>&1"
;; ;;
N) N)
pacstrap /mnt --needed ${1} > /dev/null 2>&1 pacstrap /mnt --needed ${1} > /dev/null 2>&1
@ -119,8 +124,8 @@ getThePackages() {
if [ ! -f "packages.csv" ]; then if [ ! -f "packages.csv" ]; then
curl -LO "https://raw.githubusercontent.com/santilococo/CocoASAIS/master/packages.csv" > /dev/null 2>&1 curl -LO "https://raw.githubusercontent.com/santilococo/CocoASAIS/master/packages.csv" > /dev/null 2>&1
fi fi
commOutput=$(command -v paru &> /dev/null) commOutput=$(runInChroot "command -v paru &> /dev/null || echo 1")
if [ $? -eq 1 ] && [ "${2}" = "N" ]; then if [ "$commOutput" = "1" ] && [ "${1}" = "N" ]; then
if [ ! -z $username ]; then if [ ! -z $username ]; then
username=$(whiptail --inputbox "Enter the username of the newly created user." 0 0 3>&1 1>&2 2>&3) username=$(whiptail --inputbox "Enter the username of the newly created user." 0 0 3>&1 1>&2 2>&3)
fi fi