#!/bin/bash if [ $UID -ne 0 ]; then echo "Keine Rootrechte." exit 1 fi RESTART= echo "Synchronisiere Repositorys" xbps-install -S > /dev/null mapfile -t updatedpkgs < <(xbps-install -un|awk '{print $1}') if [[ "${#updatedpkgs[@]}" -eq 0 ]]; then echo "Keine Updates" exit else echo "Es sind Updates da!" while read -p "Installieren? [Y/n] " answer; do test -z "${answer}" && answer="y" case "${answer}" in n*|N*|*o|*O) exit ;; y*|Y*|j*|J*) break ;; esac done fi echo "Lege Snapshot an" void-snapshot echo "Entferne nicht benutzte Pakete" xbps-remove -oy > /dev/null echo "Räume den Cache auf" xbps-remove -Oy > /dev/null echo "Installiere Updates" if ! xbps-install -uy; then echo "Update failed." exit fi if [[ "$(xcheckrestart)" ]]; then RESTART=1 fi for i in "${updatedpkgs[@]}"; do if grep -q "^linux" <<< "${i}"; then vkpurge list | head -n -1 | xargs -r vkpurge rm RESTART=1 fi done if [[ "${RESTART}" ]]; then echo ""; echo "Bitte den Computer neu starten." fi echo "" echo "Update fertig."