Only install systemd service on RHEL7 Fedora 15 and laters

el9
Nicolas Chauvet 11 years ago
parent eb20b9b2fe
commit 1feaf31708

@ -22,10 +22,12 @@ Source3: nvidia-xorg.conf
Source6: blacklist-nouveau.conf
BuildRequires: desktop-file-utils
%if 0%{?rhel} > 6 || 0%{?fedora} >= 15
Buildrequires: systemd
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
%endif
ExclusiveArch: i686 x86_64 armv7hl
@ -230,11 +232,13 @@ ln -fs ../../%{_nvidia_serie}/xorg $RPM_BUILD_ROOT%{_libdir}/xorg/modules/%{_nvi
#Install the initscript
tar jxf nvidia-persistenced-init.tar.bz2
%if 0%{?rhel} > 6 || 0%{?fedora} >= 15
mkdir -p $RPM_BUILD_ROOT%{_unitdir}
install -pm 0644 nvidia-persistenced-init/systemd/nvidia-persistenced.service.template \
$RPM_BUILD_ROOT%{_unitdir}/nvidia-persistenced.service
#Change the daemon running owner
sed -i -e "s/__USER__/root/" $RPM_BUILD_ROOT%{_unitdir}/nvidia-persistenced.service
%endif
#Create the default nvidia config directory
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/nvidia
@ -269,7 +273,9 @@ if [ "$1" -eq "1" ]; then
&>/dev/null
done
fi
%if 0%{?rhel} > 6 || 0%{?fedora} >= 15
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
%endif
fi || :
%triggerpostun -- xorg-x11-drv-nvidia < 1:%{version}-5
@ -321,20 +327,24 @@ if [ "$1" -eq "0" ]; then
done
fi
%if 0%{?rhel} > 6 || 0%{?fedora} >= 15
/bin/systemctl --no-reload disable nvidia-persistenced.service > /dev/null 2>&1 || :
/bin/systemctl stop nvidia-persistenced.service > /dev/null 2>&1 || :
%endif
#Backup and disable previously used xorg.conf
[ -f %{_sysconfdir}/X11/xorg.conf ] && \
mv %{_sysconfdir}/X11/xorg.conf %{_sysconfdir}/X11/xorg.conf.%{name}_uninstalled &>/dev/null
fi ||:
%if 0%{?rhel} > 6 || 0%{?fedora} >= 15
%postun
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then
# Package upgrade, not uninstall
/bin/systemctl try-restart nvidia-persistenced.service >/dev/null 2>&1 || :
fi
%endif
%postun libs -p /sbin/ldconfig
@ -354,7 +364,9 @@ fi
%config %{_sysconfdir}/X11/xorg.conf.d/00-nvidia.conf
%config(noreplace) %{_prefix}/lib/modprobe.d/blacklist-nouveau.conf
%config(noreplace) %{_sysconfdir}/X11/nvidia-xorg.conf
%if 0%{?rhel} > 6 || 0%{?fedora} >= 15
%{_unitdir}/nvidia-persistenced.service
%endif
%{_bindir}/nvidia-bug-report.sh
%{_bindir}/nvidia-debugdump
%{_bindir}/nvidia-smi

Loading…
Cancel
Save