updated filesystem logic

This commit is contained in:
mfgbhatti 2022-01-24 20:15:19 +00:00
parent 7325bb1bf2
commit 5c47c47ceb
1 changed files with 36 additions and 21 deletions

View File

@ -55,29 +55,44 @@ echo -ne "
------------------------------------------------------------------------ ------------------------------------------------------------------------
" "
} }
filesystem () { filesystem () {
# This function will handle file systems. At this movement we are handling only # This function will handle file systems. At this movement we are handling only
# btrfs and ext4. Others will be added in future. # btrfs and ext4. Others will be added in future.
echo -ne " title "File System"
Please Select your file system for both boot and root FILESYS=("btrfs" "ext2" "ext3" "ext4" "f2fs" "jfs" "nilfs2" "ntfs" "reiserfs" "vfat" "xfs")
1) btrfs PS3="$PROMPT"
2) ext4 select OPT in "${FILESYS[@]}"; do
3) luks with btrfs if elements_present "$OPT" "${FILESYS[@]}"; then
0) exit if [ "$OPT" == "btrfs" ]; then
" # used -a to get more than one argument
read -r FS echo -ne "Please enter your btrfs subvolume names separated by space\n"
case $FS in echo -ne "usualy they are @, @home, @root etc. Defaults are @, @home, @var, @tmp, @.snapshots \n"
1) set_option FS btrfs;; read -pr "or press enter to use defaults: " -a ARR
2) set_option FS ext4;; if [[ "${ARR[*]}" -eq 0 ]]; then
3) set_option "BTRFS_SUBVOLUME" "(@ @home @var @tmp @.snapshots)"
echo -ne "Please enter your luks password: " break
read -rs luks_password # read password without echo else
set_option luks_password "$luks_password" # An array is a list of values.
set_option FS luks;; NAMES=()
0) exit ;; for i in "${ARR[@]}"; do
*) echo "Wrong option please select again"; filesystem;; # push values to array
esac NAMES+=("$i")
done
# set to config file
set_option "BTRFS_SUBVOLUMES" "(${NAMES[*]})"
break
fi
fi
set_option "FS" "$OPT"
break
else
invalid_option
break
fi
done
} }
timezone () { timezone () {
# Added this from arch wiki https://wiki.archlinux.org/title/System_time # Added this from arch wiki https://wiki.archlinux.org/title/System_time
time_zone="$(curl --fail https://ipapi.co/timezone)" time_zone="$(curl --fail https://ipapi.co/timezone)"