blob: 9a3c41d52699ef49546c2cb6be74f0fc955d2ef3 (
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
82
83
84
85
86
|
post_install() {
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/ffplayout -i \
-u admin \
-p admin \
-m contact@example.com \
--db "/usr/share/ffplayout/db" \
--storage "/var/lib/ffplayout/tv-media" \
--playlists "/var/lib/ffplayout/playlists" \
--public "/usr/share/ffplayout/public" \
--logs "/var/log/ffplayout" \
--mail-smtp "mail.example.org" \
--mail-user "admin@example.org" \
--mail-password "" \
--mail-starttls
chown -R ${sysUser}: "/usr/share/ffplayout"
chown -R ${sysUser}: "/var/lib/ffplayout"
else
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"
else
chown ${sysUser}: "/var/log/ffplayout"
fi
tab=" "
echo -e "1. Activate systemd service:"
echo -e " $ systemctl enable --now ffplayout"
echo -e "2. Use a reverse proxy for SSL, Port is 8787."
echo -e "3. Login with your browser, address without proxy would be: http://${IP}:8787, \n${tab}the default account is \"admin\" and the password is \"admin\"."
echo -e "4. Default location for playlists and media files are: /var/lib/ffplayout/."
echo -e "5. If you want to change the default global settings:"
echo -e " $ sudo rm -v /usr/share/ffplayout/db/*"
echo -e " $ sudo ffplayout -i"
}
post_upgrade() {
post_install
}
pre_remove() {
if [ -d /run/systemd/system ]; then
systemctl stop "ffplayout.service" >/dev/null || true
fi
}
post_remove() {
systemctl --system daemon-reload >/dev/null || true
systemctl unmask ffplayout.service >/dev/null || true
sysUser="ffpu"
if [ $(id -u $sysUser 2>/dev/null || echo -1) -ge 0 ]; then
userdel $sysUser
fi
}
|