From 4e1a5b87de3a372db36b08de0b4c933e853948bb Mon Sep 17 00:00:00 2001 From: "Tom \"spot\" Callaway" Date: Thu, 8 Sep 2011 13:49:27 -0400 Subject: [PATCH] convert to systemd --- am-utils.spec | 41 ++++++++++++++++++++++------------------- amd.service | 10 ++++++++++ 2 files changed, 32 insertions(+), 19 deletions(-) create mode 100644 amd.service diff --git a/am-utils.spec b/am-utils.spec index 948ed1f..c8b5dfe 100644 --- a/am-utils.spec +++ b/am-utils.spec @@ -1,20 +1,18 @@ Summary: Automount utilities including an updated version of Amd Name: am-utils Version: 6.1.5 -Release: 18%{?dist} +Release: 19%{?dist} License: BSD Epoch: 5 Group: System Environment/Daemons URL: http://am-utils.org Source: ftp://ftp.am-utils.org/pub/am-utils/am-utils-%{version}.tar.gz -Source1: am-utils.init +Source1: amd.service Source2: am-utils.conf Source3: am-utils.sysconf Source4: am-utils.net.map -Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) - BuildRequires: gdbm-devel BuildRequires: hesiod-devel BuildRequires: openldap-devel @@ -24,6 +22,7 @@ BuildRequires: libtool BuildRequires: bison BuildRequires: flex BuildRequires: tcp_wrappers-devel +BuildRequires: systemd-units Requires: portmap Requires: grep @@ -32,9 +31,8 @@ Requires: findutils Requires(pre): /bin/grep Requires(post): /sbin/install-info -Requires(post): /sbin/chkconfig +Requires(post): systemd-sysv Requires(preun): /sbin/install-info -Requires(preun): /sbin/chkconfig # 203193 - tmpfile usage Patch1: am-utils-6.1.5-rmtab-temp.patch @@ -96,12 +94,12 @@ sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool make %{?_smp_flags} %install -rm -rf ${RPM_BUILD_ROOT} %makeinstall -mkdir -p ${RPM_BUILD_ROOT}/%{_sysconfdir}/{rc.d/init.d,sysconfig} +mkdir -p ${RPM_BUILD_ROOT}/%{_sysconfdir}/sysconfig +mkdir -p ${RPM_BUILD_ROOT}%{_unitdir} -install -m 755 %{SOURCE1} ${RPM_BUILD_ROOT}/%{_sysconfdir}/rc.d/init.d/amd +install -m 755 %{SOURCE1} ${RPM_BUILD_ROOT}/%{_unitdir}/ install -m 600 %{SOURCE2} ${RPM_BUILD_ROOT}/%{_sysconfdir}/amd.conf install -m 644 %{SOURCE3} ${RPM_BUILD_ROOT}/%{_sysconfdir}/sysconfig/amd install -m 640 %{SOURCE4} ${RPM_BUILD_ROOT}/%{_sysconfdir}/amd.net @@ -144,7 +142,6 @@ fi %post /sbin/ldconfig -/sbin/chkconfig --add amd if [ -f %{_infodir}/am-utils.info.gz ]; then /sbin/install-info %{_infodir}/am-utils.info.gz %{_infodir}/dir || : fi @@ -154,18 +151,21 @@ if [ $1 -eq 0 ]; then if [ -f %{_infodir}/am-utils.info.gz ]; then /sbin/install-info --delete %{_infodir}/am-utils.info.gz %{_infodir}/dir || : fi - /sbin/service amd stop >/dev/null 2>&1 - /sbin/chkconfig --del amd fi -%postun -if [ $1 -ge 1 ]; then - /sbin/service amd condrestart >/dev/null 2>&1 -fi -/sbin/ldconfig +%postun -p /sbin/ldconfig + +%triggerun -- am-utils < 6.1.5-19 +# Save the current service runlevel info +# User must manually run systemd-sysv-convert --apply amd +# to migrate them to systemd targets +/usr/bin/systemd-sysv-convert --save amd >/dev/null 2>&1 ||: + +# Run these because the SysV package being removed won't do them +/sbin/chkconfig --del amd >/dev/null 2>&1 || : +/bin/systemctl try-restart amd.service >/dev/null 2>&1 || : %files -%defattr(-,root,root) %doc doc/*.ps AUTHORS BUGS ChangeLog NEWS README* scripts/*-sample %dir /.automount %{_bindir}/expn @@ -177,11 +177,14 @@ fi %config(noreplace) %{_sysconfdir}/amd.net %config(noreplace) %{_sysconfdir}/amd.conf %config(noreplace) %{_sysconfdir}/sysconfig/amd -%{_sysconfdir}/rc.d/init.d/amd +%{_unitdir}/amd.service %{_infodir}/*info*.gz %{_libdir}/libamu.so* %changelog +* Thu Sep 08 2011 Tom Callaway - 5:6.1.5-19 +- convert from sysvinit to systemd + * Mon Feb 07 2011 Fedora Release Engineering - 5:6.1.5-18 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild diff --git a/amd.service b/amd.service new file mode 100644 index 0000000..ea969c9 --- /dev/null +++ b/amd.service @@ -0,0 +1,10 @@ +[Unit] +Description=automount daemon that mounts devices and NFS hosts on demand +After=syslog.target network.target + +[Service] +EnvironmentFile=-/etc/sysconfig/amd +ExecStart=/usr/sbin/amd -F /etc/amd.conf $AMDOPTS $OPTIONS $MOUNTPTS + +[Install] +WantedBy=multi-user.target