diff --git a/.gitignore b/.gitignore
index a20aba1..5ed5a40 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,6 @@
install.conf
installlog.txt
archnikus.code-workspace
-setup.conf
\ No newline at end of file
+configs/setup.conf
+# keep logs out
+configs/*.log
\ No newline at end of file
diff --git a/README.md b/README.md
index afec16e..68d8735 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@ This README contains the steps I do to install and configure a fully-functional
Download ArchISO from and put on a USB drive with [Etcher](https://www.balena.io/etcher/), [Ventoy](https://www.ventoy.net/en/index.html), or [Rufus](https://rufus.ie/en/)
-If you don't want to build using this script I did create an image @
+If you don't want to build using this script I did create an image @
## Boot Arch ISO
diff --git a/REFERENCE-startup.md b/REFERENCE-startup.md
index 221d4bf..8eb7353 100644
--- a/REFERENCE-startup.md
+++ b/REFERENCE-startup.md
@@ -10,7 +10,6 @@ This script will ask users about their prefrences like disk, file system, timezo
# Functions
* [set_option()](#set_option)
-* [select_option()](#select_option)
* [logo()](#logo)
* [filesystem()](#filesystem)
* [timezone()](#timezone)
@@ -43,15 +42,6 @@ set options in setup.conf
* **$2** (string): Configuration value.
-## select_option()
-
-Renders a text based list of options that can be selected by the
-user using up, down and enter keys and returns the chosen option.
-
- Arguments : list of options, maximum of 256
- "opt1" "opt2" ...
- Return value: selected index (0 for opt1, 1 for opt2 ...)
-
## logo()
Displays ArchTitus logo
diff --git a/pkg-files/awesome.text b/pkg-files/awesome.txt
similarity index 100%
rename from pkg-files/awesome.text
rename to pkg-files/awesome.txt
diff --git a/scripts/startup.sh b/scripts/startup.sh
index 98bba69..edf8e44 100755
--- a/scripts/startup.sh
+++ b/scripts/startup.sh
@@ -22,7 +22,60 @@ set_option() {
fi
echo "${1}=${2}" >>$CONFIG_FILE # add option
}
-# @description Renders a text based list of options that can be selected by the
+
+set_password() {
+ read -rs -p "Please enter password: " PASSWORD1
+ echo -ne "\n"
+ read -rs -p "Please re-enter password: " PASSWORD2
+ echo -ne "\n"
+ if [[ "$PASSWORD1" == "$PASSWORD2" ]]; then
+ set_option "$1" "$PASSWORD1"
+ else
+ echo -ne "ERROR! Passwords do not match. \n"
+ set_password
+ fi
+}
+
+root_check() {
+ if [[ "$(id -u)" != "0" ]]; then
+ echo -ne "ERROR! This script must be run under the 'root' user!\n"
+ exit 0
+ fi
+}
+
+docker_check() {
+ if awk -F/ '$2 == "docker"' /proc/self/cgroup | read -r; then
+ echo -ne "ERROR! Docker container is not supported (at the moment)\n"
+ exit 0
+ elif [[ -f /.dockerenv ]]; then
+ echo -ne "ERROR! Docker container is not supported (at the moment)\n"
+ exit 0
+ fi
+}
+
+arch_check() {
+ if [[ ! -e /etc/arch-release ]]; then
+ echo -ne "ERROR! This script must be run in Arch Linux!\n"
+ exit 0
+ fi
+}
+
+pacman_check() {
+ if [[ -f /var/lib/pacman/db.lck ]]; then
+ echo "ERROR! Pacman is blocked."
+ echo -ne "If not running remove /var/lib/pacman/db.lck.\n"
+ exit 0
+ fi
+}
+
+background_checks() {
+ root_check
+ arch_check
+ pacman_check
+ docker_check
+}
+
+# Renders a text based list of options that can be selected by the
# user using up, down and enter keys and returns the chosen option.
#
# Arguments : list of options, maximum of 256
@@ -161,22 +214,9 @@ case $? in
0) set_option FS btrfs;;
1) set_option FS ext4;;
2)
-while true; do
- echo -ne "Please enter your luks password: \n"
- read -s luks_password # read password without echo
-
- echo -ne "Please repeat your luks password: \n"
- read -s luks_password2 # read password without echo
-
- if [ "$luks_password" = "$luks_password2" ]; then
- set_option LUKS_PASSWORD $luks_password
+ set_password "LUKS_PASSWORD"
set_option FS luks
- break
- else
- echo -e "\nPasswords do not match. Please try again. \n"
- fi
-done
-;;
+ ;;
3) exit ;;
*) echo "Wrong option please select again"; filesystem;;
esac
@@ -264,20 +304,7 @@ drivessd
userinfo () {
read -p "Please enter your username: " username
set_option USERNAME ${username,,} # convert to lower case as in issue #109
-while true; do
- echo -ne "Please enter your password: \n"
- read -s password # read password without echo
-
- echo -ne "Please repeat your password: \n"
- read -s password2 # read password without echo
-
- if [ "$password" = "$password2" ]; then
- set_option PASSWORD $password
- break
- else
- echo -e "\nPasswords do not match. Please try again. \n"
- fi
-done
+set_password "PASSWORD"
read -rep "Please enter your hostname: " nameofmachine
set_option NAME_OF_MACHINE $nameofmachine
}
@@ -296,7 +323,7 @@ aurhelper () {
desktopenv () {
# Let the user choose Desktop Enviroment from predefined list
echo -ne "Please select your desired Desktop Enviroment:\n"
- options=(gnome kde cinnamon xfce mate budgie lxde deepin openbox server)
+ options=( `for f in pkg-files/*.txt; do echo "$f" | sed -r "s/.+\/(.+)\..+/\1/;/pkgs/d"; done` )
select_option $? 4 "${options[@]}"
desktop_env=${options[$?]}
set_option DESKTOP_ENV $desktop_env
@@ -317,6 +344,7 @@ installtype () {
# language (){}
# Starting functions
+background_checks
clear
logo
userinfo