updated both updater scripts

This commit is contained in:
naturallaw77 2024-03-15 11:35:36 -07:00
parent b57ad193d2
commit 33900c09e2
2 changed files with 60 additions and 32 deletions

View File

@ -1,10 +1,11 @@
#!/usr/bin/env bash #!/usr/bin/env bash
FLATPAK () { FLATPAK () {
if ! ssh root@localhost 'flatpak update -y' ; then if ! ssh root@localhost 'flatpak update -y' ; then
zenity --error \ zenity --error \
--title="Sovran_SystemsOS_Light Updater" \ --title="Sovran_SystemsOS_Light_Updater" \
--text="Could Not Update Flatpaks." --text="Could Not Update Flatpaks."
exit 1 exit 1
@ -19,26 +20,37 @@ time_stamp=$(date +%Y-%m-%d-%T)
mkdir -p /home/free/Documents/Updater_App_Logs mkdir -p /home/free/Documents/Updater_App_Logs
if ! xterm -T "Sovran_SystemsOS_Light Updater" -fa 'Noto Mono' -fs 15 -fg white -bg black -e bash -c "ssh root@localhost 'cd /etc/nixos && nix flake update && nixos-rebuild switch'" ; then xterm -T "Sovran_SystemsOS_Light_Updater" -fa 'Noto Mono' -fs 15 -fg white -bg black -e bash -c "ssh root@localhost 'cd /etc/nixos && nix flake update && nixos-rebuild switch 2>&1 | tee /home/free/Documents/Updater_App_Logs/{$time_stamp}_Updater_Log.txt'"
}
TACO () {
pushd /home/free/Documents/Updater_App_Logs
file=$(ls -Art | tail -n 1)
if grep -w "error" $file ; then
zenity --error \ zenity --error \
--width=500 \ --width=1300 \
--title="Sovran_SystemsOS_Light Updater" \ --title="Sovran_SystemsOS_Light_Updater" \
--text="Could not complete the Sovran_SystemsOS_Light update." --text="Could not complete the Sovran_SystemsOS update. Check the error log in your Documents under Updater_App_Logs folder for more details."
exit 1
else else
zenity --info \ zenity --info \
--ellipsize \ --ellipsize \
--no-wrap \ --no-wrap \
--width=500 \ --width=600 \
--title="Sovran_SystemsOS_Light Updater" \ --title="Sovran_SystemsOS_Light_Updater" \
--text="Yay complete! Please reboot when you are ready." --text="Yay complete! Please reboot when you are ready."
exit 1
fi fi
popd
} }
######### #########
@ -47,8 +59,8 @@ curl "https://git.sovransystems.com/Sovran_Systems/Software/raw/branch/main/Sovr
zenity --text-info \ zenity --text-info \
--width=1000 \ --width=1000 \
--height=750 \ --height=850 \
--title="Sovran_SystemsOS_Light Updater" --title="Sovran_SystemsOS_Light_Updater"
if [[ $? -eq 1 ]]; then if [[ $? -eq 1 ]]; then
@ -56,11 +68,13 @@ if [[ $? -eq 1 ]]; then
else else
FLATPAK | zenity --progress --no-cancel --auto-close --width=460 --pulsate --text="Updating Flatpaks now..." --title="Sovran_SystemsOS_Light Updater" FLATPAK | zenity --progress --no-cancel --auto-close --width=460 --pulsate --text="Updating Flatpaks now..." --title="Sovran_SystemsOS_Light_Updater"
SPICE | zenity --progress --no-cancel --auto-close --width=750 --pulsate --text="Updating now. In rare cases, it could take up to 1 hour. Go have some herbal tea and relax while the update is in progress." --title="Sovran_SystemsOS_Light Updater" SPICE | zenity --progress --no-cancel --auto-close --width=1050 --pulsate --text="Updating now. In rare cases, it could take up to 3 hours. Go have some herbal tea and relax while the update is in progress." --title="Sovran_SystemsOS_Light_Updater"
find /home/free/Documents/Updater_App_Logs -name "*.txt" -type f -mtime +5 -delete TACO
find /home/free/Documents/Updater_App_Logs -name "*.txt" -type f -mtime +3 -delete
fi fi

View File

@ -1,10 +1,11 @@
#!/usr/bin/env bash #!/usr/bin/env bash
FLATPAK () { FLATPAK () {
if ! ssh root@localhost 'flatpak update -y' ; then if ! ssh root@localhost 'flatpak update -y' ; then
zenity --error \ zenity --error \
--title="Sovran_SystemsOS Updater" \ --title="Sovran_SystemsOS_Updater" \
--text="Could Not Update Flatpaks." --text="Could Not Update Flatpaks."
exit 1 exit 1
@ -19,26 +20,37 @@ time_stamp=$(date +%Y-%m-%d-%T)
mkdir -p /home/free/Documents/Updater_App_Logs mkdir -p /home/free/Documents/Updater_App_Logs
if ! xterm -T "Sovran_SystemsOS Updater" -fa 'Noto Mono' -fs 15 -fg white -bg black -e bash -c "ssh root@localhost 'cd /etc/nixos && nix flake update && nixos-rebuild switch --impure'" ; then xterm -T "Sovran_SystemsOS_Updater" -fa 'Noto Mono' -fs 15 -fg white -bg black -e bash -c "ssh root@localhost 'cd /etc/nixos && nix flake update && nixos-rebuild switch --impure 2>&1 | tee /home/free/Documents/Updater_App_Logs/{$time_stamp}_Updater_Log.txt'"
}
TACO () {
pushd /home/free/Documents/Updater_App_Logs
file=$(ls -Art | tail -n 1)
if grep -w "error" $file ; then
zenity --error \ zenity --error \
--width=500 \ --width=1300 \
--title="Sovran_SystemsOS Updater" \ --title="Sovran_SystemsOS_Updater" \
--text="Could not complete the Sovran_SystemsOS update." --text="Could not complete the Sovran_SystemsOS update. Check the error log in your Documents under Updater_App_Logs folder for more details."
exit 1
else else
zenity --info \ zenity --info \
--ellipsize \ --ellipsize \
--no-wrap \ --no-wrap \
--width=500 \ --width=600 \
--title="Sovran_SystemsOS Updater" \ --title="Sovran_SystemsOS_Updater" \
--text="Yay complete! Please reboot when you are ready." --text="Yay complete! Please reboot when you are ready."
exit 1
fi fi
popd
} }
######### #########
@ -47,8 +59,8 @@ curl "https://git.sovransystems.com/Sovran_Systems/Software/raw/branch/main/Sovr
zenity --text-info \ zenity --text-info \
--width=1000 \ --width=1000 \
--height=750 \ --height=850 \
--title="Sovran_SystemsOS Updater" --title="Sovran_SystemsOS_Updater"
if [[ $? -eq 1 ]]; then if [[ $? -eq 1 ]]; then
@ -56,11 +68,13 @@ if [[ $? -eq 1 ]]; then
else else
FLATPAK | zenity --progress --no-cancel --auto-close --width=460 --pulsate --text="Updating Flatpaks now..." --title="Sovran_SystemsOS Updater" FLATPAK | zenity --progress --no-cancel --auto-close --width=460 --pulsate --text="Updating Flatpaks now..." --title="Sovran_SystemsOS_Updater"
SPICE | zenity --progress --no-cancel --auto-close --width=750 --pulsate --text="Updating now. In rare cases, it could take up to 3 hours. Go have some herbal tea and relax while the update is in progress." --title="Sovran_SystemsOS Updater" SPICE | zenity --progress --no-cancel --auto-close --width=1050 --pulsate --text="Updating now. In rare cases, it could take up to 3 hours. Go have some herbal tea and relax while the update is in progress." --title="Sovran_SystemsOS_Updater"
find /home/free/Documents/Updater_App_Logs -name "*.txt" -type f -mtime +5 -delete TACO
find /home/free/Documents/Updater_App_Logs -name "*.txt" -type f -mtime +3 -delete
fi fi