create system user and default folders

This commit is contained in:
jb-alvarado 2022-07-19 12:11:14 +02:00
parent 94816903c3
commit 08a814d50d
6 changed files with 25 additions and 27 deletions

View File

@ -1,5 +1,5 @@
# give user www-data permission to control the ffplayout systemd service
# give user ffpu permission to control the ffplayout systemd service
www-data ALL = NOPASSWD: /usr/bin/systemctl start ffplayout, /usr/bin/systemctl stop ffplayout, /usr/bin/systemctl restart ffplayout, /usr/bin/systemctl status ffplayout, /usr/bin/systemctl is-active ffplayout, /usr/bin/systemctl enable ffplayout, /usr/bin/systemctl disable ffplayout
ffpu ALL = NOPASSWD: /usr/bin/systemctl start ffplayout.service, /usr/bin/systemctl stop ffplayout.service, /usr/bin/systemctl restart ffplayout.service, /usr/bin/systemctl status ffplayout.service, /usr/bin/systemctl is-active ffplayout.service, /usr/bin/systemctl enable ffplayout.service, /usr/bin/systemctl disable ffplayout.service
www-data ALL = NOPASSWD: /usr/bin/systemctl start ffplayout@*, /usr/bin/systemctl stop ffplayout@*, /usr/bin/systemctl restart ffplayout@*, /usr/bin/systemctl status ffplayout@*, /usr/bin/systemctl is-active ffplayout@*, /usr/bin/systemctl enable ffplayout@*, /usr/bin/systemctl disable ffplayout@*
ffpu ALL = NOPASSWD: /usr/bin/systemctl start ffplayout@*, /usr/bin/systemctl stop ffplayout@*, /usr/bin/systemctl restart ffplayout@*, /usr/bin/systemctl status ffplayout@*, /usr/bin/systemctl is-active ffplayout@*, /usr/bin/systemctl enable ffplayout@*, /usr/bin/systemctl disable ffplayout@*

View File

@ -6,8 +6,8 @@ After=network.target remote-fs.target
ExecStart=/usr/bin/ffpapi -l 127.0.0.1:8000
Restart=always
RestartSec=1
User=www-data
Group=www-data
User=ffpu
Group=ffpu
[Install]
WantedBy=multi-user.target

View File

@ -7,8 +7,8 @@ ExecStart=/usr/bin/ffplayout
Restart=always
RestartSec=1
KillMode=mixed
User=www-data
Group=www-data
User=ffpu
Group=ffpu
[Install]
WantedBy=multi-user.target

View File

@ -85,7 +85,7 @@ playlist:
should always start at the begin. 'length' represent the target length from
playlist, when is blank real length will not consider. 'infinit true' works with
single playlist file and loops it infinitely.
path: /playlists
path: /var/lib/ffplayout/playlists
day_start: "5:59:25"
length: "24:00:00"
infinit: false
@ -94,8 +94,8 @@ storage:
help_text: Play ordered or randomly files from path. 'filler_clip' is for fill
the end to reach 24 hours, it will loop when is necessary. 'extensions' search
only files with this extension. Set 'shuffle' to 'True' to pick files randomly.
path: "/mediaStorage"
filler_clip: "/mediaStorage/filler/filler.mp4"
path: "/var/lib/ffplayout/tv-media"
filler_clip: "/var/lib/ffplayout/tv-media/filler/filler.mp4"
extensions:
- "mp4"
- "mkv"

View File

@ -7,8 +7,8 @@ ExecStart=/usr/bin/ffplayout %I
Restart=always
RestartSec=1
KillMode=mixed
User=www-data
Group=www-data
User=ffpu
Group=ffpu
[Install]
WantedBy=multi-user.target

28
debian/postinst vendored
View File

@ -1,27 +1,25 @@
#DEBHELPER#
sysUser="ffpu"
if ! id $sysUser &>/dev/null; then
adduser --system $sysUser
fi
if [ ! -d "/usr/share/ffplayout/db" ]; then
mkdir "/usr/share/ffplayout/db"
chmod 777 "/usr/share/ffplayout/db"
mkdir "/var/lib/ffplayout/playlists"
mkdir "/var/lib/ffplayout/tv-media"
/usr/bin/ffpapi -i
if id "www-data" &>/dev/null; then
chown www-data. "/usr/share/ffplayout/db/ffplayout.db"
else
sed -i "s|www-data|root|g" /lib/systemd/system/ffpapi.service
sed -i "s|www-data|root|g" /lib/systemd/system/ffplayout.service
rm -f /etc/sudoers.d/11-ffplayout
systemctl daemon-reload
fi
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
mkdir "/var/log/ffplayout"
if id "www-data" &>/dev/null; then
chown www-data. /var/log/ffplayout
chown -R www-data. /etc/ffplayout
fi
chown ${sysUser}. "/var/log/ffplayout"
fi