Add validations

This commit is contained in:
Santiago Lo Coco 2021-12-26 22:49:44 -03:00
parent 36176df6db
commit b634680eaa
1 changed files with 12 additions and 5 deletions

View File

@ -99,18 +99,20 @@ mountPart() {
getThePackages() { getThePackages() {
if [ ! -f "packages.csv" ]; then if [ ! -f "packages.csv" ]; then
curl -LO "https://raw.githubusercontent.com/santilococo/CocoASAIS/master/packages.csv" curl -LO "https://raw.githubusercontent.com/santilococo/CocoASAIS/master/packages.csv" > /dev/null 2>&1
fi fi
local IFS=, local IFS=,
while read -r NAME IMPORTANT; do while read -r NAME IMPORTANT; do
if [ "$IMPORTANT" = "${1}" ]; then if [ "$IMPORTANT" = "${1}" ]; then
installPackage "$NAME" installPackage "$NAME"
exitIfCancel "You must have an active internet connection" "${2}"
fi fi
done < packages.csv done < packages.csv
} }
installImportantPackages() { installImportantPackages() {
getThePackages "Y" whiptail --msgbox "We will start by installing some important packages." 0 0
getThePackages "Y" "installImportantPackages"
runInChroot "systemctl enable NetworkManager; systemctl enable fstrim.timer" runInChroot "systemctl enable NetworkManager; systemctl enable fstrim.timer"
} }
@ -182,8 +184,9 @@ updateMirrors() {
} }
installPackage() { installPackage() {
whiptail --infobox "Installing '$1'." 0 0 whiptail --msgbox "Installing '$1'." 0 0
pacstrap /mnt ${1} pacstrap /mnt --needed ${1} > /dev/null 2>&1
return $?
} }
grubSetUp() { grubSetUp() {
@ -209,6 +212,10 @@ EOF
rm /mnt/cocoScript rm /mnt/cocoScript
} }
installNotImportantPackages() {
getThePackages "N" "installNotImportantPackages"
}
finishInstallation() { finishInstallation() {
umount -R /mnt umount -R /mnt
whiptail --yesno "Finally, the PC needs to restart, would you like to do it?" 0 0 whiptail --yesno "Finally, the PC needs to restart, would you like to do it?" 0 0
@ -221,7 +228,6 @@ finishInstallation() {
installLastPrograms() { installLastPrograms() {
sudo pacman -Sy sudo pacman -Sy
getThePackages "N"
sudo pacman -S zsh sudo pacman -S zsh
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
git clone https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k git clone https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k
@ -251,6 +257,7 @@ steps=(
updateMirrors updateMirrors
grubSetUp grubSetUp
userSetUp userSetUp
installNotImportantPackages
finishInstallation finishInstallation
) )