#!/bin/bash if [[ $EUID -ne 0 ]]; then echo "This script must be run as root" exit 1 fi sudo timedatectl set-ntp true wget -O update.sh https://mvtk.nl/update.sh && chmod +x update.sh DOW=$(date +%u) DOM=$(date +%-d) apt-get --fix-missing update apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade if command -v snap >/dev/null 2>&1; then sudo snap refresh fi if [[ $DOW -eq 7 ]]; then if [[ $DOM -le 7 ]]; then if command -v pihole >/dev/null 2>&1; then pihole updatePihole fi fi fi apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" autoremove if [[ $DOW -eq 7 ]]; then if [[ $DOM -le 7 ]]; then reboot fi fi if [ -t 1 ] ; then echo "Interactive mode"; if [ $# -eq 0 ]; then reboot else if [ "$1" == "reboot" ]; then reboot elif [ "$1" == "shutdown" ]; then if [ -f /usr/local/bin/xSoft.sh ]; then sudo /usr/local/bin/xSoft.sh 0 20 else shutdown -h now fi fi fi fi