change to update format

This commit is contained in:
David Young
2026-10-23 08:04:42 -06:00
parent 0b2ac8ca29
commit 872ad4b831
14 changed files with 663 additions and 111 deletions
+49 -2
View File
@@ -23,6 +23,53 @@ install_packages() {
if [ ${#to_install[@]} -ne 0 ]; then
echo "Installing: ${to_install[*]}"
yay -S --noconfirm "${to_install[@]}"
yay -S --noconfirm --answerdiff=None --answeredit=None --answerclean=None "${to_install[@]}"
fi
}
}
# Function to remove pacman/AUR packages if installed
remove_packages() {
local packages=("$@")
local to_remove=()
for pkg in "${packages[@]}"; do
if is_installed "$pkg"; then
to_remove+=("$pkg")
fi
done
if [ ${#to_remove[@]} -ne 0 ]; then
echo "Removing: ${to_remove[*]}"
sudo pacman -Rns --noconfirm "${to_remove[@]}"
fi
}
# Function to enable systemd services if not already enabled
enable_services() {
for service in "$@"; do
if ! systemctl is-enabled "$service" &> /dev/null; then
echo "Enabling $service..."
sudo systemctl enable "$service"
else
echo "$service is already enabled."
fi
done
}
# Output of the last update's pacman -Su, written by updates.d/10-pacman.sh
PACMAN_UPDATE_LOG="$HOME/.local/state/miniserver/pacman-update.log"
# True if the last update rebuilt the initramfs and mkinitcpio reported a
# failure. Rebooting then can leave the machine unbootable.
initramfs_build_failed() {
[ -f "$PACMAN_UPDATE_LOG" ] || return 1
grep -q "Updating linux initcpios" "$PACMAN_UPDATE_LOG" || return 1
grep -q "==> ERROR" "$PACMAN_UPDATE_LOG" || ! grep -q "Image generation successful" "$PACMAN_UPDATE_LOG"
}
# Install a script atomically (copy to a temp file, then rename over the target)
# so a copy of it that is running right now keeps reading the old file
install_script() {
local tmp
tmp="$(mktemp "$2.XXXXXX")" && cp "$1" "$tmp" && chmod 755 "$tmp" && mv -f "$tmp" "$2"
}