Files
HamPackServer/hampackserverupdate
2026-04-30 11:36:39 -06:00

79 lines
3.1 KiB
Bash
Executable File

#!/bin/bash
# Print the logo
print_logo() {
cat << "EOF"
██╗ ██╗ █████╗ ███╗ ███╗██████╗ █████╗ ██████╗██╗ ██╗
██║ ██║██╔══██╗████╗ ████║██╔══██╗██╔══██╗██╔════╝██║ ██╔╝
███████║███████║██╔████╔██║██████╔╝███████║██║ █████╔╝
██╔══██║██╔══██║██║╚██╔╝██║██╔═══╝ ██╔══██║██║ ██╔═██╗
██║ ██║██║ ██║██║ ╚═╝ ██║██║ ██║ ██║╚██████╗██║ ██╗
╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝
███████╗███████╗██████╗ ██╗ ██╗███████╗██████╗
██╔════╝██╔════╝██╔══██╗██║ ██║██╔════╝██╔══██╗
███████╗█████╗ ██████╔╝██║ ██║█████╗ ██████╔╝
╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██╔══╝ ██╔══██╗
███████║███████╗██║ ██║ ╚████╔╝ ███████╗██║ ██║
╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚══════╝╚═╝ ╚═╝
EOF
}
# Clear screen and show logo
clear
print_logo
echo "Updating Arch..."
sudo pacman -Syu
echo "Updating AUR..."
if ! yay -Sua 2>/dev/null; then
echo "yay -Sua returned an error. Let's rebuild YAY."
sudo pacman -R yay
cd /tmp
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
cd ..
rm -rf yay
cd
yay -Sua --noconfirm
else
yay -Sua --noconfirm
fi
# Updating the repo and installing...
echo "Updating HamPackServer..."
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