ffplayout/debian/postinst
2024-06-12 10:16:00 +02:00

33 lines
857 B
Bash

#!/bin/sh
#DEBHELPER#
sysUser="ffpu"
if [ -f /run/.containerenv ] || [ -f /run/.dockerenv ] || [ -f /.dockerenv ] || [ -f /.dockerinit ]; then
sysUser="root"
fi
if [ ! $(id -u $sysUser 2>/dev/null || echo -1) -ge 0 ]; then
adduser --system --create-home $sysUser > /dev/null || adduser --system --home "/home/$sysUser" $sysUser
fi
if [ ! -d "/usr/share/ffplayout/db" ]; then
mkdir "/usr/share/ffplayout/db"
mkdir -p "/usr/share/ffplayout/public/live"
mkdir -p "/var/lib/ffplayout/playlists"
mkdir -p "/var/lib/ffplayout/tv-media"
IP=$(hostname -I | cut -d ' ' -f1)
/usr/bin/ffplayout -i -d "${IP}:8787"
chown -R ${sysUser}: "/usr/share/ffplayout"
chown -R ${sysUser}: "/var/lib/ffplayout"
fi
if [ ! -d "/var/log/ffplayout" ]; then
mkdir "/var/log/ffplayout"
chown ${sysUser}: "/var/log/ffplayout"
fi