File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -105,6 +105,17 @@ install_iptables () {
105105 fi
106106}
107107
108+ # UNATTENDED UPGRADES INSTALLATION: for upgrading system automatically
109+ install_unattendedupgrades () {
110+ apt-get update -y
111+ apt-get install unattended-upgrades -y | tee -a $LOG_FILE
112+ if unattended-upgrades -h > /dev/null 2>&1 ; then
113+ echo -e " \e[32m \n\n Verified unattended-upgrades installation \n\n \e[0m" 2>&1 | tee -a $LOG_FILE
114+ else
115+ echo -e " \e[31m \n\n WARNING: unattended-upgrades not installed, upgrades must be done manually! \n\n \e[0m" 2>&1 | tee -a $LOG_FILE
116+ fi
117+ }
118+
108119# HOST UPDATE
109120host_update () {
110121 apt-get update 2>&1 | tee -a $LOG_FILE
@@ -164,6 +175,13 @@ else
164175 install_lsof 2>&1 | tee -a $LOG_FILE
165176fi
166177
178+ # Only install unatended upgrades if needed
179+ if unattended-upgrades -h > /dev/null 2>&1 ; then
180+ echo -e " \e[32m \n\n unattended-upgrades is already installed \n\n \e[0m" 2>&1 | tee -a $LOG_FILE
181+ else
182+ instal_unattendedupgrades 2>&1 | tee -a $LOG_FILE
183+ fi
184+
167185# Check connectivity
168186{ [ -f /etc/network/interfaces ] && grep " iface en.* inet dhcp" /etc/network/interfaces & > /dev/null; } || { echo " Interfaces not found" ; exit 1; }
169187
You can’t perform that action at this time.
0 commit comments