-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathubuntu-updater.sh
40 lines (33 loc) · 1023 Bytes
/
ubuntu-updater.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
# if not root, run as root do not modify below unless making direct path to file in line 5.
if (( EUID != 0 )); then
sudo ~/ubuntu-updater.sh
exit
fi
echo "Mike Larios - Script Update: Oct'20"
echo ""
echo "#####################################"
echo "Initializing Updates..."
echo "#####################################"
sleep 5
clear
# Ensure all packages are configured correctly
echo "Auto-removing unnecessary stuff"
dpkg --configure -a
# Fix broken packages, if any
apt-get install -f
# Install and run unattended-upgrades if not already present
if ! dpkg -s unattended-upgrades >/dev/null 2>&1; then
apt-get install -y unattended-upgrades
unattended-upgrade
fi
# Update, upgrade, and clean in one sequence to minimize lock/unlock
apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y
apt-get autoremove -y --purge
apt-get autoclean
apt-get clean
sleep 5
clear
echo "#####################################"
echo "Finished !!!"
echo "#####################################"