Add paru in getThePackages() and add validation/redirection

This commit is contained in:
Santiago Lo Coco 2021-12-27 00:57:59 -03:00
parent eaadf43327
commit 491569c988
1 changed files with 26 additions and 12 deletions

View File

@ -97,15 +97,36 @@ mountPart() {
swapon "$swapPart" > /dev/null swapon "$swapPart" > /dev/null
} }
installPackage() {
# whiptail --msgbox "Installing '$1'." 0 0
case ${2} in
Y)
runInChroot "paru -S ${1} > /dev/null 2>&1"
;;
N)
pacstrap /mnt --needed ${1} > /dev/null 2>&1
;;
?)
whiptail --msgbox "TAG must be Y or N in packages.csv file." 0 0
logStep "${2}"
exit 1
;;
esac
exitIfCancel "You must have an active internet connection" "${2}"
}
getThePackages() { 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)
if [ $? -eq 1 ]; then
runInChroot "cd /tmp; git clone https://aur.archlinux.org/paru.git; cd paru; makepkg -si --noconfirm; cd ..; rm -rf paru"
fi
local IFS=, local IFS=,
while read -r NAME IMPORTANT; do while read -r NAME IMPORTANT AUR; do
if [ "$IMPORTANT" = "${1}" ]; then if [ "$IMPORTANT" = "${1}" ]; then
installPackage "$NAME" installPackage "$NAME" "$AUR" "${2}"
exitIfCancel "You must have an active internet connection" "${2}"
fi fi
done < packages.csv done < packages.csv
} }
@ -173,6 +194,7 @@ setRootPassword() {
} }
updateMirrors() { updateMirrors() {
whiptail --yesno "Would you like to update your mirrors by choosing your closest countries?" 0 0 || return
runInChroot "cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup" runInChroot "cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup"
local IFS=$'\n' local IFS=$'\n'
setDelimiters "" "OFF" setDelimiters "" "OFF"
@ -183,15 +205,9 @@ updateMirrors() {
runInChroot "sudo reflector --country "${countriesFmt//\"/}" --protocol https --sort rate --save /etc/pacman.d/mirrorlist" runInChroot "sudo reflector --country "${countriesFmt//\"/}" --protocol https --sort rate --save /etc/pacman.d/mirrorlist"
} }
installPackage() {
# whiptail --msgbox "Installing '$1'." 0 0
pacstrap /mnt --needed ${1} > /dev/null 2>&1
return $?
}
grubSetUp() { grubSetUp() {
# TODO: Prompt user for efi-directory # TODO: Prompt user for efi-directory
runInChroot "grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB; grub-mkconfig -o /boot/grub/grub.cfg" runInChroot "grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB; grub-mkconfig -o /boot/grub/grub.cfg" > /dev/null 2>&1
} }
userSetUp() { userSetUp() {
@ -229,10 +245,8 @@ finishInstallation() {
installLastPrograms() { installLastPrograms() {
sudo pacman -Sy sudo pacman -Sy
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
git clone https://aur.archlinux.org/paru.git; cd paru; makepkg -si --noconfirm; cd ..; rm -rf paru
} }
getDotfiles() { getDotfiles() {