75 lines
1.3 KiB
Plaintext
75 lines
1.3 KiB
Plaintext
|
#!/bin/bash
|
||
|
|
||
|
if [ $UID -ne 0 ]; then
|
||
|
echo "Keine Rootrechte."
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
RESTART=""
|
||
|
|
||
|
set -Eeuo pipefail
|
||
|
|
||
|
RESTART=
|
||
|
echo "Synchronisiere Repositorys."
|
||
|
xbps-install -S > /dev/null
|
||
|
|
||
|
#mapfile -t updatedpkgs < <(xbps-install -un|awk '{print $1}')
|
||
|
updatedpkgs="$(xbps-install -un|awk '{print $1}')"
|
||
|
|
||
|
if [[ -z "${updatedpkgs}" ]]; then
|
||
|
echo "Keine Updates"
|
||
|
exit
|
||
|
else
|
||
|
echo "${updatedpkgs}"
|
||
|
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
|
||
|
if grep -q -Pe '^(?!.*linux-).*^linux' <<< "${updatedpkgs}"; then
|
||
|
RESTART=1
|
||
|
fi
|
||
|
fi
|
||
|
|
||
|
echo "Lege Snapshot an."
|
||
|
void-snapshot update
|
||
|
|
||
|
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 [[ "$RESTART" ]]; then
|
||
|
echo "Lösche alte Kernel."
|
||
|
vkpurge list | head -n -1 | xargs -r vkpurge rm
|
||
|
else
|
||
|
echo "Überprüfe ob neustart notwenidig ist."
|
||
|
if [[ "$(xcheckrestart)" ]]; then
|
||
|
RESTART=1
|
||
|
fi
|
||
|
fi
|
||
|
|
||
|
if [[ "${RESTART}" ]]; then
|
||
|
echo ""; echo "Bitte den Computer neu starten!"
|
||
|
else
|
||
|
echo ""; echo "Kein neustart notwendig!"
|
||
|
fi
|
||
|
|
||
|
echo ""
|
||
|
echo "Update fertig."
|
||
|
|