added startup.sh for user preferences and changed other files with variables

This commit is contained in:
farhan 2021-11-12 19:01:24 +00:00
parent 81cf84844b
commit 6350420714
4 changed files with 135 additions and 17 deletions

View File

@ -36,17 +36,17 @@ mkdir /mnt
echo -e "\nInstalling prereqs...\n$HR"
pacman -S --noconfirm gptfdisk btrfs-progs
echo "-------------------------------------------------"
echo "-------select your disk to format----------------"
echo "-------------------------------------------------"
lsblk
echo "Please enter disk to work on: (example /dev/sda)"
read DISK
echo "THIS WILL FORMAT AND DELETE ALL DATA ON THE DISK"
read -p "are you sure you want to continue (Y/N):" formatdisk
case $formatdisk in
# echo "-------------------------------------------------"
# echo "-------select your disk to format----------------"
# echo "-------------------------------------------------"
# lsblk
# echo "Please enter disk to work on: (example /dev/sda)"
# read DISK
# echo "THIS WILL FORMAT AND DELETE ALL DATA ON THE DISK"
# read -p "are you sure you want to continue (Y/N):" formatdisk
# case $formatdisk in
y|Y|yes|Yes|YES)
# y|Y|yes|Yes|YES)
echo "--------------------------------------"
echo -e "\nFormatting disk...\n$HR"
echo "--------------------------------------"
@ -67,16 +67,19 @@ fi
echo -e "\nCreating Filesystems...\n$HR"
if [[ ${DISK} =~ "nvme" ]]; then
mkfs.vfat -F32 -n "EFIBOOT" "${DISK}p2"
mkfs.btrfs -L "ROOT" "${DISK}p3" -f
mount -t btrfs "${DISK}p3" /mnt
mkfs.$FS -L "ROOT" "${DISK}p3" -f
mount -t $FS "${DISK}p3" /mnt
else
mkfs.vfat -F32 -n "EFIBOOT" "${DISK}2"
mkfs.btrfs -L "ROOT" "${DISK}3" -f
mount -t btrfs "${DISK}3" /mnt
mkfs.$FS -L "ROOT" "${DISK}3" -f
mount -t $FS "${DISK}3" /mnt
fi
if [[ $FS =~ btrfs]]; then
ls /mnt | xargs btrfs subvolume delete
btrfs subvolume create /mnt/@
umount /mnt
mount -t btrfs -o subvol=@ -L ROOT /mnt
fi
;;
*)
echo "Rebooting in 3 Seconds ..." && sleep 1
@ -87,7 +90,6 @@ reboot now
esac
# mount target
mount -t btrfs -o subvol=@ -L ROOT /mnt
mkdir /mnt/boot
mkdir /mnt/boot/efi
mount -t vfat -L EFIBOOT /mnt/boot/

View File

@ -34,12 +34,12 @@ echo " Setup Language to US and set locale "
echo "-------------------------------------------------"
sed -i 's/^#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen
locale-gen
timedatectl --no-ask-password set-timezone America/Chicago
timedatectl --no-ask-password set-timezone $timezone
timedatectl --no-ask-password set-ntp 1
localectl --no-ask-password set-locale LANG="en_US.UTF-8" LC_TIME="en_US.UTF-8"
# Set keymaps
localectl --no-ask-password set-keymap us
localectl --no-ask-password set-keymap $keymap
# Add sudo no password rights
sed -i 's/^# %wheel ALL=(ALL) NOPASSWD: ALL/%wheel ALL=(ALL) NOPASSWD: ALL/' /etc/sudoers

View File

@ -4,6 +4,8 @@
export SCRIPTHOME="$(basename -- $PWD)"
echo "Scripts are in dir named $SCRIPTHOME"
bash startup.sh
source setup.conf
bash 0-preinstall.sh
arch-chroot /mnt /root/$SCRIPTHOME/1-setup.sh
source /mnt/root/$SCRIPTHOME/install.conf

114
startup.sh Normal file
View File

@ -0,0 +1,114 @@
#!/usr/bin/env bash
# This script will ask users about their prefrences like disk, file system,
logo () {
# This will be shown on every set as user is progressing
echo -ne "
-------------------------------------------------------------------------
█████╗ ██████╗ ██████╗██╗ ██╗████████╗██╗████████╗██╗ ██╗███████╗
██╔══██╗██╔══██╗██╔════╝██║ ██║╚══██╔══╝██║╚══██╔══╝██║ ██║██╔════╝
███████║██████╔╝██║ ███████║ ██║ ██║ ██║ ██║ ██║███████╗
██╔══██║██╔══██╗██║ ██╔══██║ ██║ ██║ ██║ ██║ ██║╚════██║
██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ██║ ██║ ╚██████╔╝███████║
╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝
------------------------------------------------------------------------
Please select presetup settings for your system
------------------------------------------------------------------------
"
}
filesystem () {
# This function will handle file systems. At this movement we are handling only
# btrfs and ext4. Others will be added in future.
echo -ne "
Please Select your file system for both boot and root
1) btrfs
2) ext4
0) exit
"
read FS
case $FS in
1) echo "FS=btrfs" >> setup.conf;;
2) echo "FS=ext4" >> setup.conf;;
# 3) echo "FS=LUKS" >> setup.conf;;
0) exit ;;
*) echo "Wrong option please select again"; filesystem;;
esac
}
timezone () {
# Added this from arch wiki https://wiki.archlinux.org/title/System_time
time_zone="$(curl --fail https://ipapi.co/timezone)"
echo -ne "System detected your timezone to be '$time_zone'"
echo -ne "Is this correct? yes/no:"
read answer
case $answer in
y|Y|yes|Yes|YES)
echo "timezone=$time_zone" >> setup.conf;;
n|N|no|NO|No)
read -p "Please enter your desired timezone e.g. Europe/London :" new_timezone
echo "timezone=$new_timezone" >> setup.conf;;
*) echo "Wrong option. Try again";timezone;;
esac
}
keymap () {
# These are default key maps as presented in official arch repo archinstall
echo -ne "
Please select key board layout from this list
-by
-ca
-cf
-cz
-de
-dk
-es
-et
-fa
-fi
-fr
-gr
-hu
-il
-it
-lt
-lv
-mk
-nl
-no
-pl
-ro
-ru
-sg
-ua
-uk
-us
"
read -p "Your key boards layout:" keymap
echo "keymap=$keymap" >> setup.conf
}
diskpart (){
lsblk
echo -ne "
------------------------------------------------------------------------
THIS WILL FORMAT AND DELETE ALL DATA ON THE DISK
Please make sure you know what you are doing because
after formating your disk there is no way to get data back
------------------------------------------------------------------------
Please enter disk to work on: (example /dev/sda):
"
read option
echo "DISK=$option" >> setup.conf
}
# More features in future
language (){}
logo
rm -rf setup.conf &>/dev/null
diskpart
clear
logo
filesystem
clear
logo
timezone
clear
logo
keymap