This commit is contained in:
teldra 2021-05-17 02:16:14 +02:00
parent ddd34a644c
commit 311728de73
2 changed files with 29 additions and 23 deletions

40
files/bin/void-update Normal file → Executable file
View File

@ -5,18 +5,22 @@ if [ $UID -ne 0 ]; then
exit 1
fi
RESTART=""
set -Eeuo pipefail
RESTART=
echo "Synchronisiere Repositorys"
echo "Synchronisiere Repositorys."
xbps-install -S > /dev/null
mapfile -t updatedpkgs < <(xbps-install -un|awk '{print $1}')
if [[ "${#updatedpkgs[@]}" -eq 0 ]]; then
#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 "${updatedpkgs}"
echo "Es sind Updates da!"
while read -p "Installieren? [Y/n] " answer; do
test -z "${answer}" && answer="y"
@ -29,36 +33,40 @@ else
;;
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"
echo "Entferne nicht benutzte Pakete."
xbps-remove -oy > /dev/null
echo "Räume den Cache auf"
echo "Räume den Cache auf."
xbps-remove -Oy > /dev/null
echo "Installiere Updates"
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
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
done
fi
if [[ "${RESTART}" ]]; then
echo ""; echo "Bitte den Computer neu starten."
echo ""; echo "Bitte den Computer neu starten!"
else
echo ""; echo "Kein neustart notwendig!"
fi
echo ""

View File

@ -10,13 +10,11 @@ if [ -f /etc/wireguard/wg0.conf ]; then
*)
case "$ACTION" in
up)
wg-quick up wg0
#wg set wg0 peer ZJwTV2l+N+vFwL0KFQb5xpAPqwVcf0YvEMFzTaIoAU8= endpoint home.rotce.de:51820
;;
down)
wg-quick down wg0
#ip link delete dev wg0
;;
wg-quick up wg0
;;
down)
wg-quick down wg0
;;
esac
;;
esac