remove trailing space & move "then" and "do"...
parts of if/while/loop statements to be separated from the condition by a colon instead of newline to reduce vertical space
This commit is contained in:
parent
62e5ba90b1
commit
742a2dc236
|
|
@ -104,8 +104,7 @@ bash_prompt_command() {
|
|||
local pwdoffset=$(( ${#NEW_PWD} - pwdmaxlen ))
|
||||
|
||||
# Generate name
|
||||
if [ ${pwdoffset} -gt "0" ]
|
||||
then
|
||||
if [ ${pwdoffset} -gt "0" ]; then
|
||||
NEW_PWD=${NEW_PWD:$pwdoffset:$pwdmaxlen}
|
||||
NEW_PWD=${trunc_symbol}/${NEW_PWD#*/}
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
#github-action genshdoc
|
||||
#
|
||||
# @file Preinstall
|
||||
# @brief Contains the steps necessary to configure and pacstrap the install to selected drive.
|
||||
# @brief Contains the steps necessary to configure and pacstrap the install to selected drive.
|
||||
echo "
|
||||
-------------------------------------------------------------------------
|
||||
█████╗ ██████╗ ██████╗██╗ ██╗████████╗██╗████████╗██╗ ██╗███████╗
|
||||
|
|
@ -69,7 +69,7 @@ echo "
|
|||
-------------------------------------------------------------------------"
|
||||
subvols=(home var tmp .snapshots)
|
||||
|
||||
# @description Creates the btrfs subvolumes.
|
||||
# @description Creates the btrfs subvolumes.
|
||||
createsubvolumes () {
|
||||
for subvol in '' ${subvols[@]}; do # the '' adds the root subvolume to the loop
|
||||
btrfs subvolume create /mnt/@$subvol
|
||||
|
|
@ -83,11 +83,11 @@ mountallsubvol () {
|
|||
done
|
||||
}
|
||||
|
||||
# @description BTRFS subvolulme creation and mounting.
|
||||
# @description BTRFS subvolulme creation and mounting.
|
||||
subvolumesetup () {
|
||||
# create nonroot subvolumes
|
||||
createsubvolumes
|
||||
# unmount root to remount with subvolume
|
||||
createsubvolumes
|
||||
# unmount root to remount with subvolume
|
||||
umount /mnt
|
||||
# mount @ subvolume
|
||||
mount -o ${MOUNT_OPTIONS},subvol=@ ${partition3} /mnt
|
||||
|
|
@ -120,7 +120,7 @@ elif [[ "${FS}" == "luks" ]]; then
|
|||
mkfs.vfat -F32 -n "EFIBOOT" ${partition2}
|
||||
# enter luks password to cryptsetup and format root partition
|
||||
echo -n "${LUKS_PASSWORD}" | cryptsetup -y -v luksFormat ${partition3} -
|
||||
# open luks container and ROOT will be place holder
|
||||
# open luks container and ROOT will be place holder
|
||||
echo -n "${LUKS_PASSWORD}" | cryptsetup open ${partition3} ROOT -
|
||||
# now format that container
|
||||
mkfs.btrfs -L ROOT ${partition3}
|
||||
|
|
@ -152,7 +152,7 @@ cp -R ${SCRIPT_DIR} /mnt/root/ArchTitus
|
|||
cp /etc/pacman.d/mirrorlist /mnt/etc/pacman.d/mirrorlist
|
||||
|
||||
genfstab -L /mnt >> /mnt/etc/fstab
|
||||
echo "
|
||||
echo "
|
||||
Generated /etc/fstab:
|
||||
"
|
||||
cat /mnt/etc/fstab
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#github-action genshdoc
|
||||
#
|
||||
# @file Setup
|
||||
# @brief Configures installed system, installs base packages, and creates user.
|
||||
# @brief Configures installed system, installs base packages, and creates user.
|
||||
echo "
|
||||
-------------------------------------------------------------------------
|
||||
█████╗ ██████╗ ██████╗██╗ ██╗████████╗██╗████████╗██╗ ██╗███████╗
|
||||
|
|
@ -18,13 +18,13 @@ echo "
|
|||
source $HOME/ArchTitus/configs/setup.conf
|
||||
echo "
|
||||
-------------------------------------------------------------------------
|
||||
Network Setup
|
||||
Network Setup
|
||||
-------------------------------------------------------------------------"
|
||||
pacman -S --noconfirm --needed networkmanager dhclient
|
||||
systemctl enable --now NetworkManager
|
||||
echo "
|
||||
-------------------------------------------------------------------------
|
||||
Setting up mirrors for optimal download
|
||||
Setting up mirrors for optimal download
|
||||
-------------------------------------------------------------------------"
|
||||
pacman -S --noconfirm --needed pacman-contrib curl
|
||||
pacman -S --noconfirm --needed reflector rsync grub arch-install-scripts git
|
||||
|
|
@ -44,7 +44,7 @@ sed -i "s/COMPRESSXZ=(xz -c -z -)/COMPRESSXZ=(xz -c -T $nc -z -)/g" /etc/makepkg
|
|||
fi
|
||||
echo "
|
||||
-------------------------------------------------------------------------
|
||||
Setup Language to US and set locale
|
||||
Setup Language to US and set locale
|
||||
-------------------------------------------------------------------------"
|
||||
sed -i '/en_US.UTF-8 UTF-8/s/^#//' /etc/locale.gen
|
||||
locale-gen
|
||||
|
|
@ -68,13 +68,12 @@ pacman -Sy --noconfirm --needed
|
|||
|
||||
echo "
|
||||
-------------------------------------------------------------------------
|
||||
Installing Base System
|
||||
Installing Base System
|
||||
-------------------------------------------------------------------------"
|
||||
# sed $INSTALL_TYPE is using install type to check for MINIMAL installation, if it's true, stop
|
||||
# stop the script and move on, not installing any more packages below that line
|
||||
if [[ ! $DESKTOP_ENV == server ]]; then
|
||||
sed -n '/'$INSTALL_TYPE'/q;p' $HOME/ArchTitus/pkg-files/pacman-pkgs.txt | while read line
|
||||
do
|
||||
sed -n '/'$INSTALL_TYPE'/q;p' $HOME/ArchTitus/pkg-files/pacman-pkgs.txt | while read line; do
|
||||
if [[ ${line} == '--END OF MINIMAL INSTALL--' ]]; then
|
||||
# If selected installation type is FULL, skip the --END OF THE MINIMAL INSTALLATION-- line
|
||||
continue
|
||||
|
|
@ -116,17 +115,15 @@ fi
|
|||
#SETUP IS WRONG THIS IS RUN
|
||||
if ! source $HOME/ArchTitus/configs/setup.conf; then
|
||||
# Loop through user input until the user gives a valid username
|
||||
while true
|
||||
do
|
||||
while true; do
|
||||
read -p "Please enter username:" username
|
||||
# username regex per response here https://unix.stackexchange.com/questions/157426/what-is-the-regex-to-validate-linux-users
|
||||
# lowercase the username to test regex
|
||||
if [[ "${username,,}" =~ ^[a-z_]([a-z0-9_-]{0,31}|[a-z0-9_-]{0,30}\$)$ ]]
|
||||
then
|
||||
if [[ "${username,,}" =~ ^[a-z_]([a-z0-9_-]{0,31}|[a-z0-9_-]{0,30}\$)$ ]]; then
|
||||
break
|
||||
fi
|
||||
fi
|
||||
echo "Incorrect username."
|
||||
done
|
||||
done
|
||||
# convert name to lowercase before saving to setup.conf
|
||||
echo "username=${username,,}" >> ${HOME}/ArchTitus/configs/setup.conf
|
||||
|
||||
|
|
@ -134,22 +131,19 @@ echo "username=${username,,}" >> ${HOME}/ArchTitus/configs/setup.conf
|
|||
read -p "Please enter password:" password
|
||||
echo "password=${password,,}" >> ${HOME}/ArchTitus/configs/setup.conf
|
||||
|
||||
# Loop through user input until the user gives a valid hostname, but allow the user to force save
|
||||
while true
|
||||
do
|
||||
# Loop through user input until the user gives a valid hostname, but allow the user to force save
|
||||
while true; do
|
||||
read -p "Please name your machine:" name_of_machine
|
||||
# hostname regex (!!couldn't find spec for computer name!!)
|
||||
if [[ "${name_of_machine,,}" =~ ^[a-z][a-z0-9_.-]{0,62}[a-z0-9]$ ]]
|
||||
then
|
||||
break
|
||||
fi
|
||||
if [[ "${name_of_machine,,}" =~ ^[a-z][a-z0-9_.-]{0,62}[a-z0-9]$ ]]; then
|
||||
break
|
||||
fi
|
||||
# if validation fails allow the user to force saving of the hostname
|
||||
read -p "Hostname doesn't seem correct. Do you still want to save it? (y/n)" force
|
||||
if [[ "${force,,}" = "y" ]]
|
||||
then
|
||||
break
|
||||
fi
|
||||
done
|
||||
read -p "Hostname doesn't seem correct. Do you still want to save it? (y/n)" force
|
||||
if [[ "${force,,}" = "y" ]]; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
echo "NAME_OF_MACHINE=${name_of_machine,,}" >> ${HOME}/ArchTitus/configs/setup.conf
|
||||
fi
|
||||
|
|
@ -159,7 +153,7 @@ echo "
|
|||
-------------------------------------------------------------------------"
|
||||
if [ $(whoami) = "root" ]; then
|
||||
groupadd libvirt
|
||||
useradd -m -G wheel,libvirt -s /bin/bash $USERNAME
|
||||
useradd -m -G wheel,libvirt -s /bin/bash $USERNAME
|
||||
echo "$USERNAME created, home directory created, added to wheel and libvirt group, default shell set to /bin/bash"
|
||||
|
||||
# use chpasswd to enter $USERNAME:$password
|
||||
|
|
|
|||
|
|
@ -26,10 +26,8 @@ source $HOME/ArchTitus/configs/setup.conf
|
|||
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k
|
||||
ln -s "~/zsh/.zshrc" ~/.zshrc
|
||||
|
||||
sed -n '/'$INSTALL_TYPE'/q;p' ~/ArchTitus/pkg-files/${DESKTOP_ENV}.txt | while read line
|
||||
do
|
||||
if [[ ${line} == '--END OF MINIMAL INSTALL--' ]]
|
||||
then
|
||||
sed -n '/'$INSTALL_TYPE'/q;p' ~/ArchTitus/pkg-files/${DESKTOP_ENV}.txt | while read line; do
|
||||
if [[ ${line} == '--END OF MINIMAL INSTALL--' ]]; then
|
||||
# If selected installation type is FULL, skip the --END OF THE MINIMAL INSTALLATION-- line
|
||||
continue
|
||||
fi
|
||||
|
|
@ -45,8 +43,7 @@ if [[ ! $AUR_HELPER == none ]]; then
|
|||
makepkg -si --noconfirm
|
||||
# sed $INSTALL_TYPE is using install type to check for MINIMAL installation, if it's true, stop
|
||||
# stop the script and move on, not installing any more packages below that line
|
||||
sed -n '/'$INSTALL_TYPE'/q;p' ~/ArchTitus/pkg-files/aur-pkgs.txt | while read line
|
||||
do
|
||||
sed -n '/'$INSTALL_TYPE'/q;p' ~/ArchTitus/pkg-files/aur-pkgs.txt | while read line; do
|
||||
if [[ ${line} == '--END OF MINIMAL INSTALL--' ]]; then
|
||||
# If selected installation type is FULL, skip the --END OF THE MINIMAL INSTALLATION-- line
|
||||
continue
|
||||
|
|
|
|||
|
|
@ -150,8 +150,7 @@ sed -i 's/%wheel ALL=(ALL:ALL) NOPASSWD: ALL/# &/' /etc/sudoers
|
|||
sed -i '/%wheel ALL=(ALL) ALL/s/^# //' /etc/sudoers
|
||||
sed -i '/%wheel ALL=(ALL:ALL) ALL/s/^# //' /etc/sudoers
|
||||
|
||||
rm -r $HOME/ArchTitus
|
||||
rm -r /home/$USERNAME/ArchTitus
|
||||
rm -r $HOME/ArchTitus /home/$USERNAME/ArchTitus
|
||||
|
||||
# Replace in the same state
|
||||
cd $pwd
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
# @stderror Output routed to startup.log
|
||||
|
||||
# @setting-header General Settings
|
||||
# @setting CONFIG_FILE string[$CONFIGS_DIR/setup.conf] Location of setup.conf to be used by set_option and all subsequent scripts.
|
||||
# @setting CONFIG_FILE string[$CONFIGS_DIR/setup.conf] Location of setup.conf to be used by set_option and all subsequent scripts.
|
||||
CONFIG_FILE=$CONFIGS_DIR/setup.conf
|
||||
if [ ! -f $CONFIG_FILE ]; then # check if file exists
|
||||
touch -f $CONFIG_FILE # create file if not exists
|
||||
|
|
@ -56,7 +56,7 @@ select_option() {
|
|||
if [[ $key = [B || $key = j ]]; then echo down; fi;
|
||||
if [[ $key = [C || $key = l ]]; then echo right; fi;
|
||||
if [[ $key = [D || $key = h ]]; then echo left; fi;
|
||||
fi
|
||||
fi
|
||||
}
|
||||
print_options_multicol() {
|
||||
# print options by overwriting the last lines
|
||||
|
|
@ -67,9 +67,9 @@ select_option() {
|
|||
local idx=0
|
||||
local row=0
|
||||
local col=0
|
||||
|
||||
|
||||
curr_idx=$(( $curr_col + $curr_row * $colmax ))
|
||||
|
||||
|
||||
for option in "${options[@]}"; do
|
||||
|
||||
row=$(( $idx/$colmax ))
|
||||
|
|
@ -95,7 +95,7 @@ select_option() {
|
|||
local startrow=$(($lastrow - $#))
|
||||
local startcol=1
|
||||
local lines=$( tput lines )
|
||||
local cols=$( tput cols )
|
||||
local cols=$( tput cols )
|
||||
local colmax=$2
|
||||
local offset=$(( $cols / $colmax ))
|
||||
|
||||
|
|
@ -109,7 +109,7 @@ select_option() {
|
|||
local active_row=0
|
||||
local active_col=0
|
||||
while true; do
|
||||
print_options_multicol $active_col $active_row
|
||||
print_options_multicol $active_col $active_row
|
||||
# user key control
|
||||
case `key_input` in
|
||||
enter) break;;
|
||||
|
|
@ -144,7 +144,7 @@ echo "
|
|||
██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ██║ ██║ ╚██████╔╝███████║
|
||||
╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝
|
||||
------------------------------------------------------------------------
|
||||
Please select presetup settings for your system
|
||||
Please select presetup settings for your system
|
||||
------------------------------------------------------------------------"
|
||||
}
|
||||
# @description This function will handle file systems. At this movement we are handling only
|
||||
|
|
@ -158,7 +158,7 @@ select_option $? 1 "${options[@]}"
|
|||
case $? in
|
||||
0) set_option FS btrfs;;
|
||||
1) set_option FS ext4;;
|
||||
2)
|
||||
2)
|
||||
while true; do
|
||||
read -r -s -p "Please enter your luks password: " luks_password # read password without echo
|
||||
echo
|
||||
|
|
@ -178,13 +178,13 @@ done
|
|||
*) echo "Wrong option please select again"; filesystem;;
|
||||
esac
|
||||
}
|
||||
# @description Detects and sets timezone.
|
||||
# @description Detects and sets timezone.
|
||||
timezone () {
|
||||
# Added this from arch wiki https://wiki.archlinux.org/title/System_time
|
||||
time_zone="$(curl --fail https://ipapi.co/timezone)"
|
||||
echo "
|
||||
System detected your timezone to be '$time_zone' "
|
||||
echo "Is this correct?"
|
||||
echo "Is this correct?"
|
||||
options=("Yes" "No")
|
||||
select_option $? 1 "${options[@]}"
|
||||
|
||||
|
|
@ -199,7 +199,7 @@ case ${options[$?]} in
|
|||
*) echo "Wrong option. Try again";timezone;;
|
||||
esac
|
||||
}
|
||||
# @description Set user's keyboard mapping.
|
||||
# @description Set user's keyboard mapping.
|
||||
keymap () {
|
||||
echo -n "
|
||||
Please select a keyboard layout from this list:"
|
||||
|
|
@ -253,10 +253,10 @@ echo -e "\n${disk%|*} selected \n"
|
|||
drivessd
|
||||
}
|
||||
|
||||
# @description Gather username and password to be used for installation.
|
||||
# @description Gather username and password to be used for installation.
|
||||
userinfo () {
|
||||
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
|
||||
read -r -s -p "Please enter your password: " password # read password without echo
|
||||
echo
|
||||
|
|
@ -274,7 +274,7 @@ read -rep "Please enter your hostname: " nameofmachine
|
|||
set_option NAME_OF_MACHINE $nameofmachine
|
||||
}
|
||||
|
||||
# @description Choose AUR helper.
|
||||
# @description Choose AUR helper.
|
||||
aurhelper () {
|
||||
# Let the user choose AUR helper from predefined list
|
||||
echo "Please enter your desired AUR helper:"
|
||||
|
|
@ -294,7 +294,7 @@ desktopenv () {
|
|||
set_option DESKTOP_ENV $desktop_env
|
||||
}
|
||||
|
||||
# @description Choose whether to do full or minimal installation.
|
||||
# @description Choose whether to do full or minimal installation.
|
||||
installtype () {
|
||||
echo -e "Please select type of installation:\n\n
|
||||
Full install: Installs full featured desktop enviroment, with added apps and themes needed for everyday use\n
|
||||
|
|
|
|||
Loading…
Reference in New Issue