#!/usr/bin/env bash set -euo pipefail if [[ $EUID -ne 0 ]]; then echo "Requesting sudo..." exec sudo "$0" "$@" fi pacman -Syu installed=$(pacman -Q linux | awk '{print $2}' | sed 's/\.arch/-arch/') running=$(uname -r) if [[ "$running" == "$installed" ]]; then echo "updated, no reboot needed" else echo "updated, rebooting" reboot fi