-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathupdate.sh
62 lines (52 loc) · 1.55 KB
/
update.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
exit_status() {
if [ $? -eq 0 ]
then
echo
echo "-----------------------------------------"
echo "* Command Execution Was Successful. *"
echo "-----------------------------------------"
echo
else
echo
echo "-------------------------------------------------------"
echo " [Error] Process Command Execution Has Failed! "
echo "-------------------------------------------------------"
echo
read -p "The last command has exited with an error. Exit script? (yes/no)" answer
if [ "$answer" == "yes" ]
then
exit 1
fi
fi
}
start() {
echo
echo "--------------------------------------------"
echo "***>>> Upgrading The Operating System <<<***"
echo "--------------------------------------------"
echo
}
upgrade() {
sudo apt update;
exit_status
sudo apt upgrade;
exit_status
}
cleanUp() {
sudo apt autoremove;
exit_status
}
exitUpdate() {
echo
echo "-------------------------------------------------------"
echo ">>>> Operating System Update Has Been Completed <<<<"
echo "-------------------------------------------------------"
echo
exit
}
#calls the functions
start
upgrade
cleanUp
exitUpdate