It's used in the restart.sh script.
For Debian, this is a Recommends because virtually everyone will need
this (default APT policy is to install recommended packages so this
works ok), but technically you can configure the server to run as root
and then you wouldn't need it.
For Fedora... frankly I got confused by their Weak Dependencies etc. so
I just made it a hard dependency.
Some environments, like system containers, have no reason to have
sudo(8) installed. In these environments restart.sh will silently fail
because /usr/bin/sudo does not exist to execute, so test that sudo
exists and don't try to use it otherwise.
Note also that hardcoding sudo's path is wrong: it can be installed in
other places. On FreeBSD, for example, it is /usr/local/bin/sudo when
installed from ports.
The old code was wrong because e.g. systemd can be *installed* on the
system, but not actually used as PID1. In that case we would pick
`systemctl`, but it wouldn't actually work because PID1 was some other
init system.
Should solve the occasional bugs with the restart in the WebUI.
Sometimes the service stops and then doesn't start again; this will run
an explicit start action afterwards. If this doesn't fix it I'm certain
there would be more tweaking that can be done.
This was not set for Fedora; I do not recall if this was just an oversight or was
explicitly removed in the past; open to feedback there.
Reported in the LUP Bug-A-Thon
Simplifies a number of aspects of the RPM build, including moving
.copr/Makefile into the "fedora/" folder (and leaving a symlink),
removing the jellyfin-web build components, and renaming it
jellyfin-server like Debian did.