-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_requirements.sh
More file actions
executable file
·109 lines (91 loc) · 2.8 KB
/
install_requirements.sh
File metadata and controls
executable file
·109 lines (91 loc) · 2.8 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/bash
# detect system architecture
get_arch() {
local arch=$(uname -m)
case $arch in
x86_64)
echo "x86_64"
;;
aarch64)
echo "aarch64"
;;
armv7l)
echo "arm"
;;
*)
echo "unsupported"
;;
esac
}
# download and install ttyd
install_ttyd() {
local arch=$(get_arch)
if [ "$arch" = "unsupported" ]; then
echo "Error: Unsupported architecture $(uname -m)"
exit 1
fi
local version="1.6.3"
local filename="ttyd.x86_64"
# set filename based on architecture
case $arch in
x86_64)
filename="ttyd.x86_64"
;;
aarch64)
filename="ttyd.aarch64"
;;
arm)
filename="ttyd.arm"
;;
esac
echo "Downloading ttyd version ${version} for ${arch}..."
# create temporary directory
local temp_dir=$(mktemp -d)
cd "$temp_dir"
# Download the binary
if ! curl -L -o "$filename" "https://github.com/tsl0922/ttyd/releases/download/${version}/${filename}"; then
echo "Error: Failed to download ttyd"
rm -rf "$temp_dir"
exit 1
fi
# make it executable
chmod +x "$filename"
# move to /usr/local/bin so it can be executed by the program
if ! sudo mv "$filename" /usr/local/bin/ttyd; then
echo "Error: Failed to install ttyd"
rm -rf "$temp_dir"
exit 1
fi
# clean up
cd - > /dev/null
rm -rf "$temp_dir"
echo "Successfully installed ttyd version ${version}"
# verify installation
if command -v ttyd >/dev/null 2>&1; then
echo "ttyd is now available at: $(which ttyd)"
echo "Version: $(ttyd --version)"
else
echo "Error: ttyd installation verification failed"
exit 1
fi
}
# update dependencies
sudo apt-get update -y
# Install python and gstreamer dependencies
echo "Installing Python dependencies..."
sudo apt-get install python3 python3-venv -y
# For dbus-python
sudo apt-get install build-essential libdbus-glib-1-dev libdbus-1-dev libpython3-dev -y
echo "Installing GStreamer dependencies..."
sudo apt-get install -y libglib2.0-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-libav gstreamer1.0-plugins-ugly libimage-exiftool-perl
# Attempt to install ttyd through apt. If it fails, download from GitHub
echo "Installing ttyd..."
if ! sudo apt-get install -y ttyd; then
echo "ttyd not available in repositories, downloading from GitHub..."
install_ttyd
else
# Disable ttyd service
sudo systemctl disable ttyd
echo "ttyd installed from repositories"
fi
echo "Requirements installed."