44 lines
1.6 KiB
Bash
Executable File
44 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
case "$1" in
|
|
configure|abort-upgrade)
|
|
id -u vid &>/dev/null || useradd --system -m -s /bin/bash vid
|
|
|
|
# Setup virtualenv for python dependencies to comply with PEP 668 on Debian 12 / Ubuntu 24.04+
|
|
VENV_DIR="/usr/share/hyperdeck/venv"
|
|
if [ ! -d "$VENV_DIR" ]; then
|
|
python3 -m venv "$VENV_DIR" 2>/dev/null || python3 -m venv --system-site-packages "$VENV_DIR" 2>/dev/null || true
|
|
fi
|
|
|
|
if [ -x "$VENV_DIR/bin/pip" ]; then
|
|
"$VENV_DIR/bin/pip" install -q -r /usr/share/hyperdeck/requirements.txt || true
|
|
chown -R vid:vid "$VENV_DIR" || true
|
|
else
|
|
pip3 install -r /usr/share/hyperdeck/requirements.txt --break-system-packages 2>/dev/null || \
|
|
pip3 install -r /usr/share/hyperdeck/requirements.txt 2>/dev/null || true
|
|
fi
|
|
|
|
FILE="/etc/hyperdeck/config.json"
|
|
SOURCEFILE="/usr/share/hyperdeck/config.json.orig"
|
|
if [ ! -f "$FILE" ]; then
|
|
mkdir -p /etc/hyperdeck/
|
|
echo "Copy default config"
|
|
cp "$SOURCEFILE" "$FILE"
|
|
chmod 744 "$FILE"
|
|
fi
|
|
|
|
# Register and enable systemd service if running under systemd
|
|
if systemctl is-system-running &>/dev/null || [ -d /run/systemd/system ]; then
|
|
systemctl daemon-reload 2>/dev/null || true
|
|
systemctl enable hyperdeck 2>/dev/null || true
|
|
fi
|
|
|
|
mkdir -p /var/log/hyperdeck/
|
|
chown vid:vid "/var/log/hyperdeck/" 2>/dev/null || true
|
|
|
|
echo "Installation done"
|
|
;;
|
|
esac
|
|
exit 0
|