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
|
||||
|
|
|
|||
|
|
@ -73,8 +73,7 @@ echo "
|
|||
# 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,13 +115,11 @@ 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
|
||||
echo "Incorrect username."
|
||||
|
|
@ -135,18 +132,15 @@ echo "username=${username,,}" >> ${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
|
||||
while true
|
||||
do
|
||||
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
|
||||
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
|
||||
if [[ "${force,,}" = "y" ]]; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue