bug fixes
This commit is contained in:
parent
eb10ff069f
commit
2f4adfe2d9
152
startup.sh
152
startup.sh
|
|
@ -8,6 +8,7 @@ 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
|
||||||
if [ ! -f "$CONFIG_FILE" ]; then
|
if [ ! -f "$CONFIG_FILE" ]; then
|
||||||
# create file if not exists
|
# create file if not exists
|
||||||
|
|
@ -27,13 +28,38 @@ set_option() {
|
||||||
|
|
||||||
# Adding global functions and variables to use in this script
|
# Adding global functions and variables to use in this script
|
||||||
|
|
||||||
|
# check for root user
|
||||||
check_root() {
|
check_root() {
|
||||||
if [[ "$(id -u)" != "0" ]]; then
|
if [[ "$(id -u)" != "0" ]]; then
|
||||||
echo -ne "Error: This script has to be run under the 'root' user!"
|
echo -ne "ERROR! This script has to be run under the 'root' user!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# check if distro is arch
|
||||||
|
check_arch() {
|
||||||
|
if [[ ! -e /etc/arch-release ]]; then
|
||||||
|
echo -ne "ERROR! This script has to be run under Arch Linux!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# check for internet connection
|
||||||
|
connection_test() {
|
||||||
|
ping -q -w 1 -c 1 "$(ip r | grep default | awk 'NR==1 {print $3}')" &>/dev/null && return 1 || return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Backround checks
|
||||||
|
background () {
|
||||||
|
if connection_test; then
|
||||||
|
echo -ne "ERROR! There seems to be no internet connection.\n"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
check_root
|
||||||
|
check_arch
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
elements_present() {
|
elements_present() {
|
||||||
# check if an element exists
|
# check if an element exists
|
||||||
for e in "${@:2}"; do [[ "$e" == "$1" ]] && break; done
|
for e in "${@:2}"; do [[ "$e" == "$1" ]] && break; done
|
||||||
|
|
@ -74,21 +100,20 @@ logo () {
|
||||||
# This will be shown on every set as user is progressing
|
# This will be shown on every set as user is progressing
|
||||||
echo -ne "
|
echo -ne "
|
||||||
-------------------------------------------------------------------------
|
-------------------------------------------------------------------------
|
||||||
|
|
||||||
█████╗ ██████╗ ██████╗██╗ ██╗████████╗██╗████████╗██╗ ██╗███████╗
|
█████╗ ██████╗ ██████╗██╗ ██╗████████╗██╗████████╗██╗ ██╗███████╗
|
||||||
██╔══██╗██╔══██╗██╔════╝██║ ██║╚══██╔══╝██║╚══██╔══╝██║ ██║██╔════╝
|
██╔══██╗██╔══██╗██╔════╝██║ ██║╚══██╔══╝██║╚══██╔══╝██║ ██║██╔════╝
|
||||||
███████║██████╔╝██║ ███████║ ██║ ██║ ██║ ██║ ██║███████╗
|
███████║██████╔╝██║ ███████║ ██║ ██║ ██║ ██║ ██║███████╗
|
||||||
██╔══██║██╔══██╗██║ ██╔══██║ ██║ ██║ ██║ ██║ ██║╚════██║
|
██╔══██║██╔══██╗██║ ██╔══██║ ██║ ██║ ██║ ██║ ██║╚════██║
|
||||||
██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ██║ ██║ ╚██████╔╝███████║
|
██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ██║ ██║ ╚██████╔╝███████║
|
||||||
╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝
|
╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝
|
||||||
------------------------------------------------------------------------
|
|
||||||
Please select presetup settings for your system
|
|
||||||
------------------------------------------------------------------------
|
|
||||||
"
|
"
|
||||||
}
|
}
|
||||||
|
|
||||||
setpartionlayout() {
|
setpartionlayout() {
|
||||||
# Set partioning layouts
|
# Set partioning layouts
|
||||||
title "Partioning Layout"
|
title "Setup Partioning Layout"
|
||||||
LAYOUTS=("Default" "LVM" "LVM+LUKS" "Maintain Current")
|
LAYOUTS=("Default" "LVM" "LVM+LUKS" "Maintain Current")
|
||||||
PS3="$PROMPT"
|
PS3="$PROMPT"
|
||||||
select OPT in "${LAYOUTS[@]}"; do
|
select OPT in "${LAYOUTS[@]}"; do
|
||||||
|
|
@ -131,18 +156,19 @@ setpartionlayout() {
|
||||||
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.
|
||||||
title "File System"
|
title "Setup File System"
|
||||||
FILESYS=("btrfs" "ext2" "ext3" "ext4" "f2fs" "jfs" "nilfs2" "ntfs" "reiserfs" "vfat" "xfs")
|
FILESYS=("btrfs" "ext2" "ext3" "ext4" "f2fs" "jfs" "nilfs2" "ntfs" "reiserfs" "vfat" "xfs")
|
||||||
PS3="$PROMPT"
|
PS3="$PROMPT"
|
||||||
select OPT in "${FILESYS[@]}"; do
|
select OPT in "${FILESYS[@]}"; do
|
||||||
if elements_present "$OPT" "${FILESYS[@]}"; then
|
if elements_present "$OPT" "${FILESYS[@]}"; then
|
||||||
if [ "$OPT" == "btrfs" ]; then
|
if [ "$OPT" == "btrfs" ]; then
|
||||||
# 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 subvolumes separated by space\n"
|
||||||
echo -ne "usualy they are @, @home, @root etc. Defaults are @, @home, @var, @tmp, @.snapshots \n"
|
echo -ne "usualy they start with @ for root or @home, @temp etc.\n"
|
||||||
read -r -p "or press enter to use defaults: " -a ARR
|
echo -ne "Defaults are @, @home, @var, @tmp, @.snapshots \n"
|
||||||
if [[ "${ARR[*]}" -eq 0 ]]; then
|
read -r -p "press enter to use default: " -a ARR
|
||||||
set_option "BTRFS_SUBVOLUME" "(@ @home @var @tmp @.snapshots)"
|
if [[ -z "${ARR[*]}" ]]; then
|
||||||
|
set_option "SUBVOLUMES" "(@ @home @var @tmp @.snapshots)"
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
# An array is a list of values.
|
# An array is a list of values.
|
||||||
|
|
@ -152,7 +178,7 @@ filesystem () {
|
||||||
NAMES+=("$i")
|
NAMES+=("$i")
|
||||||
done
|
done
|
||||||
# set to config file
|
# set to config file
|
||||||
set_option "BTRFS_SUBVOLUMES" "(${NAMES[*]})"
|
set_option "SUBVOLUMES" "(${NAMES[*]})"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
@ -167,6 +193,7 @@ filesystem () {
|
||||||
|
|
||||||
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
|
||||||
|
title "Setup Time Zone"
|
||||||
_TIMEZONE="$(curl --fail https://ipapi.co/timezone)"
|
_TIMEZONE="$(curl --fail https://ipapi.co/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'"
|
||||||
|
|
@ -187,7 +214,7 @@ timezone () {
|
||||||
echo -ne "Please select your subzone: \n"
|
echo -ne "Please select your subzone: \n"
|
||||||
select SUBZONE in "${_SUBZONE[@]}"; do
|
select SUBZONE in "${_SUBZONE[@]}"; do
|
||||||
if elements_present "$SUBZONE" "${_SUBZONE[@]}"; then
|
if elements_present "$SUBZONE" "${_SUBZONE[@]}"; then
|
||||||
set_option TIMEZONE "${ZONE}/${SUBZONE}"
|
set_option "TIMEZONE" "${ZONE}/${SUBZONE}"
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
invalid_option
|
invalid_option
|
||||||
|
|
@ -208,11 +235,12 @@ timezone () {
|
||||||
|
|
||||||
keymap () {
|
keymap () {
|
||||||
# These are default key maps as presented in official arch repo archinstall
|
# These are default key maps as presented in official arch repo archinstall
|
||||||
|
title "Setup Keymap"
|
||||||
KEYMAPS=("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")
|
KEYMAPS=("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")
|
||||||
PS3="$PROMPT"
|
PS3="$PROMPT"
|
||||||
select OPT in "${KEYMAPS[@]}"; do
|
select OPT in "${KEYMAPS[@]}"; do
|
||||||
if elements_present "$OPT" "${KEYMAPS[@]}"; then
|
if elements_present "$OPT" "${KEYMAPS[@]}"; then
|
||||||
set_option KEYMAP "$OPT"
|
set_option "KEYMAP" "$OPT"
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
invalid_option
|
invalid_option
|
||||||
|
|
@ -223,6 +251,7 @@ keymap () {
|
||||||
|
|
||||||
drivessd () {
|
drivessd () {
|
||||||
# confirm if ssd is present
|
# confirm if ssd is present
|
||||||
|
title "SSD Drive Confirmation"
|
||||||
read -r -p "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)
|
||||||
|
|
@ -237,16 +266,17 @@ drivessd () {
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
diskselection () {
|
diskSELECTION () {
|
||||||
# selection for disk type
|
# Selection for disk type
|
||||||
# show disks present on system
|
# show disks present on system
|
||||||
|
title "Disk Selection"
|
||||||
DISKLIST="$(lsblk -n --output TYPE,KNAME,SIZE | awk '$1=="disk"{print "/dev/"$2" - "$3}')" # show disks with /dev/ prefix and size
|
DISKLIST="$(lsblk -n --output TYPE,KNAME,SIZE | awk '$1=="disk"{print "/dev/"$2" - "$3}')" # show disks with /dev/ prefix and size
|
||||||
PS3="$PROMPT"
|
PS3="$PROMPT"
|
||||||
select _DISK in "${DISKLIST[@]}"; do
|
select _DISK in "${DISKLIST[@]}"; do
|
||||||
if elements_present "$_DISK" "${DISKLIST[@]}"; then
|
if elements_present "$_DISK" "${DISKLIST[@]}"; then
|
||||||
# remove size from string
|
# remove size from string
|
||||||
DISK=$(echo "$_DISK" | awk '{print $1}')
|
DISK=$(echo "$_DISK" | awk '{print $1}')
|
||||||
set_option DISK "$DISK"
|
set_option "DISK" "$DISK"
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
invalid_option
|
invalid_option
|
||||||
|
|
@ -256,6 +286,7 @@ diskselection () {
|
||||||
}
|
}
|
||||||
|
|
||||||
userinfo () {
|
userinfo () {
|
||||||
|
title "Add Your Information"
|
||||||
read -r -p "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"
|
||||||
|
|
@ -265,11 +296,12 @@ userinfo () {
|
||||||
|
|
||||||
setlocale (){
|
setlocale (){
|
||||||
# set locale
|
# set locale
|
||||||
locale_list=($(grep UTF-8 /etc/locale.gen | sed 's/\..*$//' | sed '/@/d' | awk '{print $1}' | uniq | sed 's/#//g'))
|
title "Setup Locale"
|
||||||
|
LOCALES=($(grep UTF-8 /etc/locale.gen | sed 's/\..*$//' | sed '/@/d' | awk '{print $1}' | uniq | sed 's/#//g'))
|
||||||
PS3="$PROMPT"
|
PS3="$PROMPT"
|
||||||
select LOCALE in "${locale_list[@]}"; do
|
select LOCALE in "${LOCALES[@]}"; do
|
||||||
if elements_present "$LOCALE" "${locale_list[@]}"; then
|
if elements_present "$LOCALE" "${LOCALES[@]}"; then
|
||||||
set_option LOCALE "${LOCALE}.UTF-8 UTF-8"
|
set_option "LOCALE" "${LOCALE}.UTF-8 UTF-8"
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
invalid_option
|
invalid_option
|
||||||
|
|
@ -280,12 +312,11 @@ setlocale (){
|
||||||
|
|
||||||
setdisktop() {
|
setdisktop() {
|
||||||
title "Select either Disktop Environment or Window Manager"
|
title "Select either Disktop Environment or Window Manager"
|
||||||
|
SELECTION=("KDE" "Gnome" "XFCE" "Mate" "LXQT" "Minimal" "Awesome" "OpenBox" "i3" "i3-Gaps")
|
||||||
selections=("KDE" "Gnome" "XFCE" "Mate" "LXQT" "Minimal" "Awesome" "OpenBox" "i3" "i3-Gaps")
|
|
||||||
PS3="$PROMPT"
|
PS3="$PROMPT"
|
||||||
select OPT in "${selections[@]}"; do
|
select OPT in "${SELECTION[@]}"; do
|
||||||
if elements_present "$OPT" "${selections[@]}"; then
|
if elements_present "$OPT" "${SELECTION[@]}"; then
|
||||||
case "$OPT" in
|
case "$REPLY" in
|
||||||
1)
|
1)
|
||||||
# more packages can be added here
|
# more packages can be added here
|
||||||
set_option "DE" "('plasma')"
|
set_option "DE" "('plasma')"
|
||||||
|
|
@ -349,24 +380,55 @@ setdisktop() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Backround checks
|
makechoice () {
|
||||||
|
# make choice for installation
|
||||||
|
title "Make your choice"
|
||||||
|
CHOICE=("Default Install" "Custom Install")
|
||||||
|
PS3="$PROMPT"
|
||||||
|
select OPT in "${CHOICE[@]}"; do
|
||||||
|
if elements_present "$OPT" "${CHOICE[@]}"; then
|
||||||
|
case "$REPLY" in
|
||||||
|
1)
|
||||||
|
logo
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
2)
|
||||||
|
userinfo
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
*) echo "Wrong option. Try again"
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
invalid_option
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
background
|
||||||
|
logo
|
||||||
|
makechoice
|
||||||
|
# setdisktop
|
||||||
|
|
||||||
# check_root
|
# check_root
|
||||||
# Starting functions
|
# Starting functions
|
||||||
clear
|
# clear
|
||||||
logo
|
# logo
|
||||||
userinfo
|
# title "Please select presetup \n\t\t\tsettings for your system"
|
||||||
setpartionlayout
|
# userinfo
|
||||||
filesystem
|
# setpartionlayout
|
||||||
clear
|
# filesystem
|
||||||
logo
|
# clear
|
||||||
diskselection
|
# logo
|
||||||
drivessd
|
# diskselection
|
||||||
clear
|
# drivessd
|
||||||
logo
|
# clear
|
||||||
timezone
|
# logo
|
||||||
clear
|
# timezone
|
||||||
logo
|
# clear
|
||||||
keymap
|
# logo
|
||||||
clear
|
# keymap
|
||||||
logo
|
# clear
|
||||||
setlocale
|
# logo
|
||||||
|
# setlocale
|
||||||
Loading…
Reference in New Issue