-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate
More file actions
46 lines (35 loc) · 1.5 KB
/
Copy pathupdate
File metadata and controls
46 lines (35 loc) · 1.5 KB
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
41
42
43
44
45
46
#!/bin/bash
status=$(ping google.com -c 2 | grep -i "2 packets");
if [[ "100% packet loss" =~ $status ]]; then
echo "Internet not connected. Please connect and try again.";
else
echo -e "--- ping statistics ---\n$status\n";
while [ true ]; do
echo -n "Do you wish to update? [Y/n] ";
read input;
case $input in
"n" | "N")
echo "\nGoodbye";
break;
;;
"y" | "Y")
sudo echo -e "\nBeginning updates...";
# Updates apt packages
sudo apt update && sudo apt-get update;
# Upgrades apt packages
sudo apt upgrade -y && sudo apt-get upgrade -y;
# Same as above; also, updates system
sudo apt dist-upgrade -y && sudo apt-get dist-upgrade -y;
# Upgrade flatpak packages
sudo flatpak update -y;
# Removes unneeded packages
sudo apt autoremove -y && sudo apt-get autoremove -y;
break;
;;
*)
echo "\nInvalid input, please enter 'y' or 'n'.";
;;
esac
done
fi
exit;