Use runInChrootWithInput and only run getDotfiles if Document folder exists

This commit is contained in:
Santiago Lo Coco 2021-12-22 22:15:12 -03:00
parent 0449fe7c8d
commit 8da0b3ac6a
1 changed files with 37 additions and 25 deletions

View File

@ -47,7 +47,6 @@ partDisks() {
} }
autoPart() { autoPart() {
# Create new GPT disklabel
yes | parted $disk mklabel gpt 2> /dev/null yes | parted $disk mklabel gpt 2> /dev/null
sgdisk $disk -n=1:0:+300M -t=1:ef00 > /dev/null sgdisk $disk -n=1:0:+300M -t=1:ef00 > /dev/null
@ -78,12 +77,12 @@ generateFstab() {
setTimeZone() { setTimeZone() {
ln -sf /usr/share/zoneinfo/America/Buenos_Aires /etc/localtime ln -sf /usr/share/zoneinfo/America/Buenos_Aires /etc/localtime
runInChroot "hwclock --systohc" runInChrootWithInput "hwclock --systohc"
} }
setLocale() { setLocale() {
sed 's/#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' -i /etc/locale.gen sed 's/#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' -i /etc/locale.gen
runInChroot "locale-gen" runInChrootWithInput "locale-gen"
echo "LANG=en_US.UTF-8" > /etc/locale.conf echo "LANG=en_US.UTF-8" > /etc/locale.conf
} }
@ -100,16 +99,12 @@ setPassword() {
} }
installMorePackages() { installMorePackages() {
runInChrootWithInput "pacman -Sy --noconfirm grub efibootmgr networkmanager network-manager-applet dialog reflector base-devel linux-headers xdg-user-dirs xdg-utils alsa-utils pipewire pipewire-alsa pipewire-pulse openssh reflector qemu qemu-arch-extra ttf-fira-code sudo nvidia-utils nvidia-settings" runInChrootWithInput "pacman -Sy --noconfirm grub efibootmgr networkmanager network-manager-applet dialog reflector base-devel linux-headers xdg-user-dirs xdg-utils alsa-utils pipewire pipewire-alsa pipewire-pulse openssh reflector qemu qemu-arch-extra ttf-fira-code sudo nvidia-utils nvidia-settings xorg"
runInChrootWithInput "systemctl enable NetworkManager; systemctl enable fstrim.timer"
runInChroot "systemctl enable NetworkManager"
runInChroot "systemctl enable fstrim.timer"
} }
grubSetUp() { grubSetUp() {
# TODO: ver si se corre esto.... runInChrootWithInput "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"
runInChroot "grub-mkconfig -o /boot/grub/grub.cfg"
} }
userSetUp() { userSetUp() {
@ -129,23 +124,40 @@ EOF
rm /mnt/runme rm /mnt/runme
} }
finishInstallation() {
umount -R /mnt
reboot
}
getDotfiles() {
local lastFolder=$(pwd -P)
cd $HOME/Documents
git clone https://github.com/santilococo/CocoRice.git
cd CocoRice
sh scripts/bootstrap.sh
cd lastFolder
}
runScript() { runScript() {
if [ -d "$HOME/Documents"]; then
getDotfiles
exit 1
fi
whiptail --title "CocoASAIS" --msgbox "Welcome to CocoASAIS!" 0 0 whiptail --title "CocoASAIS" --msgbox "Welcome to CocoASAIS!" 0 0
# checkUefi checkUefi
# updateSystemClock updateSystemClock
# partDisks partDisks
# installPackages installPackages
# generateFstab generateFstab
# setTimeZone setTimeZone
# setLocale setLocale
# networkConf networkConf
# setPassword setPassword
# installMorePackages installMorePackages
# grubSetUp grubSetUp
# userSetUp userSetUp
runInChrootWithInput "mkdir -p $HOME/Documents; cd $HOME/Documents/ git clone https://github.com/santilococo/CocoRice.git; cd CocoRice; sh scripts/bootstrap.sh" finishInstallation
# umount -R /mnt
# reboot
} }
runScript runScript