* Replaced shell script used to start JF with a symlink, since it didn't
do anything else.
* Sorted installs by category/path to make it easier to maintain the
spec.
* Defined `%defattr` in file section so we don't need to set it on a
by-file level. This also helps with the messed up default file
permissions `dotnet publish` produces.
* Removed some duplicate attribute definitions in `%install` and
`%files` sections. They are now all in the `%install` section because
of `%defattr` being specified and overriding them otherwise.
* when running Jellyfin as a user from a terminal without passing
arguments, it would not find the web-files. They were moved in the
JF-web build for Fedora, so this env-var would point to an invalid
location. By removing it, JF now checks the default location.
* fixesjellyfin/jellyfin-web#2059
* fixes#7471
* Filter for F36+ since we don't know when (if ever) this issue will be
fixed (it's up to .NET SDK). If it's ever fixed we can adjust or
remove this condition.
* Remove additional dotnet-preview repo from Makefile
* Repo doesn't seem maintained, and maintainers actively discourage
the usage in production in its description
* Considering this, we should build with stable .NET releases, which
Fedora and RHEL 8+ repos already provide
* Use Fedora-version-specific runtime-identifier for `dotnet publish`
* This has no actual effect right now judging by the [RID
catalog](3efd59151a/docs/core/rid-catalog.md),
so this is just future proofing.
* Remove AutoReqProv
* There's rarely a reason to use this feature, this is not one of them
* In the [proposal of this
feature](https://fedoraproject.org/wiki/AutoReqProv_(draft)#Usage)
it is stated that this is not to be used on packages with binaries
in /usr/bin and others, which is the case in this package.
* also didn't seem to work since we were still having dependency
issues with implicit dependencies (see jellyfin/jellyfin#7471 )
* Removed DOTNET_SKIP_FIRST_TIME_EXPERIENCE as it is unused in .NET SDK
* see dotnet/sdk#9945
* it's already merged for removal in future versions
* Move building process `dotnet publish` to %build section
* Also removed `--output` from this due to an outstanding bug on SDK's
side. This also separates building and installing as intended
* define LICENSE as %license, which automatically puts it in a
standardised directory
Rewrite so we don't need to constantly update with every new Fedora
release. This is especially useful when Fedora and Jellyfin release
cycles don't line up.
Version selection is as follows:
* TARGET environment variable, which is currently used already
* Currently running Fedora version
* Hardcoded Fallback version that can be updated occasionally
Move "AmbientCapabilities=CAP_NET_BIND_SERVICE" to the "[Service]"
section of the optional "lowport" unit drop-in file and package that
drop-in in a separate, optionally installable jellyfin-server-lowports
subpackage.
This isolates the CAP_NET_BIND_SERVICE capability to only installations
that desire it.
Signed-off-by: Brian J. Murrell <brian@interlinx.bc.ca>
* Target net6.0
* Use new Enum.TryParse(ReadOnlySpan<char>) overload
* Replace RNGCryptoServiceProvider with RandomNumberGenerator
* ci - target net6.0 (#6594)
* Update deployment for dotnet6
* Use generic 6.0.x preview for CI
* Update direct dotnet download links
Co-authored-by: Bond_009 <bond.009@outlook.com>
Add "AmbientCapabilities=CAP_NET_BIND_SERVICE" to the "[Service]"
section of the unit file to allow the server to bind to ports 80 and 443.
Signed-off-by: Brian J. Murrell <brian@interlinx.bc.ca>
Reportedly `systemd-run --scope` still got killed by the service
manager; see #4615. The suspected cause is that `scope` units are run by
the `systemd-run` process itself and inherit the caller's execution
environment (see systemd-run(1)). To fix this, we use a systemd
`service` unit instead, which is run and managed by PID 1 - hopefully
this will isolate us sufficiently so that we don't get terminated along
with `jellyfin.service`.
systemd-run(1) runs `systemctl restart` in an isolated systemd unit
that is not subject to process termination as jellyfin.service is shut
down. We adjust the sudoers configuration for this new usage, removing
the old config, since restart.sh is the only user of the sudoers
policy.
Additionally we change `systemctl start` to `systemctl restart` since
there was a race condition where jellyfin.service was not fully
stopped by the time this ran, so `systemctl start` became a noop.
`systemctl restart` on the other hand works whether jellyfin.service is
stopped or not.
The at(1) hack (and the usage of `start` instead of `restart`) is left
in for other init systems since I cannot test on those systems, and
because I don't know of any systemd-run(1) equivalent (although it may
be a non-issue since alternate init systems do not keep track of daemon
children nearly as aggressively as systemd does).
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.