From 864f97b473275dc3659dc20d706016ceed659975 Mon Sep 17 00:00:00 2001 From: David Young Date: Thu, 30 Apr 2026 11:36:39 -0600 Subject: [PATCH] Better updates --- hampackserverrefresh | 38 +++++++++++++++++++++++++++------ hampackserverupdate | 50 ++++++++++++++++++++++++++++++++++++-------- install.sh | 21 ++++++++++++++++++- 3 files changed, 93 insertions(+), 16 deletions(-) diff --git a/hampackserverrefresh b/hampackserverrefresh index 4331b2c..6ab1036 100755 --- a/hampackserverrefresh +++ b/hampackserverrefresh @@ -2,16 +2,23 @@ # Print the logo print_logo() { - cat << "EOF" - + cat << "EOF" ██╗ ██╗ █████╗ ███╗ ███╗██████╗ █████╗ ██████╗██╗ ██╗ ██║ ██║██╔══██╗████╗ ████║██╔══██╗██╔══██╗██╔════╝██║ ██╔╝ - ███████║███████║██╔████╔██║██████╔╝███████║██║ █████╔╝ - ██╔══██║██╔══██║██║╚██╔╝██║██╔═══╝ ██╔══██║██║ ██╔═██╗ + ███████║███████║██╔████╔██║██████╔╝███████║██║ █████╔╝ + ██╔══██║██╔══██║██║╚██╔╝██║██╔═══╝ ██╔══██║██║ ██╔═██╗ ██║ ██║██║ ██║██║ ╚═╝ ██║██║ ██║ ██║╚██████╗██║ ██╗ - ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ - + ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ + + ███████╗███████╗██████╗ ██╗ ██╗███████╗██████╗ + ██╔════╝██╔════╝██╔══██╗██║ ██║██╔════╝██╔══██╗ + ███████╗█████╗ ██████╔╝██║ ██║█████╗ ██████╔╝ + ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██╔══╝ ██╔══██╗ + ███████║███████╗██║ ██║ ╚████╔╝ ███████╗██║ ██║ + ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚══════╝╚═╝ ╚═╝ + + EOF } @@ -23,3 +30,22 @@ print_logo echo "Let's get the lastest changes to HamPack..." wget -qO- https://gitea.young.computer/david/HamPackServer/raw/branch/main/install.sh | bash + +# Check whether the running kernel matches the installed modules — if not, a +# newer kernel was installed during this run and a reboot is required +if ! ls /usr/lib/modules/$(uname -r) > /dev/null 2>&1; then + echo "A newer kernel has been installed, a reboot is recommended." + read -rp "Reboot now? [y/N] " response + case "$response" in + [yY][eE][sS]|[yY]) + echo "Rebooting..." + sudo reboot + ;; + *) + echo "Reboot skipped. Please remember to reboot when convenient." + exit 0 + ;; + esac +else + echo "Kernel is up to date, no reboot needed. You may want to consider a reboot if other significant software was updated or installed." +fi diff --git a/hampackserverupdate b/hampackserverupdate index 29431ab..4b5fd4e 100755 --- a/hampackserverupdate +++ b/hampackserverupdate @@ -2,16 +2,23 @@ # Print the logo print_logo() { - cat << "EOF" - + cat << "EOF" ██╗ ██╗ █████╗ ███╗ ███╗██████╗ █████╗ ██████╗██╗ ██╗ ██║ ██║██╔══██╗████╗ ████║██╔══██╗██╔══██╗██╔════╝██║ ██╔╝ - ███████║███████║██╔████╔██║██████╔╝███████║██║ █████╔╝ - ██╔══██║██╔══██║██║╚██╔╝██║██╔═══╝ ██╔══██║██║ ██╔═██╗ + ███████║███████║██╔████╔██║██████╔╝███████║██║ █████╔╝ + ██╔══██║██╔══██║██║╚██╔╝██║██╔═══╝ ██╔══██║██║ ██╔═██╗ ██║ ██║██║ ██║██║ ╚═╝ ██║██║ ██║ ██║╚██████╗██║ ██╗ - ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ - + ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ + + ███████╗███████╗██████╗ ██╗ ██╗███████╗██████╗ + ██╔════╝██╔════╝██╔══██╗██║ ██║██╔════╝██╔══██╗ + ███████╗█████╗ ██████╔╝██║ ██║█████╗ ██████╔╝ + ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██╔══╝ ██╔══██╗ + ███████║███████╗██║ ██║ ╚████╔╝ ███████╗██║ ██║ + ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚══════╝╚═╝ ╚═╝ + + EOF } @@ -40,7 +47,32 @@ else yay -Sua --noconfirm fi -# Will need to update the downloaded binaries and the compiled apps -# In the area below... +# Updating the repo and installing... +echo "Updating HamPackServer..." -echo "Done. You probably want to reboot your system..." +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +echo "Pulling latest HamPackServer repo..." +git -C "$SCRIPT_DIR" pull + +echo "Running install.sh..." +bash "$SCRIPT_DIR/install.sh" + +# Check whether the running kernel matches the installed modules — if not, a +# newer kernel was installed during this run and a reboot is required +if ! ls /usr/lib/modules/$(uname -r) > /dev/null 2>&1; then + echo "A newer kernel has been installed, a reboot is recommended." + read -rp "Reboot now? [y/N] " response + case "$response" in + [yY][eE][sS]|[yY]) + echo "Rebooting..." + sudo reboot + ;; + *) + echo "Reboot skipped. Please remember to reboot when convenient." + exit 0 + ;; + esac +else + echo "Kernel is up to date, no reboot needed. You may want to consider a reboot if other significant software was updated or installed." +fi diff --git a/install.sh b/install.sh index ecd79b5..ad54e77 100755 --- a/install.sh +++ b/install.sh @@ -219,4 +219,23 @@ case "$response" in *) echo "Reboot skipped. Please reboot when convenient." ;; -esac \ No newline at end of file +esac + +# Check whether the running kernel matches the installed modules — if not, a +# newer kernel was installed during this run and a reboot is required +if ! ls /usr/lib/modules/$(uname -r) > /dev/null 2>&1; then + echo "A newer kernel has been installed, a reboot is recommended." + read -rp "Reboot now? [y/N] " response + case "$response" in + [yY][eE][sS]|[yY]) + echo "Rebooting..." + sudo reboot + ;; + *) + echo "Reboot skipped. Please remember to reboot when convenient." + exit 0 + ;; + esac +else + echo "Kernel is up to date, no reboot needed. You may want to consider a reboot if other significant software was updated or installed." +fi \ No newline at end of file