Merge branch 'ChrisTitusTech:main' into main_sh

This commit is contained in:
Farhan Ghani 2022-08-19 12:03:38 +01:00 committed by GitHub
commit 08ba58d4bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 63 additions and 43 deletions

4
.gitignore vendored
View File

@ -1,4 +1,6 @@
install.conf install.conf
installlog.txt installlog.txt
archnikus.code-workspace archnikus.code-workspace
setup.conf configs/setup.conf
# keep logs out
configs/*.log

View File

@ -10,7 +10,7 @@ This README contains the steps I do to install and configure a fully-functional
Download ArchISO from <https://archlinux.org/download/> 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/) Download ArchISO from <https://archlinux.org/download/> 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 @ <https://www.christitus.com/arch-titus> If you don't want to build using this script I did create an image @ <https://cttstore.com/arch-titus>
## Boot Arch ISO ## Boot Arch ISO

View File

@ -10,7 +10,6 @@ This script will ask users about their prefrences like disk, file system, timezo
# Functions # Functions
* [set_option()](#set_option) * [set_option()](#set_option)
* [select_option()](#select_option)
* [logo()](#logo) * [logo()](#logo)
* [filesystem()](#filesystem) * [filesystem()](#filesystem)
* [timezone()](#timezone) * [timezone()](#timezone)
@ -43,15 +42,6 @@ set options in setup.conf
* **$2** (string): Configuration value. * **$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() ## logo()
Displays ArchTitus logo Displays ArchTitus logo

View File

@ -22,7 +22,60 @@ set_option() {
fi fi
echo "${1}=${2}" >>$CONFIG_FILE # add option 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. # user using up, down and enter keys and returns the chosen option.
# #
# Arguments : list of options, maximum of 256 # Arguments : list of options, maximum of 256
@ -161,22 +214,9 @@ case $? in
0) set_option FS btrfs;; 0) set_option FS btrfs;;
1) set_option FS ext4;; 1) set_option FS ext4;;
2) 2)
while true; do set_password "LUKS_PASSWORD"
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_option FS luks set_option FS luks
break ;;
else
echo -e "\nPasswords do not match. Please try again. \n"
fi
done
;;
3) exit ;; 3) exit ;;
*) echo "Wrong option please select again"; filesystem;; *) echo "Wrong option please select again"; filesystem;;
esac esac
@ -264,20 +304,7 @@ drivessd
userinfo () { userinfo () {
read -p "Please enter your username: " username read -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
while true; do set_password "PASSWORD"
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
read -rep "Please enter your hostname: " nameofmachine read -rep "Please enter your hostname: " nameofmachine
set_option NAME_OF_MACHINE $nameofmachine set_option NAME_OF_MACHINE $nameofmachine
} }
@ -296,7 +323,7 @@ aurhelper () {
desktopenv () { desktopenv () {
# Let the user choose Desktop Enviroment from predefined list # Let the user choose Desktop Enviroment from predefined list
echo -ne "Please select your desired Desktop Enviroment:\n" 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[@]}" select_option $? 4 "${options[@]}"
desktop_env=${options[$?]} desktop_env=${options[$?]}
set_option DESKTOP_ENV $desktop_env set_option DESKTOP_ENV $desktop_env
@ -317,6 +344,7 @@ installtype () {
# language (){} # language (){}
# Starting functions # Starting functions
background_checks
clear clear
logo logo
userinfo userinfo