2023-03-26 23:15:29 -04:00
#!/bin/bash
# paru -S plasma-wayland-session --noconfirm
2023-08-23 05:59:27 -04:00
Argument = $1
2024-06-29 01:54:48 -04:00
# 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
2023-08-23 05:59:27 -04:00
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!"
2024-06-29 01:54:48 -04:00
# https://stackoverflow.com/questions/226703/how-do-i-prompt-for-yes-no-cancel-input-in-a-linux-shell-script
read -p "Do you wish to restart now? Y/N" yn
case $yn in
[ Yy] * ) sudo reboot ; ;
[ Nn] * ) exit; ;
esac
exit
2023-08-23 05:59:27 -04:00
fi
2023-03-26 23:15:29 -04:00
2023-03-27 00:10:41 -04:00
yadResults = $( yad \
2023-12-16 00:24:54 -05:00
--title= "Linux Toolbox" \
--form --columns= 3 \
--field Installations:LBL \
--field Debloat:chk \
--field paru:chk \
--field htop:chk \
2024-06-29 01:54:48 -04:00
--field 'Mesh Agent' :chk \
--field librewolf:chk \
--field brave:chk \
--field pacseek:chk \
2023-12-16 00:24:54 -05:00
--field docker:chk \
2024-06-29 01:54:48 -04:00
--field '-' :chk \
2023-12-16 00:24:54 -05:00
--field 'Install pkgs from List' :chk \
--field 'Export pkgs to List' :chk \
2024-06-29 01:54:48 -04:00
--field '-' :chk \
2023-12-16 00:24:54 -05:00
--field Configuration:LBL \
2024-07-06 17:12:43 -04:00
--field 'Change Hostname' :chk \
2023-12-16 00:24:54 -05:00
--field "sudo Timeout:chk" \
--field "Grub Timeout:chk" \
--field Konsave:chk \
--field "Check for Flexo:chk" \
2024-07-05 23:28:44 -04:00
--field 'Disable Connectivity Check' :chk \
2023-12-16 00:24:54 -05:00
--field "Updater to Desktop:chk" \
--field "Enable SSH:chk" \
2024-06-29 01:54:48 -04:00
--field "Custom .bashrc:chk" \
2024-07-06 17:12:43 -04:00
--field "Boot to CLI:chk" \
2023-12-16 00:24:54 -05:00
--field "Reboot:chk" \
--field '-' :LBL \
--field '-' :LBL \
--field '-' :LBL \
--field '-' :LBL \
--field '-' :LBL \
--field '-' :LBL \
--field '-' :LBL \
--field '-' :LBL \
--field '-' :LBL \
--field '-' :LBL \
--field '-' :LBL \
--field '-' :LBL \
--field '-' :LBL \
--field '-' :LBL \
--field '-' :LBL )
2023-03-27 00:10:41 -04:00
2023-03-27 00:14:06 -04:00
#DRIVEPART="`echo $PARTS | cut -d "|" -f 2`"
2023-08-23 05:59:27 -04:00
# Print values of ALL of the above fields statuses
# echo $yadResults
2023-03-26 23:15:29 -04:00
2023-03-27 00:14:06 -04:00
2024-06-29 01:54:48 -04:00
2023-03-27 00:14:06 -04:00
IFS = '|' # space is set as delimiter
read -ra SECTIONS <<< " $yadResults " # str is read into an array as tokens separated by IFS
# echo "first section"
# echo "${SECTIONS[0]}"
# echo "second:"
# echo "${SECTIONS[1]}"
# echo "loop"
index = 0
2024-06-29 01:54:48 -04:00
for i in " ${ SECTIONS [@] } " ; do # iterate through each element of array
2023-12-16 00:13:49 -05:00
2023-08-23 05:59:27 -04:00
# print the loop index and the value of the yad field
2024-06-29 01:54:48 -04:00
# echo "$index" # 1, 2, 3, 4
# echo "$i" # True, False
2023-03-27 00:14:06 -04:00
2024-06-29 01:54:48 -04:00
if [ [ $index -eq 1 ] ] && [ [ $i = = *"TRUE" * ] ] ; then
# Debloat
2023-12-16 00:13:49 -05:00
echo "Uninstalling EOS Extras: firewalld eos-update-notifier welcome eos-quickstart"
sudo pacman -R firewalld eos-update-notifier welcome eos-quickstart --noconfirm
2024-06-29 01:54:48 -04:00
echo "Disabling eos-welcome"
eos-welcome --disable # disable eos-welcome popup window
2023-03-27 00:14:06 -04:00
fi
2024-06-29 01:54:48 -04:00
if [ [ $index -eq 2 ] ] && [ [ $i = = *"TRUE" * ] ] ; then
echo "Installing paru"
sudo pacman -S paru --noconfirm
2023-03-27 00:14:06 -04:00
fi
2024-06-29 01:54:48 -04:00
if [ [ $index -eq 3 ] ] && [ [ $i = = *"TRUE" * ] ] ; then
echo "Installing htop"
paru -S htop --noconfirm
2023-03-27 00:14:06 -04:00
fi
2024-06-29 01:54:48 -04:00
if [ [ $index -eq 4 ] ] && [ [ $i = = *"TRUE" * ] ] ; then
# 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
# update pacman database and install xorg
echo "Updating pacman cache and installing xorg-xhost"
sudo pacman -Sy ; sudo pacman -S xorg-xhost --noconfirm
# set xhost for this session
xhost +local:
# create autostart folder in case it doesn't exist
mkdir ~/.config/autostart
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
2023-03-27 00:14:06 -04:00
fi
2024-06-29 01:54:48 -04:00
if [ [ $index -eq 5 ] ] && [ [ $i = = *"TRUE" * ] ] ; then
2023-03-27 00:14:06 -04:00
echo "Installing LibreWolf"
paru -S librewolf-bin --noconfirm
fi
2024-06-29 01:54:48 -04:00
if [ [ $index -eq 6 ] ] && [ [ $i = = *"TRUE" * ] ] ; then
2023-08-23 05:59:27 -04:00
echo "installing brave"
paru -S brave-bin --noconfirm
fi
2024-06-29 01:54:48 -04:00
if [ [ $index -eq 7 ] ] && [ [ $i = = *"TRUE" * ] ] ; then
echo "installing pacseek"
2023-03-27 00:14:06 -04:00
paru -S pacseek-bin --noconfirm
fi
2024-06-29 01:54:48 -04:00
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
2023-03-27 00:14:06 -04:00
fi
2024-06-29 01:54:48 -04:00
if [ [ $index -eq 9 ] ] && [ [ $i = = *"TRUE" * ] ] ; then
echo "empty here"
2023-08-23 05:59:27 -04:00
fi
2024-06-29 01:54:48 -04:00
if [ [ $index -eq 14 ] ] && [ [ $i = = *"TRUE" * ] ] ; then
2024-07-06 17:12:43 -04:00
echo "Changing Hostname"
2024-07-06 17:13:59 -04:00
echo "Please input new Hostname"
read hostname
hostnamectl set-hostname $hostname
2024-07-06 17:12:43 -04:00
fi
if [ [ $index -eq 15 ] ] && [ [ $i = = *"TRUE" * ] ] ; then
2024-06-29 01:54:48 -04:00
echo "Changing sudo timeout"
echo "Paste the following into the editor:"
konsole --hold -e echo "Defaults env_reset,timestamp_timeout=30" ; sudo visudo
# echo "Defaults env_reset,timestamp_timeout=30"
# sudo visudo
2023-08-23 05:59:27 -04:00
fi
2024-07-06 17:12:43 -04:00
if [ [ $index -eq 16 ] ] && [ [ $i = = *"TRUE" * ] ] ; then
2024-06-29 01:54:48 -04:00
echo "Changing GRUB timeout"
sudo nano /etc/default/grub
sudo grub-mkconfig -o /boot/grub/grub.cfg
2023-03-27 00:14:06 -04:00
fi
2024-07-06 17:12:43 -04:00
if [ [ $index -eq 17 ] ] && [ [ $i = = *"TRUE" * ] ] ; then
2024-06-29 01:54:48 -04:00
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
2023-03-27 00:14:06 -04:00
2024-06-29 01:54:48 -04:00
echo "Importing Konsave Profile"
2023-08-23 05:59:27 -04:00
konsave -i ~/Downloads/KonsaveTMPLT.knsv -f # import template
konsave -a KonsaveTMPLT # activate template
2024-06-29 01:54:48 -04:00
echo "Uninstalling Konsave"
2023-08-23 05:59:27 -04:00
paru -R konsave --noconfirm # uninstall konsave
2023-03-27 00:14:06 -04:00
fi
2023-08-23 05:59:27 -04:00
2023-03-27 00:14:06 -04:00
2023-08-23 05:59:27 -04:00
2024-07-06 17:12:43 -04:00
if [ [ $index -eq 18 ] ] && [ [ $i = = *"TRUE" * ] ] ; then
2024-06-29 01:54:48 -04:00
file = "/etc/pacman.d/mirrorlist"
string = "http://10.0.0.108:7878"
2023-03-27 00:14:06 -04:00
2024-06-29 01:54:48 -04:00
if grep -q " $string " " $file " ; then
echo "Flexo is in the mirrorlist. :)"
else
echo " FLEXO IP $string is not found in the mirrorlist file. Adding it. "
echo 'Server = http://10.0.0.108:7878/$repo/os/$arch' | sudo tee -a /etc/pacman.d/mirrorlist
2023-12-16 00:13:49 -05:00
fi
2023-08-23 05:59:27 -04:00
fi
2024-07-06 17:12:43 -04:00
if [ [ $index -eq 19 ] ] && [ [ $i = = *"TRUE" * ] ] ; then
# https://wiki.archlinux.org/title/NetworkManager#Checking_connectivity
2024-07-05 23:28:44 -04:00
file = "/etc/NetworkManager/conf.d/20-connectivity.conf"
string = "enabled=false"
if grep -q " $string " " $file " ; then
echo "Network Connectivity is already disabled"
else
echo "Network Connectivity is not disabled. Adding network config file"
echo '[connectivity]' | sudo tee -a /etc/NetworkManager/conf.d/20-connectivity.conf
echo 'enabled=false' | sudo tee -a /etc/NetworkManager/conf.d/20-connectivity.conf
fi
fi
2023-08-23 05:59:27 -04:00
2023-12-16 00:13:49 -05:00
2024-07-06 17:12:43 -04:00
if [ [ $index -eq 20 ] ] && [ [ $i = = *"TRUE" * ] ] ; then
2024-06-29 01:54:48 -04:00
echo "Adding Update Arch shortcut to desktop"
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
2023-08-23 05:59:27 -04:00
fi
2023-03-27 00:14:06 -04:00
2024-07-06 17:12:43 -04:00
if [ [ $index -eq 21 ] ] && [ [ $i = = *"TRUE" * ] ] ; then
2024-06-29 01:54:48 -04:00
echo "Enabling SSH Access"
sudo systemctl enable sshd.service && sudo systemctl start sshd.service
2023-03-27 00:14:06 -04:00
fi
2024-06-29 01:54:48 -04:00
if [ [ $index -eq 22 ] ] && [ [ $i = = *"TRUE" * ] ] ; then
echo "Custom Bashrc"
echo "Downloading and replacing .bashrc file"
2023-03-27 00:14:06 -04:00
2024-06-29 01:54:48 -04:00
cd ~/ && wget -q -O .bashrc https://git.zinchuk.xyz/yuriy/Linux-bashrc-Profile/raw/branch/main/.bashrc && chmod 744 .bashrc
fi
2023-03-27 00:14:06 -04:00
2024-06-29 01:54:48 -04:00
if [ [ $index -eq 23 ] ] && [ [ $i = = *"TRUE" * ] ] ; then
2024-07-06 17:12:43 -04:00
echo "Changing System Boot to CLI"
sudo systemctl set-default multi-user.target
fi
if [ [ $index -eq 24 ] ] && [ [ $i = = *"TRUE" * ] ] ; then
2024-06-29 01:54:48 -04:00
echo "Rebooting System"
reboot
fi
2023-03-27 00:14:06 -04:00
2024-06-29 01:54:48 -04:00
#if [[ $index -eq NUMBER ]] && [[ $i == *"TRUE"* ]]; then
#
#fi
2023-03-27 00:14:06 -04:00
2024-06-29 01:54:48 -04:00
( ( index++) ) # Add 1 to count
done
2023-03-27 00:14:06 -04:00