blob: 6c7705849bfdda5ff56d0d9e74e99eef8e93a889 (
plain)
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
|
post_install() {
systemctl unmask ffpapi.service >/dev/null || true
systemctl unmask ffplayout.service >/dev/null || true
systemctl --system daemon-reload >/dev/null || true
sysUser="ffpu"
IP=$(ip route get 1.2.3.4 | awk '{if($7 !~ /^[[:space:]]*$/) print $7}')
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
useradd -m --system $sysUser || 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 "/var/lib/ffplayout/playlists"
mkdir -p "/var/lib/ffplayout/tv-media"
/usr/bin/ffpapi -i -d "${IP}:8787"
chown -R ${sysUser}: "/usr/share/ffplayout"
chown -R ${sysUser}: "/var/lib/ffplayout"
chown -R ${sysUser}: "/etc/ffplayout"
else
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"
else
chown ${sysUser}: "/var/log/ffplayout"
fi
echo "1. activate systemd services:"
echo " - 'systemctl enable ffplayout'"
echo " - 'systemctl enable --now ffpapi'"
echo "2. add admin user to ffpapi:"
echo " - 'ffpapi -a'"
echo "3. use a reverse proxy for SSL, Port is **8787**."
echo "4. login with your browser, address without proxy would be: **http://${IP}:8787**"
echo "5. Default location for playlists and media files are: **/var/lib/ffplayout/**."
}
post_upgrade() {
post_install
}
pre_remove() {
if [ -d /run/systemd/system ]; then
for service in $(systemctl list-units --type service --all --no-legend --plain | grep 'ffplayout' | awk '{print $1}'); do
systemctl stop "$service" >/dev/null || true
done
fi
}
post_remove() {
rm -f /usr/lib/systemd/system/ffpapi.service || true
rm -f /usr/lib/systemd/system/ffplayout* || true
systemctl --system daemon-reload >/dev/null || true
systemctl unmask ffpapi.service ffplayout.service >/dev/null || true
sysUser="ffpu"
if [ $(id -u $sysUser 2>/dev/null || echo -1) -ge 0 ]; then
userdel $sysUser
fi
}
|