-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsh.txt
70 lines (55 loc) · 1.42 KB
/
sh.txt
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
#!/bin/bash
# Apache License Version 2.0, January 2004
# https://github.com/swapbyt3s/zenit/blob/master/LICENSE.md
set -e
if [ "$EUID" -ne 0 ]; then
echo "Please run as root"
exit
fi
if ! [[ "${OSTYPE}" == "linux"* ]]; then
echo "Only works on Linux amd64."
exit
fi
if ! type "wget" > /dev/null; then
echo "The program 'wget' is currently not installed, please install it to continue."
exit
fi
FILE="zenit-linux_amd64.tar.gz"
TAG=$(wget -qO- "https://api.github.com/repos/swapbyt3s/zenit/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
if [ -f /etc/systemd/system/zenit.service ]; then
/usr/bin/zenit --uninstall
fi
if [ -f /etc/init/zenit.conf ]; then
/usr/bin/zenit --uninstall
fi
if [ -f /usr/local/bin/zenit ]; then
rm -f /usr/local/bin/zenit
fi
if [ -L /usr/bin/zenit ]; then
rm -f /usr/bin/zenit
fi
if [ -n "${FILE}" ]; then
wget -qO- "https://github.com/swapbyt3s/zenit/releases/download/${TAG}/${FILE}" | tar xz -C /usr/local/bin/
fi
if [ -f /usr/local/bin/zenit ]; then
ln -s /usr/local/bin/zenit /usr/bin/zenit
fi
if [ ! -f /etc/zenit/zenit.yaml ]; then
mkdir -p /etc/zenit/
/usr/bin/zenit --config > /etc/zenit/zenit.yaml
fi
if [ -d "/etc/logrotate.d" ]; then
if [ ! -f /etc/logrotate.d/zenit ]; then
cat > /etc/logrotate.d/zenit <<EOL
/var/log/zenit.* {
rotate 7
daily
missingok
notifempty
copytruncate
compress
}
EOL
fi
fi
/usr/bin/zenit --install