Software/Sovran_SystemsOS_Updater/Updater Source Files/Update_Sovran_SystemsOS.sh

56 lines
1.1 KiB
Bash
Raw Normal View History

2023-05-22 19:32:08 -07:00
#!/usr/bin/env bash
2023-05-22 14:32:15 -07:00
2023-06-03 17:06:12 -07:00
set -o nounset
2023-05-22 22:23:31 -07:00
2023-06-03 16:25:58 -07:00
curl "https://git.sovransystems.com/Sovran_Systems/Software/raw/branch/main/Sovran_SystemsOS_Updater/Updater%20Source%20Files/Intro.md" |
zenity --text-info \
--title="Sovran_SystemsOS Updater" \
2023-05-23 12:22:45 -07:00
--width=1110 \
2023-05-23 12:34:29 -07:00
--height=710
if [[ $? -eq 1 ]]; then
2023-05-23 20:10:41 -07:00
2023-06-03 17:06:12 -07:00
exit 1
2023-05-22 14:32:15 -07:00
2023-06-03 17:06:12 -07:00
else
2023-05-23 20:10:41 -07:00
2023-06-03 21:36:07 -07:00
id=(curl ifconfig.me || ifdata -pa enp2s0 || ifdata -pa wlp1s0)
ssh -i /home/free/.ssh/sovranpro_login root@${id} 'cd /etc/nixos; nix flake update'
2023-05-22 14:32:15 -07:00
2023-06-03 17:06:12 -07:00
if [[ $? != 0 ]]; then
echo "Could not update flake -- exiting" |
zenity --text-info \
--title="Sovran_SystemsOS Updater" \
--width=1110 \
--height=710
exit 1
fi
2023-05-22 14:32:15 -07:00
2023-06-03 21:36:07 -07:00
ssh -i /home/free/.ssh/sovranpro_login root@${id} "nixos-rebuild switch --impure" |
2023-06-03 17:06:12 -07:00
zenity --progress \
2023-05-23 20:10:41 -07:00
--no-cancel \
--auto-close \
--pulsate \
--title="Sovran_SystemsOS Updater"
2023-05-22 14:32:15 -07:00
2023-06-03 17:06:12 -07:00
if [[ $? != 0 ]]; then
echo "Could not Update Sovran_SystemsOS -- exiting" |
zenity --text-info \
2023-05-23 20:10:41 -07:00
--title="Sovran_SystemsOS Updater" \
2023-06-03 17:06:12 -07:00
--width=1110 \
--height=710
exit 1
fi
zenity --info \
--ellipsize \
--no-wrap \
--title="Sovran_SystemsOS Updater" \
--text="Complete! Please Reboot."
2023-05-22 14:32:15 -07:00
2023-06-03 17:06:12 -07:00
fi
2023-05-22 14:32:15 -07:00
exit 0