Add printWaitBox()

This commit is contained in:
Santiago Lo Coco 2022-01-05 15:10:10 -03:00
parent 57b71c83c6
commit d2d9247d65
1 changed files with 14 additions and 0 deletions

View File

@ -42,6 +42,10 @@ exitIfCancel() {
fi fi
} }
printWaitBox() {
whiptail --infobox "Please wait..." 7 19
}
partDisks() { partDisks() {
whiptail --yesno "Do you want me to automatically partition and format a disk for you?" 0 0 whiptail --yesno "Do you want me to automatically partition and format a disk for you?" 0 0
whipStatus=$? whipStatus=$?
@ -111,9 +115,11 @@ partDisks() {
fi fi
fi fi
printWaitBox
autoPart autoPart
fi fi
printWaitBox
formatPart formatPart
mountPart mountPart
} }
@ -182,6 +188,7 @@ mountPart() {
mkdir -p /mnt/boot/efi mkdir -p /mnt/boot/efi
mount "$bootPart" /mnt/boot/efi 2>&1 | debug mount "$bootPart" /mnt/boot/efi 2>&1 | debug
fi fi
printWaitBox
[ -n "$swapPart" ] && swapon "$swapPart" 2>&1 | debug [ -n "$swapPart" ] && swapon "$swapPart" 2>&1 | debug
[ -n "$swapfile" ] && createSwapfile [ -n "$swapfile" ] && createSwapfile
} }
@ -251,6 +258,7 @@ checkForParu() {
commOutput=$(runInChroot "command -v paru > /dev/null 2>&1 || echo 1") commOutput=$(runInChroot "command -v paru > /dev/null 2>&1 || echo 1")
if [ "$commOutput" = "1" ]; then if [ "$commOutput" = "1" ]; then
runInChroot "sed -i 's/# %wheel ALL=(ALL) NOPASSWD: ALL/%wheel ALL=(ALL) NOPASSWD: ALL/' /etc/sudoers" runInChroot "sed -i 's/# %wheel ALL=(ALL) NOPASSWD: ALL/%wheel ALL=(ALL) NOPASSWD: ALL/' /etc/sudoers"
printWaitBox
runInChroot "cd /tmp; sudo -u $username git clone https://aur.archlinux.org/paru-bin.git; cd paru-bin; sudo -u $username makepkg -si --noconfirm; cd ..; rm -rf paru-bin" 2>&1 | debug runInChroot "cd /tmp; sudo -u $username git clone https://aur.archlinux.org/paru-bin.git; cd paru-bin; sudo -u $username makepkg -si --noconfirm; cd ..; rm -rf paru-bin" 2>&1 | debug
fi fi
} }
@ -258,6 +266,7 @@ checkForParu() {
getThePackages() { getThePackages() {
set -o pipefail set -o pipefail
if [ ! -f "packages.csv" ]; then if [ ! -f "packages.csv" ]; then
printWaitBox
curl -LO "https://raw.githubusercontent.com/santilococo/CocoASAIS/master/packages.csv" 2>&1 | debug curl -LO "https://raw.githubusercontent.com/santilococo/CocoASAIS/master/packages.csv" 2>&1 | debug
fi fi
local IFS=, local IFS=,
@ -276,6 +285,7 @@ installImportantPackages() {
} }
generateFstab() { generateFstab() {
printWaitBox
genfstab -U /mnt >> /mnt/etc/fstab genfstab -U /mnt >> /mnt/etc/fstab
} }
@ -290,12 +300,14 @@ setTimeZone() {
exitIfCancel "You must select a city." "setTimeZone" exitIfCancel "You must select a city." "setTimeZone"
ln -sf /mnt/usr/share/zoneinfo/${region}/${city} /mnt/etc/localtime ln -sf /mnt/usr/share/zoneinfo/${region}/${city} /mnt/etc/localtime
printWaitBox
runInChroot "hwclock --systohc" runInChroot "hwclock --systohc"
} }
setLocale() { setLocale() {
# TODO: Let the user choose a locale # TODO: Let the user choose a locale
sed 's/#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' -i /mnt/etc/locale.gen sed 's/#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' -i /mnt/etc/locale.gen
printWaitBox
runInChroot "locale-gen" 2>&1 | debug runInChroot "locale-gen" 2>&1 | debug
echo "LANG=en_US.UTF-8" > /mnt/etc/locale.conf echo "LANG=en_US.UTF-8" > /mnt/etc/locale.conf
} }
@ -374,6 +386,7 @@ updateMirrors() {
countries=$(whiptail --title "Countries" --checklist "" 0 0 0 "${options[@]}" 3>&1 1>&2 2>&3) countries=$(whiptail --title "Countries" --checklist "" 0 0 0 "${options[@]}" 3>&1 1>&2 2>&3)
[ -z "$countries" ] && logAndExit "You must select at least one country." "updateMirrors" [ -z "$countries" ] && logAndExit "You must select at least one country." "updateMirrors"
countriesFmt=$(echo "$countries" | sed -r 's/" "/,/g') countriesFmt=$(echo "$countries" | sed -r 's/" "/,/g')
printWaitBox
reflector --country \"${countriesFmt//\"/}\" --protocol https --sort rate --save /etc/pacman.d/mirrorlist 2>&1 | debug reflector --country \"${countriesFmt//\"/}\" --protocol https --sort rate --save /etc/pacman.d/mirrorlist 2>&1 | debug
else else
checkForSystemdUnit "mirrors update" "reflector.service" "oneshot" checkForSystemdUnit "mirrors update" "reflector.service" "oneshot"
@ -382,6 +395,7 @@ updateMirrors() {
grubSetUp() { grubSetUp() {
# TODO: Prompt user for efi-directory # TODO: Prompt user for efi-directory
printWaitBox
runInChroot "grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB; grub-mkconfig -o /boot/grub/grub.cfg" 2>&1 | debug runInChroot "grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB; grub-mkconfig -o /boot/grub/grub.cfg" 2>&1 | debug
} }