Browse Source

Merge pull request #800 from Wuerfelbecher/update-rpm

Add CentOS and update rpm spec for the cachedir option
Joshua M. Boniface 6 years ago
parent
commit
c4c0894b29

+ 1 - 2
bump_version

@@ -68,8 +68,7 @@ new_version="$1"
 # Parse the version from the AssemblyVersion
 old_version="$(
     grep "AssemblyVersion" ${shared_version_file} \
-        | sed -E 's/\[assembly: ?AssemblyVersion\("([0-9\.]+)"\)\]/\1/' \
-        | sed -E 's/.0$//'
+        | sed -E 's/\[assembly: ?AssemblyVersion\("([0-9\.]+)"\)\]/\1/'
 )"
 
 # Set the shared version to the specified new_version

+ 15 - 0
deployment/centos-package-x64/Dockerfile

@@ -0,0 +1,15 @@
+FROM centos:7
+ARG HOME=/build
+RUN mkdir /build && \
+    yum install -y @buildsys-build rpmdevtools yum-plugins-core && \
+    rpm -Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm && \
+    rpmdev-setuptree
+
+WORKDIR /build/rpmbuild
+COPY ./deployment/centos-package-x64/pkg-src/jellyfin.spec SPECS
+COPY ./deployment/centos-package-x64/pkg-src/ SOURCES
+
+RUN spectool -g -R SPECS/jellyfin.spec && \
+    rpmbuild -bs SPECS/jellyfin.spec && \
+    yum-builddep  -y SRPMS/jellyfin-*.src.rpm && \
+    rpmbuild -bb SPECS/jellyfin.spec;

+ 1 - 0
deployment/centos-package-x64/clean.sh

@@ -0,0 +1 @@
+../fedora-package-x64/clean.sh

+ 1 - 0
deployment/centos-package-x64/package.sh

@@ -0,0 +1 @@
+../fedora-package-x64/package.sh

+ 1 - 0
deployment/centos-package-x64/pkg-src

@@ -0,0 +1 @@
+../fedora-package-x64/pkg-src

+ 1 - 1
deployment/fedora-package-x64/pkg-src/jellyfin.env

@@ -21,7 +21,7 @@
 JELLYFIN_DATA_DIRECTORY="/var/lib/jellyfin"
 JELLYFIN_CONFIG_DIRECTORY="/etc/jellyfin"
 JELLYFIN_LOG_DIRECTORY="/var/log/jellyfin"
-JELLYFIN_CACHE_DIRECTORY="/var/log/jellyfin"
+JELLYFIN_CACHE_DIRECTORY="/var/cache/jellyfin"
 # In-App service control
 JELLYFIN_RESTART_OPT="--restartpath /usr/libexec/jellyfin/restart.sh"
 # Additional options for the binary

+ 19 - 14
deployment/fedora-package-x64/pkg-src/jellyfin.spec

@@ -1,11 +1,11 @@
 %global         debug_package %{nil}
-# jellyfin tag to package
-%global         gittag v10.1.0
-# Taglib-sharp commit of the submodule since github archive doesn't include submodules
-%global         taglib_commit ee5ab21742b71fd1b87ee24895582327e9e04776
-%global         taglib_shortcommit %(c=%{taglib_commit}; echo ${c:0:7})
+# Set the dotnet runtime
+%if 0%{?fedora}
+%global         dotnet_runtime  fedora-x64
+%else
+%global         dotnet_runtime  centos-x64
+%endif
 
-AutoReq:        no
 Name:           jellyfin
 Version:        10.1.0
 Release:        1%{?dist}
@@ -31,13 +31,11 @@ BuildRequires:  dotnet-sdk-2.2
 # RPMfusion free
 Requires:       ffmpeg
 
-# For the update-db-paths.sh script to fix emby paths to jellyfin
-%{?fedora:Recommends: sqlite}
-
 # Fedora has openssl1.1 which is incompatible with dotnet 
 %{?fedora:Requires: compat-openssl10}
-# Disable Automatic Dependency Processing for Centos
-%{?el7:AutoReqProv: no}
+
+# Disable Automatic Dependency Processing
+AutoReqProv:    no
 
 %description
 Jellyfin is a free software media system that puts you in control of managing and streaming your media.
@@ -51,7 +49,7 @@ Jellyfin is a free software media system that puts you in control of managing an
 %install
 export DOTNET_CLI_TELEMETRY_OPTOUT=1
 export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
-dotnet publish --configuration Release --output='%{buildroot}%{_libdir}/jellyfin' --self-contained --runtime fedora-x64 Jellyfin.Server
+dotnet publish --configuration Release --output='%{buildroot}%{_libdir}/jellyfin' --self-contained --runtime %{dotnet_runtime} Jellyfin.Server
 %{__install} -D -m 0644 LICENSE %{buildroot}%{_datadir}/licenses/%{name}/LICENSE
 %{__install} -D -m 0644 %{SOURCE5} %{buildroot}%{_sysconfdir}/systemd/system/%{name}.service.d/override.conf
 %{__install} -D -m 0644 Jellyfin.Server/Resources/Configuration/logging.json %{buildroot}%{_sysconfdir}/%{name}/logging.json
@@ -63,6 +61,7 @@ EOF
 %{__mkdir} -p %{buildroot}%{_sharedstatedir}/jellyfin
 %{__mkdir} -p %{buildroot}%{_sysconfdir}/%{name}
 %{__mkdir} -p %{buildroot}%{_var}/log/jellyfin
+%{__mkdir} -p %{buildroot}%{_var}/cache/jellyfin
 
 %{__install} -D -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service
 %{__install} -D -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/%{name}
@@ -90,8 +89,9 @@ EOF
 %config(noreplace) %attr(600,root,root) %{_sysconfdir}/sudoers.d/%{name}-sudoers
 %config(noreplace) %{_sysconfdir}/systemd/system/%{name}.service.d/override.conf
 %config(noreplace) %attr(644,jellyfin,jellyfin) %{_sysconfdir}/%{name}/logging.json
-%attr(-,jellyfin,jellyfin) %dir %{_sharedstatedir}/jellyfin
+%attr(750,jellyfin,jellyfin) %dir %{_sharedstatedir}/jellyfin
 %attr(-,jellyfin,jellyfin) %dir %{_var}/log/jellyfin
+%attr(750,jellyfin,jellyfin) %dir %{_var}/cache/jellyfin
 %if 0%{?fedora}
 %license LICENSE
 %else
@@ -106,7 +106,7 @@ getent passwd jellyfin >/dev/null || \
 exit 0
 
 %post
-# Move existing configuration to /etc/jellyfin and symlink config to /etc/jellyfin
+# Move existing configuration cache and logs to their new locations and symlink them.
 if [ $1 -gt 1 ] ; then
     service_state=$(systemctl is-active jellyfin.service)
     if [ "${service_state}" = "active" ]; then
@@ -122,6 +122,11 @@ if [ $1 -gt 1 ] ; then
         rmdir %{_sharedstatedir}/%{name}/logs
         ln -sf %{_var}/log/jellyfin  %{_sharedstatedir}/%{name}/logs
     fi
+    if [ ! -L %{_sharedstatedir}/%{name}/cache ]; then
+        mv %{_sharedstatedir}/%{name}/cache/* %{_var}/cache/jellyfin
+        rmdir %{_sharedstatedir}/%{name}/cache
+        ln -sf %{_var}/cache/jellyfin  %{_sharedstatedir}/%{name}/cache
+    fi
     if [ "${service_state}" = "active" ]; then
         systemctl start jellyfin.service
     fi