-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathup
executable file
·94 lines (60 loc) · 1.7 KB
/
up
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/bash
# Up -- Debian/Ubuntu Update Tool (Version 1.0)
# Advanced command to fully update system: "up" Adding the option "--clean" will
# remove orphaned packages and auto-clean the apt cache. (January, 2018)
# By Joe Collins www.ezeelinux.com (GNU/General Public License version 2.0)
# Set BASH to quit script and exit on errors:
set -e
# Functions:
update() {
echo "Starting full system update..."
sudo apt-get update
sudo apt-get dist-upgrade -yy
}
clean() {
echo "Cleaning up..."
sudo apt-get autoremove -yy
sudo apt-get autoclean
}
leave() {
echo "--------------------"
echo "- Update Complete! -"
echo "--------------------"
exit
}
up-help() {
cat << _EOF_
Up is a tool that automates the update procedure for Debian and Ubuntu based
Linux systems.
Commands:
up = full system update.
Running "up" with no options will update the apt cache and then perform a
full distribution update automatically.
up --clean = full system update with cleanup.
Adding the "--clean" option will invoke the apt commands to search for and
remove locally cached packages that are no longer in the repositories and
remove orphaned packages that are no longer needed by programs.
up --help = shows this help page.
By Joe Collins www.ezeelinux.com (GNU/General Public License version 2.0)
_EOF_
}
# Execution.
# Tell 'em who we are...
echo "Up -- Debian/Ubuntu Update Tool (Version 1.0)"
# Update and clean:
if [ "$1" == "--clean" ]; then
update
clean
leave
fi
if [ "$1" == "--help" ]; then
up-help
exit
fi
# Check for invalid argument
if [ -n "$1" ]; then
echo "Up Error: Invalid argument. Try 'up --help' for more info." >&2
exit 1
fi
update
leave