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:
i-c-u-p 2022-04-25 09:06:37 +00:00
parent 62e5ba90b1
commit 742a2dc236
No known key found for this signature in database
GPG Key ID: ABB80C12170FC0D1
6 changed files with 48 additions and 59 deletions

View File

@ -104,8 +104,7 @@ bash_prompt_command() {
local pwdoffset=$(( ${#NEW_PWD} - pwdmaxlen )) local pwdoffset=$(( ${#NEW_PWD} - pwdmaxlen ))
# Generate name # Generate name
if [ ${pwdoffset} -gt "0" ] if [ ${pwdoffset} -gt "0" ]; then
then
NEW_PWD=${NEW_PWD:$pwdoffset:$pwdmaxlen} NEW_PWD=${NEW_PWD:$pwdoffset:$pwdmaxlen}
NEW_PWD=${trunc_symbol}/${NEW_PWD#*/} NEW_PWD=${trunc_symbol}/${NEW_PWD#*/}
fi fi

View File

@ -73,8 +73,7 @@ echo "
# sed $INSTALL_TYPE is using install type to check for MINIMAL installation, if it's true, stop # 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 # stop the script and move on, not installing any more packages below that line
if [[ ! $DESKTOP_ENV == server ]]; then if [[ ! $DESKTOP_ENV == server ]]; then
sed -n '/'$INSTALL_TYPE'/q;p' $HOME/ArchTitus/pkg-files/pacman-pkgs.txt | while read line sed -n '/'$INSTALL_TYPE'/q;p' $HOME/ArchTitus/pkg-files/pacman-pkgs.txt | while read line; do
do
if [[ ${line} == '--END OF MINIMAL INSTALL--' ]]; then if [[ ${line} == '--END OF MINIMAL INSTALL--' ]]; then
# If selected installation type is FULL, skip the --END OF THE MINIMAL INSTALLATION-- line # If selected installation type is FULL, skip the --END OF THE MINIMAL INSTALLATION-- line
continue continue
@ -116,13 +115,11 @@ fi
#SETUP IS WRONG THIS IS RUN #SETUP IS WRONG THIS IS RUN
if ! source $HOME/ArchTitus/configs/setup.conf; then if ! source $HOME/ArchTitus/configs/setup.conf; then
# Loop through user input until the user gives a valid username # Loop through user input until the user gives a valid username
while true while true; do
do
read -p "Please enter username:" username 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 # 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 # lowercase the username to test regex
if [[ "${username,,}" =~ ^[a-z_]([a-z0-9_-]{0,31}|[a-z0-9_-]{0,30}\$)$ ]] if [[ "${username,,}" =~ ^[a-z_]([a-z0-9_-]{0,31}|[a-z0-9_-]{0,30}\$)$ ]]; then
then
break break
fi fi
echo "Incorrect username." echo "Incorrect username."
@ -135,18 +132,15 @@ echo "username=${username,,}" >> ${HOME}/ArchTitus/configs/setup.conf
echo "password=${password,,}" >> ${HOME}/ArchTitus/configs/setup.conf 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 # Loop through user input until the user gives a valid hostname, but allow the user to force save
while true while true; do
do
read -p "Please name your machine:" name_of_machine read -p "Please name your machine:" name_of_machine
# hostname regex (!!couldn't find spec for computer name!!) # hostname regex (!!couldn't find spec for computer name!!)
if [[ "${name_of_machine,,}" =~ ^[a-z][a-z0-9_.-]{0,62}[a-z0-9]$ ]] if [[ "${name_of_machine,,}" =~ ^[a-z][a-z0-9_.-]{0,62}[a-z0-9]$ ]]; then
then
break break
fi fi
# if validation fails allow the user to force saving of the hostname # 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 read -p "Hostname doesn't seem correct. Do you still want to save it? (y/n)" force
if [[ "${force,,}" = "y" ]] if [[ "${force,,}" = "y" ]]; then
then
break break
fi fi
done done

View File

@ -26,10 +26,8 @@ source $HOME/ArchTitus/configs/setup.conf
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k
ln -s "~/zsh/.zshrc" ~/.zshrc ln -s "~/zsh/.zshrc" ~/.zshrc
sed -n '/'$INSTALL_TYPE'/q;p' ~/ArchTitus/pkg-files/${DESKTOP_ENV}.txt | while read line sed -n '/'$INSTALL_TYPE'/q;p' ~/ArchTitus/pkg-files/${DESKTOP_ENV}.txt | while read line; do
do if [[ ${line} == '--END OF MINIMAL INSTALL--' ]]; then
if [[ ${line} == '--END OF MINIMAL INSTALL--' ]]
then
# If selected installation type is FULL, skip the --END OF THE MINIMAL INSTALLATION-- line # If selected installation type is FULL, skip the --END OF THE MINIMAL INSTALLATION-- line
continue continue
fi fi
@ -45,8 +43,7 @@ if [[ ! $AUR_HELPER == none ]]; then
makepkg -si --noconfirm makepkg -si --noconfirm
# sed $INSTALL_TYPE is using install type to check for MINIMAL installation, if it's true, stop # 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 # 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 sed -n '/'$INSTALL_TYPE'/q;p' ~/ArchTitus/pkg-files/aur-pkgs.txt | while read line; do
do
if [[ ${line} == '--END OF MINIMAL INSTALL--' ]]; then if [[ ${line} == '--END OF MINIMAL INSTALL--' ]]; then
# If selected installation type is FULL, skip the --END OF THE MINIMAL INSTALLATION-- line # If selected installation type is FULL, skip the --END OF THE MINIMAL INSTALLATION-- line
continue continue

View File

@ -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/s/^# //' /etc/sudoers
sed -i '/%wheel ALL=(ALL:ALL) ALL/s/^# //' /etc/sudoers sed -i '/%wheel ALL=(ALL:ALL) ALL/s/^# //' /etc/sudoers
rm -r $HOME/ArchTitus rm -r $HOME/ArchTitus /home/$USERNAME/ArchTitus
rm -r /home/$USERNAME/ArchTitus
# Replace in the same state # Replace in the same state
cd $pwd cd $pwd