-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjcb.sh
174 lines (143 loc) · 2.77 KB
/
jcb.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
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#!/bin/bash
# My version of Up forked to do other things called JCB -- Debian/Ubuntu Update+ Tool (Version 2.0)
# By Carlton Bryan w4jcb.com (GNU/General Public License version 2.0)
# Set BASH to quit script and exit on errors:
set -e
# Functions:
clear #Clears the screen
update() {
echo "Starting system update..."
sudo apt update
sudo apt dist-upgrade -yy
}
upgrade() {
echo "starting full system upgrade..."
sudo apt update && sudo apt upgrade -y
}
clean() {
echo "Cleaning up..."
sudo apt autoremove -yy
sudo apt autoclean
}
leave() {
clear
echo "--------------------"
echo "- Exiting JCB… Goodbye! -"
echo "--------------------"
exit
}
up_help() {
clear #Clears the screen
cat << _EOF_
Up is a tool that automates the update procedure for Debian and Ubuntu based
Linux systems.
By Carlton Bryan www.w4jcb.com (GNU/General Public License version 2.0)
_EOF_
}
system_info()
{
# Temporary function stub
echo "function system_info"
lscpu
}
show_uptime()
{
# Temporary function stub
echo "function show_uptime"
uptime
}
drive_space()
{
# Temporary function stub
echo "function drive_space"
df
}
home_space()
{
# Temporary function stub
echo "function home_space"
echo "Home directory space by user"
echo "Bytes Directory"
sudo du -s /home/* | sort -nr
}
pas()
{
sleep 1
echo
echo
read -rp "Press Enter to continue"
}
show_usb()
{
# shows USB stuff
echo "Function show_usb"
echo "To show any ttyUSB stuff"
python3 -m serial.tools.list_ports
}
show_OS()
{
# shows OS Stuff
echo "Function show_OS"
hostnamectl
}
show_sys_monitor()
{
echo "starting system monitor"
gnome-system-monitor
}
run_bu()
{
bu
}
change_desktops()
{
echo "Starting alternate Desktop Manager"
sudo update-alternatives --config x-session-manager
}
down_load_new_desktops()
{
echo "Starting Tasksel"
sudo tasksel
}
# Execution.
selection="1"
until [ $selection = " " ]; do
cat << _EOF_
Press the number of your choice:
1 – Update.
2 - Upgrade.
3 – Clean.
4 - Help.
5 - System Info.
6 - Show Uptime.
7 - Drive Space.
8 - Home Space.
9 - Show USB.
10 - Show OS.
11 - System Monitor.
12 - Run BU Backup.
13 - Change Desktops.
14 - Download New Desktops.
0 – Exit JCB.
Each number corresponds to a script function or a set of simple commands.
_EOF_
read -r selection #read -n 1 -s selection;
case $selection in
1) update leave;pas;clear;;
2) upgrade leave;pas;clear;;
3) clean update leave;pas;clear;;
4) up_help;pas;clear;;
5) system_info;pas;clear;;
6) show_uptime;pas;clear;;
7) df;pas;clear;;
8) home_space;pas;clear;;
9) show_usb;pas;clear;;
10) show_OS;pas;clear;;
11) show_sys_monitor;pas;clear;;
12) run_bu;pas;clear;;
13) change_desktops;pas;clear;;
14) down_load_new_desktops;pas;clear;;
0) leave;pas;clear;;
*) echo "Not a valid choice: Please try again.";pas;clear;;
esac
done