bugs and update

This commit is contained in:
mfgbhatti 2022-01-28 12:06:47 +00:00
parent 62b8798b5a
commit e9004dce48
1 changed files with 65 additions and 37 deletions

View File

@ -9,11 +9,8 @@ SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
# Set up a config file # Set up a config file
CONFIG_FILE=$SCRIPT_DIR/setup.conf CONFIG_FILE=$SCRIPT_DIR/setup.conf
# Check if file exists # Check if file exists and remove it if it does
if [ ! -f "$CONFIG_FILE" ]; then [[ -f "$CONFIG_FILE" ]] && rm -f "$CONFIG_FILE"
# Create file if not exists
touch -f "$CONFIG_FILE"
fi
# Set options in setup.conf # Set options in setup.conf
set_option() { set_option() {
@ -49,6 +46,17 @@ connection_test() {
ping -q -w 1 -c 1 "$(ip r | grep default | awk 'NR==1 {print $3}')" &>/dev/null && return 1 || return 0 ping -q -w 1 -c 1 "$(ip r | grep default | awk 'NR==1 {print $3}')" &>/dev/null && return 1 || return 0
} }
# check coutry for mirrorlist
check_country () {
_ISO=$(curl --fail https://ifconfig.co/country-iso)
set_option "ISO" "$_ISO"
}
# install fonts
install_font () {
pacman -S --noconfirm --needed terminus-font
}
# Check for UEFI # Check for UEFI
efi_check () { efi_check () {
if [[ -d "/sys/firmware/efi/" ]]; then if [[ -d "/sys/firmware/efi/" ]]; then
@ -68,10 +76,12 @@ background () {
if connection_test; then if connection_test; then
echo -ne "ERROR! There seems to be no internet connection.\n" echo -ne "ERROR! There seems to be no internet connection.\n"
exit 1 exit 1
else
check_root
check_arch
fi fi
check_arch
efi_check
check_root
check_country
install_font
} }
# Check if an element exists # Check if an element exists
@ -91,7 +101,7 @@ set_password() {
echo -ne "\n" echo -ne "\n"
read -rs -p "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"
else else
echo -ne "Passwords do not match \n" echo -ne "Passwords do not match \n"
@ -111,21 +121,39 @@ title () {
write_to_config() { write_to_config() {
cat << EOF >> "$CONFIG_FILE" cat << EOF >> "$CONFIG_FILE"
#!/usr/bin/env bash #!/usr/bin/env bash
title () { title () {
echo -ne "\n" echo -ne "\n"
echo -ne "------------------------------------------------------------------------\n" echo -ne "------------------------------------------------------------------------\n"
echo -ne "\t\t\t$1\n" echo -ne "\t\t\t$1\n"
echo -ne "------------------------------------------------------------------------\n" echo -ne "------------------------------------------------------------------------\n"
} }
install_pkg () { install_pkg () {
pacman -S --noconfirm --needed "$@" pacman -S --noconfirm --needed "$@"
} }
refresh_pacman() { refresh_pacman() {
pacman -Syy pacman -Syy
} }
# Setup for logging # Setup for logging
LOG="${SCRIPT_DIR}/main.log" LOG="${SCRIPT_DIR}/main.log"
[[ -f $LOG ]] && rm -f "$LOG" [[ -f $LOG ]] && rm -f "$LOG"
logo () {
echo -ne "
-------------------------------------------------------------------------
█████╗ ██████╗ ██████╗██╗ ██╗████████╗██╗████████╗██╗ ██╗███████╗
██╔══██╗██╔══██╗██╔════╝██║ ██║╚══██╔══╝██║╚══██╔══╝██║ ██║██╔════╝
███████║██████╔╝██║ ███████║ ██║ ██║ ██║ ██║ ██║███████╗
██╔══██║██╔══██╗██║ ██╔══██║ ██║ ██║ ██║ ██║ ██║╚════██║
██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ██║ ██║ ╚██████╔╝███████║
╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝
"
}
EOF EOF
} }
@ -161,16 +189,16 @@ setpartionlayout() {
break break
;; ;;
2) 2)
set_option "LAYOUT" "$OPT" # set_option "LAYOUT" "$OPT"
set_option "LVM" 1 set_option "LVM" 1
set_option "LUKS" 0 set_option "LUKS" 0
break break
;; ;;
3) 3)
set_option "LAYOUT" "$OPT" # set_option "LAYOUT" "$OPT"
set_password "LUKS_PASSWORD"
set_option "LUKS" 1 set_option "LUKS" 1
set_option "LVM" 1 set_option "LVM" 1
set_password "LUKS_PASSWORD"
break break
;; ;;
4) 4)
@ -346,9 +374,9 @@ setlocale (){
done done
} }
# Disktop selection # Desktop selection
setdisktop() { setdesktop() {
title "Select either Disktop Environment or Window Manager" title "Select either desktop Environment or Window Manager"
SELECTION=("KDE" "Gnome" "XFCE" "Mate" "LXQT" "Minimal" "Awesome" "OpenBox" "i3" "i3-Gaps") SELECTION=("KDE" "Gnome" "XFCE" "Mate" "LXQT" "Minimal" "Awesome" "OpenBox" "i3" "i3-Gaps")
PS3="$PROMPT" PS3="$PROMPT"
select OPT in "${SELECTION[@]}"; do select OPT in "${SELECTION[@]}"; do
@ -446,26 +474,26 @@ makechoice () {
background background
logo logo
makechoice makechoice
# Setdisktop # setdesktop
# Check_root # check_root
# Starting functions # starting functions
# Clear # clear
# Logo # logo
# Title "Please select presetup \n\t\t\tsettings for your system" # title "Please select presetup \n\t\t\tsettings for your system"
# Userinfo # userinfo
# Setpartionlayout # setpartionlayout
# Filesystem # filesystem
# Clear # clear
# Logo # logo
# Diskselection # diskselection
# Drivessd # drivessd
# Clear # clear
# Logo # logo
# Timezone # timezone
# Clear # clear
# Logo # logo
# Keymap # keymap
# Clear # clear
# Logo # logo
# Setlocale # setlocale