This commit is contained in:
mfgbhatti 2022-01-25 19:07:36 +00:00
parent 0a3faf4f23
commit eb10ff069f
1 changed files with 11 additions and 10 deletions

View File

@ -24,6 +24,7 @@ set_option() {
# else add option # else add option
echo "${1}=${2}" >> "$CONFIG_FILE" echo "${1}=${2}" >> "$CONFIG_FILE"
} }
# Adding global functions and variables to use in this script # Adding global functions and variables to use in this script
check_root() { check_root() {
@ -46,9 +47,9 @@ invalid_option() {
set_password() { set_password() {
# password helper function # password helper function
# read password without echoing (-s) # read password without echoing (-s)
read -prs "Please enter password: " PASSWORD1 read -rs -p "Please enter password: " PASSWORD1
echo -ne "\n" echo -ne "\n"
read -prs "Please re-enter password: " PASSWORD2 read -rs -p "Please re-enter password: " PASSWORD2
echo -ne "\n" echo -ne "\n"
if [ "$PASSWORD1" == "$PASSWORD2" ]; then if [ "$PASSWORD1" == "$PASSWORD2" ]; then
set_option "$1" "$PASSWORD1" set_option "$1" "$PASSWORD1"
@ -139,7 +140,7 @@ filesystem () {
# used -a to get more than one argument # used -a to get more than one argument
echo -ne "Please enter your btrfs subvolume names separated by space\n" echo -ne "Please enter your btrfs subvolume names separated by space\n"
echo -ne "usualy they are @, @home, @root etc. Defaults are @, @home, @var, @tmp, @.snapshots \n" echo -ne "usualy they are @, @home, @root etc. Defaults are @, @home, @var, @tmp, @.snapshots \n"
read -pr "or press enter to use defaults: " -a ARR read -r -p "or press enter to use defaults: " -a ARR
if [[ "${ARR[*]}" -eq 0 ]]; then if [[ "${ARR[*]}" -eq 0 ]]; then
set_option "BTRFS_SUBVOLUME" "(@ @home @var @tmp @.snapshots)" set_option "BTRFS_SUBVOLUME" "(@ @home @var @tmp @.snapshots)"
break break
@ -170,7 +171,7 @@ timezone () {
_ZONE=($(timedatectl list-timezones | sed 's/\/.*$//' | uniq)) _ZONE=($(timedatectl list-timezones | sed 's/\/.*$//' | uniq))
echo -ne "System detected your timezone to be '$_TIMEZONE'" echo -ne "System detected your timezone to be '$_TIMEZONE'"
echo -ne "\n" echo -ne "\n"
read -pr "Is this correct? yes/no: " ANSWER read -r -p "Is this correct? yes/no: " ANSWER
case "$ANSWER" in case "$ANSWER" in
y|Y|yes|Yes|YES) y|Y|yes|Yes|YES)
set_option TIMEZONE "$_TIMEZONE" set_option TIMEZONE "$_TIMEZONE"
@ -222,7 +223,7 @@ keymap () {
drivessd () { drivessd () {
# confirm if ssd is present # confirm if ssd is present
read -pr "Is this system using an SSD? yes/no: " _SSD read -r -p "Is this system using an SSD? yes/no: " _SSD
case "$_SSD" in case "$_SSD" in
y|Y|yes|Yes|YES) y|Y|yes|Yes|YES)
set_option "SSD" 1 set_option "SSD" 1
@ -255,11 +256,11 @@ diskselection () {
} }
userinfo () { userinfo () {
read -pr "Please enter your username: " USERNAME read -r -p "Please enter your username: " USERNAME
set_option USERNAME "${USERNAME,,}" # convert to lower case as in issue #109 set_option "USERNAME" "${USERNAME,,}" # convert to lower case as in issue #109
set_password "PASSWORD" set_password "PASSWORD"
read -pr "Please enter your hostname: " HOSTNAME read -r -p "Please enter your hostname: " HOSTNAME
set_option HOSTNAME "$HOSTNAME" set_option "HOSTNAME" "$HOSTNAME"
} }
setlocale (){ setlocale (){
@ -349,7 +350,7 @@ setdisktop() {
} }
# Backround checks # Backround checks
check_root # check_root
# Starting functions # Starting functions
clear clear
logo logo