-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
82 lines (66 loc) · 2.3 KB
/
Copy pathinstall.sh
File metadata and controls
82 lines (66 loc) · 2.3 KB
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
#!/bin/bash
set -e
if [ -n "${1:-}" ] && [ -f "$1" ]; then
ZIP="$1"
echo "Installing from local zip: ${ZIP}"
else
TAG=${1:-latest}
echo "Downloading liveserver.zip (tag: ${TAG})..."
curl --remote-name \
--location \
https://github.com/SuperGreenLab/SuperGreenLive2/releases/download/$TAG/liveserver.zip
ZIP="liveserver.zip"
fi
configure_swap() {
local VAR="CONF_SWAPSIZE"
local VALUE="1024"
local FILE="/etc/dphys-swapfile"
# Check total RAM in MB
local TOTAL_RAM=$(free -m | awk '/^Mem:/{print $2}')
if [ "$TOTAL_RAM" -gt 1024 ]; then
echo "System has more than 1GB of RAM ($TOTAL_RAM MB). Skipping swap size modification."
return
fi
# Ensure the file exists, otherwise create it
if [ ! -f "$FILE" ]; then
echo "$FILE not found. Creating file."
sudo touch "$FILE"
fi
# Modify the CONF_SWAPSIZE value or append it if not present
if grep -q "^#\?\s*$VAR=" "$FILE"; then
sudo sed -i "s/^#\?\s*$VAR=.*/$VAR=$VALUE/" "$FILE"
else
echo "$VAR=$VALUE" | sudo tee -a "$FILE" > /dev/null
fi
echo "Swap size configured to $VALUE MB."
}
apt-get update
apt-get --allow-releaseinfo-change update
apt-get install --yes dphys-swapfile
dphys-swapfile swapoff 2>/dev/null || true
configure_swap
dphys-swapfile setup
dphys-swapfile swapon
apt-get install --yes \
fswebcam ffmpeg libmagickwand-7.q16-10 \
python3-opencv \
python3-libcamera python3-picamera2
apt --reinstall install --yes libcamera-apps-lite
# curl -OL https://github.com/supergreenlab/SuperGreenLive2/releases/download/latest/liveserver.zip
unzip -o "$ZIP"
mkdir --parents /usr/local/share/appbackend /usr/local/share/appbackend_static
cp --recursive liveserver/assets/* /usr/local/share/appbackend
cp --recursive liveserver/static/* /usr/local/share/appbackend_static
if [ "$(dpkg --print-architecture)" = "arm64" ]; then
cp liveserver/liveserver_arm64 /usr/local/bin/liveserver
elif [ "$(uname -m)" = "armv6l" ]; then
cp liveserver/liveserver_arm32v6 /usr/local/bin/liveserver
else
cp liveserver/liveserver_arm32 /usr/local/bin/liveserver
fi
cp liveserver/tools/* /usr/local/bin/
mkdir --parents /etc/liveserver
cp liveserver/liveserver.toml /etc/liveserver/liveserver.toml
cp liveserver/liveserver.service /etc/systemd/system/
systemctl enable liveserver
systemctl start liveserver