Skip to content

Commit df849f2

Browse files
author
Luka Gulin
committed
add unattened upgrades
1 parent 389d09d commit df849f2

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

scripts/dappnode_install_pre.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff 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
109120
host_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
165176
fi
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

0 commit comments

Comments
 (0)