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 ExecStart=/usr/bin/ffpapi -l 127.0.0.1:8000
Restart=always Restart=always
RestartSec=1 RestartSec=1
User=www-data User=ffpu
Group=www-data Group=ffpu
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View File

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

View File

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

View File

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

28
debian/postinst vendored
View File

@ -1,27 +1,25 @@
#DEBHELPER# #DEBHELPER#
sysUser="ffpu"
if ! id $sysUser &>/dev/null; then
adduser --system $sysUser
fi
if [ ! -d "/usr/share/ffplayout/db" ]; then if [ ! -d "/usr/share/ffplayout/db" ]; then
mkdir "/usr/share/ffplayout/db" 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 /usr/bin/ffpapi -i
if id "www-data" &>/dev/null; then chown -R ${sysUser}. "/usr/share/ffplayout"
chown www-data. "/usr/share/ffplayout/db/ffplayout.db" chown -R ${sysUser}. "/var/lib/ffplayout"
else chown -R ${sysUser}. "/etc/ffplayout"
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
fi fi
if [ ! -d "/var/log/ffplayout" ]; then if [ ! -d "/var/log/ffplayout" ]; then
mkdir /var/log/ffplayout mkdir "/var/log/ffplayout"
if id "www-data" &>/dev/null; then chown ${sysUser}. "/var/log/ffplayout"
chown www-data. /var/log/ffplayout
chown -R www-data. /etc/ffplayout
fi
fi fi