forked from nicolargo/glancesautoinstall
-
Notifications
You must be signed in to change notification settings - Fork 0
/
uninstall.sh
37 lines (34 loc) · 1.13 KB
/
uninstall.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
#!/usr/bin/env bash
#
# Glances uninstall script
# It will uninstall Glances and all its dependancies installed with
# the GlancesAutoInstall script
#
# Version: MASTER branch
# Author: Nicolas Hennion (aka) Nicolargo
#
# Execute a command as root (or sudo)
do_with_root() {
# already root? "Just do it" (tm).
if [[ `whoami` = 'root' ]]; then
$*
elif [[ -x /bin/sudo || -x /usr/bin/sudo ]]; then
echo "sudo $*"
sudo $*
else
echo "Glances requires root privileges to uninstall."
echo "Please run this script as root."
exit 1
fi
}
# Install or ugrade Glances from the Pipy repository
if [[ -x /usr/local/bin/glances || -x /usr/bin/glances ]]; then
echo "Uninstall Glances dependancies"
DEPS="setuptools glances[action,batinfo,browser,cpuinfo,chart,docker,export,folders,gpu,ip,raid,snmp,web,wifi]"
do_with_root pip uninstall $DEPS
echo "Uninstall Glances"
do_with_root pip install uninstall glances
else
echo "Error: Glances is not found in your system"
echo "Note: This script only work if you have installed Glances with the GlancesAutoInstall script"
fi