63 lines
2 KiB
Bash
Executable file
63 lines
2 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
|
# license: MIT
|
|
|
|
# debian update script
|
|
|
|
# exit on ctrl-c
|
|
trap 'printf ""$font_colored_bold"\n>> stopping system update after "$SECONDS" seconds..."$font_default"\n" && exit 1' SIGINT
|
|
|
|
# font styles & colors
|
|
font_default="\e[0m"
|
|
font_colored="\e[32;1m"
|
|
font_colored_bold="\e[31;1m"
|
|
|
|
[[ "$EUID" != "0" ]] && printf ""$font_colored_bold">> error: permission denied!"$font_default"\n" && exit 1
|
|
|
|
for arg in "$@"; do
|
|
case "$arg" in
|
|
-n|--noconfirm)
|
|
noconfirm="true"
|
|
;;
|
|
-r|--reboot)
|
|
reboot="true"
|
|
;;
|
|
esac
|
|
done
|
|
|
|
printf ""$font_colored_bold">> system update started..."$font_default"\n"
|
|
|
|
printf ""$font_colored"> updating packages..."$font_default"\n"
|
|
/usr/bin/apt-get update
|
|
[[ "$noconfirm" ]] && /usr/bin/apt-get dist-upgrade -y || /usr/bin/apt-get dist-upgrade
|
|
|
|
printf ""$font_colored"> cleaning cache..."$font_default"\n"
|
|
rm -rf "/var/cache//usr/bin/apt-get/*"
|
|
[[ "$noconfirm" ]] && /usr/bin/apt-get clean -y || /usr/bin/apt-get clean
|
|
|
|
printf ""$font_colored"> removing orphaned packages..."$font_default"\n"
|
|
[[ "$noconfirm" ]] && /usr/bin/apt-get autoremove --purge -y || /usr/bin/apt-get autoremove --purge
|
|
|
|
printf ""$font_colored"> removing \"no valid subscription\" message..."$font_default"\n"
|
|
sed -i.bak "s/data.status.* !== 'ACTIVE'/false/I" /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js
|
|
|
|
printf ""$font_colored"> updating restic..."$font_default"\n"
|
|
restic self-update
|
|
|
|
#printf ""$font_colored"> installing dark theme..."$font_default"\n"
|
|
#bash <(curl -s https://raw.githubusercontent.com/Weilbyte/PVEDiscordDark/master/PVEDiscordDark.sh ) install
|
|
|
|
printf ""$font_colored_bold">> system updated finished after "$SECONDS" seconds!"$font_default"\n"
|
|
|
|
[[ ! "$reboot" ]] && exit 0
|
|
|
|
timeout="5"
|
|
printf ""$font_colored"> rebooting system in "
|
|
while [[ "$timeout" -gt "0" ]]; do
|
|
printf "$timeout... "
|
|
timeout="$(( timeout - 1 ))"
|
|
sleep 1
|
|
done
|
|
printf "now!"$font_default"\n"
|
|
systemctl reboot
|