2
2
3
3
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
4
4
5
- # shellcheck disable=2034,2059
6
5
true
7
6
SCRIPT_NAME=" Netdata"
8
7
SCRIPT_EXPLAINER=" Netdata is an open source tool designed to collect real-time metrics, \
@@ -20,19 +19,9 @@ source /var/scripts/fetch_lib.sh || source <(curl -sL https://raw.githubusercont
20
19
DEBUG=0
21
20
debug_mode
22
21
23
- # Must be root
22
+ # Must be sudo
24
23
root_check
25
24
26
- # Can't be run as pure root user
27
- if [ -z " $UNIXUSER " ]
28
- then
29
- msg_box " You can't run this script as a pure root user. You need to issue the following command:
30
- sudo -u regular_user sudo bash $SCRIPTS /menu.sh
31
-
32
- Then choose Additional Apps --> Netdata"
33
- exit 1
34
- fi
35
-
36
25
# Check if netdata is already installed
37
26
if ! [ -d /etc/netdata ]
38
27
then
42
31
# Ask for removal or reinstallation
43
32
reinstall_remove_menu " $SCRIPT_NAME "
44
33
# Removal
34
+ touch /etc/netdata/.environment
45
35
if [ -f /usr/src/netdata.git/netdata-uninstaller.sh ]
46
36
then
47
- if ! yes no | bash /usr/src/netdata.git/netdata-uninstaller.sh --force
37
+ if ! yes no | bash /usr/src/netdata.git/netdata-uninstaller.sh -y -f
48
38
then
49
39
rm -Rf /usr/src/netdata.git
50
40
fi
51
41
elif [ -f /usr/libexec/netdata-uninstaller.sh ]
52
42
then
53
- yes no | bash /usr/libexec/netdata-uninstaller.sh --yes
43
+ yes no | bash /usr/libexec/netdata-uninstaller.sh -y -f
54
44
elif [ -f /usr/libexec/netdata/netdata-uninstaller.sh ]
55
45
then
56
- bash /usr/libexec/netdata/netdata-uninstaller.sh --force --yes
46
+ bash /usr/libexec/netdata/netdata-uninstaller.sh -y -f
57
47
else
58
- check_command curl_to_dir https://raw.githubusercontent.com/netdata/netdata/master/packaging/installer netdata-uninstaller.sh $SCRIPTS
59
- check_command bash $SCRIPTS /netdata-uninstaller.sh --force --yes
48
+ curl_to_dir https://raw.githubusercontent.com/netdata/netdata/master/packaging/installer netdata-uninstaller.sh $SCRIPTS
49
+ check_command bash $SCRIPTS /netdata-uninstaller.sh -y -f
60
50
rm $SCRIPTS /netdata-uninstaller.sh
61
51
rm -rf /var/lib/netdata
62
52
fi
63
53
rm -rf /etc/netdata
54
+ apt-get purge netdata -y
55
+ apt-get autoremove -y
56
+ rm -rf /var/cache/netdata
57
+ rm -rf /var/log/netdata
64
58
# Show successful uninstall if applicable
65
59
removal_popup " $SCRIPT_NAME "
66
60
fi
67
61
68
62
# Install
69
63
is_process_running dpkg
70
64
is_process_running apt
71
- apt update -q4 & spinner_loading
72
- curl_to_dir https://my- netdata.io kickstart.sh $SCRIPTS
73
- sudo -u " $UNIXUSER " bash $SCRIPTS /kickstart.sh all --dont-wait --no-updates --stable-channel
65
+ apt-get update -q4 & spinner_loading
66
+ curl_to_dir https://get. netdata.cloud kickstart.sh $SCRIPTS
67
+ bash $SCRIPTS /kickstart.sh --reinstall-even-if-unsafe --non-interactive --no-updates --stable-channel --disable-cloud
74
68
rm -f $SCRIPTS /kickstart.sh
75
69
76
70
# Check Netdata instructions after script is done
0 commit comments