-
Notifications
You must be signed in to change notification settings - Fork 19
/
update-framebuffer.sh
65 lines (53 loc) · 1.68 KB
/
update-framebuffer.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
#!/bin/bash
set -x
FB_VERSION="v$(curl --connect-timeout 10 -L https://raw.githubusercontent.com/kubesail/pibox-framebuffer/main/VERSION.txt)"
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
if [[ -f /etc/os-release ]]; then
if grep Debian /etc/os-release; then
apt-get install -yqq lvm2 parted fonts-piboto
fi
fi
set -e
if [[ -f /etc/systemd/system/pibox-framebuffer.service ]]; then
echo "stopping pibox-framebuffer service"
service pibox-framebuffer stop
fi
architecture="arm64"
case $(uname -m) in
x86_64) architecture="amd64" ;;
arm) dpkg --print-architecture | grep -q "arm64" && architecture="arm64" || architecture="arm" ;;
esac
FB_PATH=/opt/kubesail/pibox-framebuffer-$FB_VERSION
mkdir -p /opt/kubesail/
echo "downloading pibox-framebuffer $FB_VERSION"
if [[ ! -f $FB_PATH ]]; then
curl --connect-timeout 10 -sLo $FB_PATH https://github.com/kubesail/pibox-framebuffer/releases/download/$FB_VERSION/pibox-framebuffer-linux-${architecture}-$FB_VERSION
chmod +x $FB_PATH
fi
if [[ -f /opt/kubesail/pibox-framebuffer ]]; then
rm -v /opt/kubesail/pibox-framebuffer
fi
if [[ ! -f /opt/kubesail/pibox-framebuffer ]]; then
ln -vs $FB_PATH /opt/kubesail/pibox-framebuffer
fi
chown -R 989 /opt/kubesail/ || true
if [[ ! -f /etc/systemd/system/pibox-framebuffer.service ]]; then
cat <<'EOF' > /etc/systemd/system/pibox-framebuffer.service
[Unit]
Requires=multi-user.target
After=multi-user.target
[Service]
ExecStart=/opt/kubesail/pibox-framebuffer
Restart=always
RestartSec=5s
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable pibox-framebuffer.service
fi
echo "starting pibox-framebuffer service"
service pibox-framebuffer start