mirror of https://github.com/jellyfin/jellyfin.git
Merge pull request #4615 from strugee/fix-restart.sh
This commit is contained in:
commit
06242121c5
|
@ -11,23 +11,43 @@
|
||||||
#
|
#
|
||||||
# This script is used by the Debian/Ubuntu/Fedora/CentOS packages.
|
# This script is used by the Debian/Ubuntu/Fedora/CentOS packages.
|
||||||
|
|
||||||
get_service_command() {
|
# This is the Right Way(tm) to check if we are booted with
|
||||||
for command in systemctl service; do
|
# systemd, according to sd_booted(3)
|
||||||
if which $command &>/dev/null; then
|
if [ -d /run/systemd/system ]; then
|
||||||
echo $command && return
|
cmd=systemctl
|
||||||
|
else
|
||||||
|
# Everything else is really hard to figure out, so we just use
|
||||||
|
# service(8) if it's available - that works with most init
|
||||||
|
# systems/distributions I know of, including FreeBSD
|
||||||
|
if type service >/dev/null 2>&1; then
|
||||||
|
cmd=service
|
||||||
|
else
|
||||||
|
# If even service(8) isn't available, we just try /etc/init.d
|
||||||
|
# and hope for the best
|
||||||
|
if [ -d /etc/init.d ]; then
|
||||||
|
cmd=sysv
|
||||||
|
else
|
||||||
|
echo "Unable to detect a way to restart Jellyfin; bailing out" 1>&2
|
||||||
|
echo "Please report this bug to https://github.com/jellyfin/jellyfin/issues" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if type sudo >/dev/null 2>&1; then
|
||||||
|
sudo_command=sudo
|
||||||
|
else
|
||||||
|
sudo_command=
|
||||||
fi
|
fi
|
||||||
done
|
|
||||||
echo "sysv"
|
|
||||||
}
|
|
||||||
|
|
||||||
cmd="$( get_service_command )"
|
|
||||||
echo "Detected service control platform '$cmd'; using it to restart Jellyfin..."
|
echo "Detected service control platform '$cmd'; using it to restart Jellyfin..."
|
||||||
case $cmd in
|
case $cmd in
|
||||||
'systemctl')
|
'systemctl')
|
||||||
echo "sleep 0.5; /usr/bin/sudo $( which systemctl ) start jellyfin" | at now
|
# Without systemd-run here, `jellyfin.service`'s shutdown terminates this process too
|
||||||
|
$sudo_command systemd-run systemctl restart jellyfin
|
||||||
;;
|
;;
|
||||||
'service')
|
'service')
|
||||||
echo "sleep 0.5; /usr/bin/sudo $( which service ) jellyfin start" | at now
|
echo "sleep 0.5; $sudo_command service jellyfin start" | at now
|
||||||
;;
|
;;
|
||||||
'sysv')
|
'sysv')
|
||||||
echo "sleep 0.5; /usr/bin/sudo /etc/init.d/jellyfin start" | at now
|
echo "sleep 0.5; /usr/bin/sudo /etc/init.d/jellyfin start" | at now
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
Cmnd_Alias RESTARTSERVER_SYSV = /sbin/service jellyfin restart, /usr/sbin/service jellyfin restart
|
Cmnd_Alias RESTARTSERVER_SYSV = /sbin/service jellyfin restart, /usr/sbin/service jellyfin restart
|
||||||
Cmnd_Alias STARTSERVER_SYSV = /sbin/service jellyfin start, /usr/sbin/service jellyfin start
|
Cmnd_Alias STARTSERVER_SYSV = /sbin/service jellyfin start, /usr/sbin/service jellyfin start
|
||||||
Cmnd_Alias STOPSERVER_SYSV = /sbin/service jellyfin stop, /usr/sbin/service jellyfin stop
|
Cmnd_Alias STOPSERVER_SYSV = /sbin/service jellyfin stop, /usr/sbin/service jellyfin stop
|
||||||
Cmnd_Alias RESTARTSERVER_SYSTEMD = /usr/bin/systemctl restart jellyfin, /bin/systemctl restart jellyfin
|
Cmnd_Alias RESTARTSERVER_SYSTEMD = /usr/bin/systemd-run systemctl restart jellyfin
|
||||||
Cmnd_Alias STARTSERVER_SYSTEMD = /usr/bin/systemctl start jellyfin, /bin/systemctl start jellyfin
|
Cmnd_Alias STARTSERVER_SYSTEMD = /usr/bin/systemd-run systemctl start jellyfin
|
||||||
Cmnd_Alias STOPSERVER_SYSTEMD = /usr/bin/systemctl stop jellyfin, /bin/systemctl stop jellyfin
|
Cmnd_Alias STOPSERVER_SYSTEMD = /usr/bin/systemd-run systemctl stop jellyfin
|
||||||
Cmnd_Alias RESTARTSERVER_INITD = /etc/init.d/jellyfin restart
|
Cmnd_Alias RESTARTSERVER_INITD = /etc/init.d/jellyfin restart
|
||||||
Cmnd_Alias STARTSERVER_INITD = /etc/init.d/jellyfin start
|
Cmnd_Alias STARTSERVER_INITD = /etc/init.d/jellyfin start
|
||||||
Cmnd_Alias STOPSERVER_INITD = /etc/init.d/jellyfin stop
|
Cmnd_Alias STOPSERVER_INITD = /etc/init.d/jellyfin stop
|
||||||
|
|
|
@ -23,6 +23,6 @@ Depends: at,
|
||||||
libfontconfig1,
|
libfontconfig1,
|
||||||
libfreetype6,
|
libfreetype6,
|
||||||
libssl1.1
|
libssl1.1
|
||||||
Recommends: jellyfin-web
|
Recommends: jellyfin-web, sudo
|
||||||
Description: Jellyfin is the Free Software Media System.
|
Description: Jellyfin is the Free Software Media System.
|
||||||
This package provides the Jellyfin server backend and API.
|
This package provides the Jellyfin server backend and API.
|
||||||
|
|
|
@ -40,7 +40,7 @@ Jellyfin is a free software media system that puts you in control of managing an
|
||||||
Summary: The Free Software Media System Server backend
|
Summary: The Free Software Media System Server backend
|
||||||
Requires(pre): shadow-utils
|
Requires(pre): shadow-utils
|
||||||
Requires: ffmpeg
|
Requires: ffmpeg
|
||||||
Requires: libcurl, fontconfig, freetype, openssl, glibc, libicu, at
|
Requires: libcurl, fontconfig, freetype, openssl, glibc, libicu, at, sudo
|
||||||
|
|
||||||
%description server
|
%description server
|
||||||
The Jellyfin media server backend.
|
The Jellyfin media server backend.
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
# Allow jellyfin group to start, stop and restart itself
|
# Allow jellyfin group to start, stop and restart itself
|
||||||
Cmnd_Alias RESTARTSERVER_SYSTEMD = /usr/bin/systemctl restart jellyfin, /bin/systemctl restart jellyfin
|
Cmnd_Alias RESTARTSERVER_SYSTEMD = /usr/bin/systemd-run systemctl restart jellyfin
|
||||||
Cmnd_Alias STARTSERVER_SYSTEMD = /usr/bin/systemctl start jellyfin, /bin/systemctl start jellyfin
|
Cmnd_Alias STARTSERVER_SYSTEMD = /usr/bin/systemd-run systemctl start jellyfin
|
||||||
Cmnd_Alias STOPSERVER_SYSTEMD = /usr/bin/systemctl stop jellyfin, /bin/systemctl stop jellyfin
|
Cmnd_Alias STOPSERVER_SYSTEMD = /usr/bin/systemd-run systemctl stop jellyfin
|
||||||
|
|
||||||
|
|
||||||
jellyfin ALL=(ALL) NOPASSWD: RESTARTSERVER_SYSTEMD
|
jellyfin ALL=(ALL) NOPASSWD: RESTARTSERVER_SYSTEMD
|
||||||
jellyfin ALL=(ALL) NOPASSWD: STARTSERVER_SYSTEMD
|
jellyfin ALL=(ALL) NOPASSWD: STARTSERVER_SYSTEMD
|
||||||
|
|
|
@ -11,23 +11,43 @@
|
||||||
#
|
#
|
||||||
# This script is used by the Debian/Ubuntu/Fedora/CentOS packages.
|
# This script is used by the Debian/Ubuntu/Fedora/CentOS packages.
|
||||||
|
|
||||||
get_service_command() {
|
# This is the Right Way(tm) to check if we are booted with
|
||||||
for command in systemctl service; do
|
# systemd, according to sd_booted(3)
|
||||||
if which $command &>/dev/null; then
|
if [ -d /run/systemd/system ]; then
|
||||||
echo $command && return
|
cmd=systemctl
|
||||||
|
else
|
||||||
|
# Everything else is really hard to figure out, so we just use
|
||||||
|
# service(8) if it's available - that works with most init
|
||||||
|
# systems/distributions I know of, including FreeBSD
|
||||||
|
if type service >/dev/null 2>&1; then
|
||||||
|
cmd=service
|
||||||
|
else
|
||||||
|
# If even service(8) isn't available, we just try /etc/init.d
|
||||||
|
# and hope for the best
|
||||||
|
if [ -d /etc/init.d ]; then
|
||||||
|
cmd=sysv
|
||||||
|
else
|
||||||
|
echo "Unable to detect a way to restart Jellyfin; bailing out" 1>&2
|
||||||
|
echo "Please report this bug to https://github.com/jellyfin/jellyfin/issues" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if type sudo >/dev/null 2>&1; then
|
||||||
|
sudo_command=sudo
|
||||||
|
else
|
||||||
|
sudo_command=
|
||||||
fi
|
fi
|
||||||
done
|
|
||||||
echo "sysv"
|
|
||||||
}
|
|
||||||
|
|
||||||
cmd="$( get_service_command )"
|
|
||||||
echo "Detected service control platform '$cmd'; using it to restart Jellyfin..."
|
echo "Detected service control platform '$cmd'; using it to restart Jellyfin..."
|
||||||
case $cmd in
|
case $cmd in
|
||||||
'systemctl')
|
'systemctl')
|
||||||
echo "sleep 0.5; /usr/bin/sudo $( which systemctl ) start jellyfin" | at now
|
# Without systemd-run here, `jellyfin.service`'s shutdown terminates this process too
|
||||||
|
$sudo_command systemd-run systemctl restart jellyfin
|
||||||
;;
|
;;
|
||||||
'service')
|
'service')
|
||||||
echo "sleep 0.5; /usr/bin/sudo $( which service ) jellyfin start" | at now
|
echo "sleep 0.5; $sudo_command service jellyfin start" | at now
|
||||||
;;
|
;;
|
||||||
'sysv')
|
'sysv')
|
||||||
echo "sleep 0.5; /usr/bin/sudo /etc/init.d/jellyfin start" | at now
|
echo "sleep 0.5; /usr/bin/sudo /etc/init.d/jellyfin start" | at now
|
||||||
|
|
Loading…
Reference in New Issue