code cleanup and reformatting

This commit is contained in:
Yuriy 2024-06-29 01:54:48 -04:00
parent fbe160515e
commit b2a1199642

206
Linux_Toolbox.sh Normal file → Executable file
View File

@ -4,6 +4,7 @@
Argument=$1 Argument=$1
# Update all keyrings, and packages without asking for confirmations for anything (Choose default option each time), and then clear out the local pacman package cache afterwards
if [[ $Argument == *"update"* ]]; then if [[ $Argument == *"update"* ]]; then
paru -Sy archlinux-keyring chaotic-keyring endeavouros-keyring --noconfirm --needed; paru -Syu --noconfirm; echo clearing out $(sudo ls /var/cache/pacman/pkg/ | wc -l) packages in cache; ( echo "y"; echo "y" ) | paru -Scc; echo "Update Complete!" paru -Sy archlinux-keyring chaotic-keyring endeavouros-keyring --noconfirm --needed; paru -Syu --noconfirm; echo clearing out $(sudo ls /var/cache/pacman/pkg/ | wc -l) packages in cache; ( echo "y"; echo "y" ) | paru -Scc; echo "Update Complete!"
@ -27,22 +28,25 @@ yadResults=$(yad \
--field Debloat:chk \ --field Debloat:chk \
--field paru:chk \ --field paru:chk \
--field htop:chk \ --field htop:chk \
--field MeshCentral:chk \ --field 'Mesh Agent':chk \
--field librewolf-bin:chk \ --field librewolf:chk \
--field brave-bin:chk \ --field brave:chk \
--field pacseek-bin:chk \ --field pacseek:chk \
--field docker:chk \ --field docker:chk \
--field docker-compose:chk \ --field '-':chk \
--field 'Install pkgs from List':chk \ --field 'Install pkgs from List':chk \
--field 'Export pkgs to List':chk \ --field 'Export pkgs to List':chk \
--field '-':chk \
--field Configuration:LBL \ --field Configuration:LBL \
--field "sudo Timeout:chk" \ --field "sudo Timeout:chk" \
--field "Grub Timeout:chk" \ --field "Grub Timeout:chk" \
--field Konsave:chk \ --field Konsave:chk \
--field Flexo:chk \
--field "Check for Flexo:chk" \ --field "Check for Flexo:chk" \
--field '':chk \
--field "Updater to Desktop:chk" \ --field "Updater to Desktop:chk" \
--field "Enable SSH:chk" \ --field "Enable SSH:chk" \
--field '':chk \
--field "Custom .bashrc:chk" \
--field "Reboot:chk" \ --field "Reboot:chk" \
--field '-':LBL \ --field '-':LBL \
--field '-':LBL \ --field '-':LBL \
@ -70,13 +74,11 @@ yadResults=$(yad \
IFS='|' # space is set as delimiter IFS='|' # space is set as delimiter
read -ra SECTIONS <<< "$yadResults" # str is read into an array as tokens separated by IFS read -ra SECTIONS <<< "$yadResults" # str is read into an array as tokens separated by IFS
# echo "first section" # echo "first section"
# echo "${SECTIONS[0]}" # echo "${SECTIONS[0]}"
# echo "second:" # echo "second:"
@ -85,42 +87,35 @@ read -ra SECTIONS <<< "$yadResults" # str is read into an array as tokens sepa
index=0 index=0
for i in "${SECTIONS[@]}"; do # access each element of array for i in "${SECTIONS[@]}"; do # iterate through each element of array
# print the loop index and the value of the yad field # print the loop index and the value of the yad field
# echo "$index" # echo "$index" # 1, 2, 3, 4
# echo "$i" # echo "$i" # True, False
if [[ $index -eq 1 ]] && [[ $i == *"TRUE"* ]]; then
if [[ $index -eq 1 ]] # Debloat
then # DEBLOAT
if [[ $i == *"TRUE"* ]]; then
echo "Uninstalling EOS Extras: firewalld eos-update-notifier welcome eos-quickstart" echo "Uninstalling EOS Extras: firewalld eos-update-notifier welcome eos-quickstart"
sudo pacman -R firewalld eos-update-notifier welcome eos-quickstart --noconfirm sudo pacman -R firewalld eos-update-notifier welcome eos-quickstart --noconfirm
fi echo "Disabling eos-welcome"
eos-welcome --disable # disable eos-welcome popup window
fi fi
if [[ $index -eq 2 ]] if [[ $index -eq 2 ]] && [[ $i == *"TRUE"* ]]; then
then
if [[ $i == *"TRUE"* ]]; then
echo "Installing paru" echo "Installing paru"
sudo pacman -S paru --noconfirm sudo pacman -S paru --noconfirm
fi fi
fi
if [[ $index -eq 3 ]]
then if [[ $index -eq 3 ]] && [[ $i == *"TRUE"* ]]; then
if [[ $i == *"TRUE"* ]]; then
echo "Installing htop" echo "Installing htop"
paru -S htop --noconfirm paru -S htop --noconfirm
fi fi
fi
if [[ $index -eq 4 ]]
then if [[ $index -eq 4 ]] && [[ $i == *"TRUE"* ]]; then
if [[ $i == *"TRUE"* ]]; then
# install meshcentral agent # install meshcentral agent
cd ~/Downloads/ ; wget --no-check-certificate -O meshagent "https://10.0.0.201/meshagents?id=%40FGwJAr%40pZPmGfuvJ1N1IpjOWl4USZc8k8XEE1xI4DEDzuWkJchGQHgbHBwrkuwB&installflags=0&meshinstall=6" ; chmod +x ./meshagent ; sudo ./meshagent -install cd ~/Downloads/ ; wget --no-check-certificate -O meshagent "https://10.0.0.201/meshagents?id=%40FGwJAr%40pZPmGfuvJ1N1IpjOWl4USZc8k8XEE1xI4DEDzuWkJchGQHgbHBwrkuwB&installflags=0&meshinstall=6" ; chmod +x ./meshagent ; sudo ./meshagent -install
@ -137,174 +132,123 @@ then
echo "Adding xhost +local: to startup" echo "Adding xhost +local: to startup"
cd ~/.config/autostart ; wget -q -O xhost.desktop https://git.zinchuk.xyz/yuriy/linux-setup-script/raw/branch/main/xhost.desktop cd ~/.config/autostart ; wget -q -O xhost.desktop https://git.zinchuk.xyz/yuriy/linux-setup-script/raw/branch/main/xhost.desktop
fi fi
fi
if [[ $index -eq 5 ]]
then if [[ $index -eq 5 ]] && [[ $i == *"TRUE"* ]]; then
if [[ $i == *"TRUE"* ]]; then
echo "Installing LibreWolf" echo "Installing LibreWolf"
paru -S librewolf-bin --noconfirm paru -S librewolf-bin --noconfirm
fi fi
fi
if [[ $index -eq 6 ]]
then if [[ $index -eq 6 ]] && [[ $i == *"TRUE"* ]]; then
if [[ $i == *"TRUE"* ]]; then
echo "installing brave" echo "installing brave"
paru -S brave-bin --noconfirm paru -S brave-bin --noconfirm
fi fi
fi
if [[ $index -eq 7 ]]
then if [[ $index -eq 7 ]] && [[ $i == *"TRUE"* ]]; then
if [[ $i == *"TRUE"* ]]; then
echo "installing pacseek" echo "installing pacseek"
paru -S pacseek-bin --noconfirm paru -S pacseek-bin --noconfirm
fi fi
if [[ $index -eq 8 ]] && [[ $i == *"TRUE"* ]]; then
echo "Installing and enabling Docker & Docker Compose"
paru -S docker docker-compose --noconfirm && sudo systemctl enable docker.service && sudo systemctl enable containerd.service
fi fi
if [[ $index -eq 8 ]] if [[ $index -eq 9 ]] && [[ $i == *"TRUE"* ]]; then
then echo "empty here"
if [[ $i == *"TRUE"* ]]; then
echo "Installing and enabling Docker"
paru -S docker --noconfirm && sudo systemctl enable docker.service && sudo systemctl enable containerd.service
fi
fi
if [[ $index -eq 9 ]]
then
if [[ $i == *"TRUE"* ]]; then
echo "Installing and enabling docker-compose"
paru -S docker-compose --noconfirm
fi
fi fi
if [[ $index -eq 13 ]]
then if [[ $index -eq 14 ]] && [[ $i == *"TRUE"* ]]; then
if [[ $i == *"TRUE"* ]]; then
echo "Changing sudo timeout" echo "Changing sudo timeout"
echo "Paste the following into the editor:" echo "Paste the following into the editor:"
echo "Defaults env_reset,timestamp_timeout=30" konsole --hold -e echo "Defaults env_reset,timestamp_timeout=30" ; sudo visudo
sudo visudo # echo "Defaults env_reset,timestamp_timeout=30"
# sudo visudo
fi
fi fi
if [[ $index -eq 15 ]] && [[ $i == *"TRUE"* ]]; then
if [[ $index -eq 14 ]]
then
if [[ $i == *"TRUE"* ]]; then
echo "Changing GRUB timeout" echo "Changing GRUB timeout"
sudo nano /etc/default/grub sudo nano /etc/default/grub
sudo grub-mkconfig -o /boot/grub/grub.cfg sudo grub-mkconfig -o /boot/grub/grub.cfg
fi fi
fi
if [[ $index -eq 15 ]]
then
if [[ $i == *"TRUE"* ]]; then
echo "Installing Konsave and Importing Profile to terminal user"
paru -S konsave --noconfirm
cd ~/Downloads/ ; wget -q -O KonsaveTMPLT.knsv http://git.wmpco.biz/yuriy/Linux-Toolbox/raw/branch/main/KonsaveTMPLT.knsv
# smbget smb://smb/Toolbox/Installs/Linux/KonsaveTMPLT.knsv -a
#konsave -i $PWD/KonsaveTMPLT.knsv -f if [[ $index -eq 16 ]] && [[ $i == *"TRUE"* ]]; then
echo "Installing Konsave"
pacman -Sy ; paru -S konsave --noconfirm
echo "Downloading Konsave Profile from Gitea"
cd ~/Downloads/ ; wget -q -O KonsaveTMPLT.knsv https://git.zinchuk.xyz/yuriy/linux-setup-script/raw/branch/main/KonsaveTMPLT.knsv
echo "Importing Konsave Profile"
konsave -i ~/Downloads/KonsaveTMPLT.knsv -f # import template konsave -i ~/Downloads/KonsaveTMPLT.knsv -f # import template
konsave -a KonsaveTMPLT # activate template konsave -a KonsaveTMPLT # activate template
echo "Uninstalling Konsave"
paru -R konsave --noconfirm # uninstall konsave paru -R konsave --noconfirm # uninstall konsave
# reboot
fi
fi fi
if [[ $index -eq 16 ]]
then
if [[ $i == *"TRUE"* ]]; then
echo "Adding Flexo to mirrorlist"
echo 'Server = http://10.0.0.101:7878/$repo/os/$arch' | sudo tee -a /etc/pacman.d/mirrorlist
fi
fi
if [[ $index -eq 17 ]]
then
if [[ $i == *"TRUE"* ]]; then
if [[ $index -eq 17 ]] && [[ $i == *"TRUE"* ]]; then
file="/etc/pacman.d/mirrorlist" file="/etc/pacman.d/mirrorlist"
string="http://10.0.0.101:7878" string="http://10.0.0.108:7878"
if grep -q "$string" "$file"; then if grep -q "$string" "$file"; then
echo "Flexo is in the mirrorlist. :)" echo "Flexo is in the mirrorlist. :)"
else else
echo "FLEXO IP $string is not found in the mirrorlist file. Please consider adding it for faster updates." echo "FLEXO IP $string is not found in the mirrorlist file. Adding it."
fi echo 'Server = http://10.0.0.108:7878/$repo/os/$arch' | sudo tee -a /etc/pacman.d/mirrorlist
fi fi
fi fi
if [[ $index -eq 18 ]]
then
if [[ $i == *"TRUE"* ]]; then
if [[ $index -eq 19 ]] && [[ $i == *"TRUE"* ]]; then
echo "Adding Update Arch shortcut to desktop" echo "Adding Update Arch shortcut to desktop"
cd ~/Desktop/ ; wget -q -O Update_Arch.sh http://git.wmpco.biz/yuriy/Linux-Toolbox/raw/branch/main/Update_Arch_Linux.sh ; chmod +x Update_Arch.sh cd ~/Desktop/ ; wget -q -O Update_Arch.sh https://git.zinchuk.xyz/yuriy/linux-setup-script/raw/branch/main/Update_Arch_Linux.sh ; chmod +x Update_Arch.sh
fi
fi fi
if [[ $index -eq 19 ]]
then if [[ $index -eq 20 ]] && [[ $i == *"TRUE"* ]]; then
if [[ $i == *"TRUE"* ]]; then
echo "Enabling SSH Access" echo "Enabling SSH Access"
sudo systemctl enable sshd.service && sudo systemctl start sshd.service sudo systemctl enable sshd.service && sudo systemctl start sshd.service
fi fi
if [[ $index -eq 21 ]] && [[ $i == *"TRUE"* ]]; then
echo "Nothing Here"
fi fi
if [[ $index -eq 20 ]] if [[ $index -eq 22 ]] && [[ $i == *"TRUE"* ]]; then
then echo "Custom Bashrc"
if [[ $i == *"TRUE"* ]]; then echo "Downloading and replacing .bashrc file"
cd ~/ && wget -q -O .bashrc https://git.zinchuk.xyz/yuriy/Linux-bashrc-Profile/raw/branch/main/.bashrc && chmod 744 .bashrc
fi
if [[ $index -eq 23 ]] && [[ $i == *"TRUE"* ]]; then
echo "Rebooting System" echo "Rebooting System"
reboot reboot
fi fi
fi
if [[ $index -eq 21 ]]
then
if [[ $i == *"TRUE"* ]]; then
echo "TEMPLATE"
fi
fi
#if [[ $index -eq NUMBER ]] && [[ $i == *"TRUE"* ]]; then
#
#fi
((index++)) # Add 1 to count ((index++)) # Add 1 to count
done done
#items=`yad --list --separator='' --height=600 --multiple --column="Items" item1 item2 item3`
#echo $items
# for item in $SECTIONS; do
# echo "$item"
# done
#yad --title="Desktop entry editor" --text="Simple desktop entry editor" \
#--form --field="Type:CB" --field="Name" --field="Generic name" \
#--field="Comment" --field="Command:FL" --field="Icon" \
#--field="In termianl:CHK" --field="Startup notify:CHK" \
#"Application!URI" "Name" "Generic name" "This is the comment" \
#"/usr/bin/yad" "yad" FALSE TRUE