Update install.sh

This commit is contained in:
Santiago Lo Coco 2021-12-25 12:28:31 -03:00
parent 4e1ba4f8ae
commit fdd39fe6ef
1 changed files with 25 additions and 11 deletions

View File

@ -1,5 +1,12 @@
#!/bin/sh #!/bin/sh
formatOptions() {
options=()
for item in $@; do
options+=("${item}" "")
done
}
checkUefi() { checkUefi() {
ls /sys/firmware/efi/efivars > /dev/null 2>&1 ls /sys/firmware/efi/efivars > /dev/null 2>&1
if [ $? -ge 1 ]; then if [ $? -ge 1 ]; then
@ -13,14 +20,9 @@ updateSystemClock() {
} }
showDisks() { showDisks() {
items=$(lsblk -d -p -n -l -o NAME,SIZE -e 7,11)
options=()
IFS_ORIG=$IFS IFS_ORIG=$IFS
IFS=$'\n' IFS=$'\n'
for item in ${items}; do formatOptions $(lsblk -d -p -n -l -o NAME,SIZE -e 7,11)
options+=("${item}" "")
done
IFS=$IFS_ORIG IFS=$IFS_ORIG
result=$(whiptail --title "Select a disk" --menu "" 0 0 0 "${options[@]}" 3>&1 1>&2 2>&3) result=$(whiptail --title "Select a disk" --menu "" 0 0 0 "${options[@]}" 3>&1 1>&2 2>&3)
@ -30,7 +32,7 @@ showDisks() {
partDisks() { partDisks() {
showDisks showDisks
result=$(whiptail --yesno "Do you want me to automatically partition and format the disk for you?" 0 0 3>&1 1>&2 2>&3) whiptail --yesno "Do you want me to automatically partition and format the disk for you?" 0 0
if [ $? -eq 1 ]; then if [ $? -eq 1 ]; then
gdisk $disk gdisk $disk
# TODO: ask user for the partitions and do formatPart and mountPart. # TODO: ask user for the partitions and do formatPart and mountPart.
@ -76,7 +78,12 @@ generateFstab() {
} }
setTimeZone() { setTimeZone() {
ln -sf /usr/share/zoneinfo/America/Buenos_Aires /etc/localtime formatOptions $(ls -l /usr/share/zoneinfo/ | grep '^d' | awk '{printf $9" \n"}' | awk '!/posix/ && !/right/')
timezoneGeneral=$(whiptail --title "Timezone" --menu "" 0 0 0 "${options[@]}" 3>&1 1>&2 2>&3)
formatOptions $(ls -l /usr/share/zoneinfo/${timezoneGeneral} | grep -v '^d' | awk '{printf $9" \n"}')
timezoneSpecific=$(whiptail --title "Timezone" --menu "" 0 0 0 "${options[@]}" 3>&1 1>&2 2>&3)
ln -sf /usr/share/zoneinfo/${timezoneGeneral}/${timezoneSpecific} /etc/localtime
runInChrootWithInput "hwclock --systohc" runInChrootWithInput "hwclock --systohc"
} }
@ -93,6 +100,7 @@ networkConf() {
127.0.0.1 localhost 127.0.0.1 localhost
::1 localhost ::1 localhost
127.0.1.1 ${hostname}.localdomain ${hostname}" >> /etc/hosts 127.0.1.1 ${hostname}.localdomain ${hostname}" >> /etc/hosts
unset hostname
} }
setPassword() { setPassword() {
@ -132,15 +140,20 @@ EOF
finishInstallation() { finishInstallation() {
umount -R /mnt umount -R /mnt
reboot whiptail --yesno "Finally, the PC needs to restart, would you like to do it?" 0 0
if [ $? -eq 0 ]; then
reboot
fi
} }
installLastPrograms() { installLastPrograms() {
sudo pacman -S xorg xorg-xinit sudo pacman -S --noconfirm xorg-xinit
# TODO: Use csv to install all the programs # TODO: Use csv to install all the programs
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
git clone https://aur.archlinux.org/paru.git
cd paru; makepkg -si --noconfirm; cd ..
} }
getDotfiles() { getDotfiles() {
@ -176,4 +189,5 @@ runScript() {
finishInstallation finishInstallation
} }
runScript # runScript
setTimeZone