ffplayout/debian/postinst
2023-11-07 13:45:43 +01:00

34 lines
896 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/ffpapi -i -d "${IP}:8787"
chown -R ${sysUser}: "/usr/share/ffplayout"
chown -R ${sysUser}: "/var/lib/ffplayout"
chown -R ${sysUser}: "/etc/ffplayout"
fi
if [ ! -d "/var/log/ffplayout" ]; then
mkdir "/var/log/ffplayout"
chown ${sysUser}: "/var/log/ffplayout"
fi