368d6fafea
Code backup
32 lines
702 B
Bash
32 lines
702 B
Bash
#!/bin/sh
|
|
|
|
#AutoUpdate--V1.2
|
|
|
|
host=$(hostname)
|
|
date=$(date +"%T")
|
|
|
|
red=$(tput setaf 1)
|
|
green=$(tput setaf 2)
|
|
yellow=$(tput setaf 3)
|
|
sgr=$(tput sgr 0)
|
|
|
|
if [ "$(id -u)" -ne 0 ]; then
|
|
echo "${red}This script must be run with root privileges${sgr}" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "${yellow}! AutoUpdate start !${sgr}"
|
|
notify-send "${date} - AutoUpdate start"
|
|
echo "${date} - AutoUpdate start"
|
|
|
|
# Update && Upgrade
|
|
|
|
apt update && apt full-upgrade -y
|
|
|
|
if [ -f /var/run/reboot-required ]; then
|
|
echo "A ${yellow}reboot${sgr} is required in order to proceed with the install." >&2
|
|
echo "Please ${yellow}reboot${sgr} and re-run this script to finish the install." >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "Update Success!" |