diff --git a/assets/11-ffplayout b/assets/11-ffplayout index 5f52988f..440b44f9 100644 --- a/assets/11-ffplayout +++ b/assets/11-ffplayout @@ -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@* diff --git a/assets/ffpapi.service b/assets/ffpapi.service index b1168fc8..7efe360d 100644 --- a/assets/ffpapi.service +++ b/assets/ffpapi.service @@ -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 diff --git a/assets/ffplayout.service b/assets/ffplayout.service index 34005a41..4cdb7690 100644 --- a/assets/ffplayout.service +++ b/assets/ffplayout.service @@ -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 diff --git a/assets/ffplayout.yml b/assets/ffplayout.yml index 19163885..dba10637 100644 --- a/assets/ffplayout.yml +++ b/assets/ffplayout.yml @@ -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" diff --git a/assets/ffplayout@.service b/assets/ffplayout@.service index 7adaad46..695cc38d 100644 --- a/assets/ffplayout@.service +++ b/assets/ffplayout@.service @@ -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 diff --git a/debian/postinst b/debian/postinst index 9f1147dd..3725dd5c 100644 --- a/debian/postinst +++ b/debian/postinst @@ -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