From d08cb32fc9731ca89d6a153ff767c7099d447444 Mon Sep 17 00:00:00 2001 From: Jiri Skala Date: Aug 04 2011 14:47:42 +0000 Subject: added systemd unit file, SysV initscript moved to subpackage --- diff --git a/netatalk.service b/netatalk.service new file mode 100644 index 0000000..7e24a36 --- /dev/null +++ b/netatalk.service @@ -0,0 +1,11 @@ +[Unit] +Description=File and Printer sharing via AppleTalk Protocol +After=syslog.target network.target + +[Service] +Type=oneshot +ExecStart=/bin/bash -c "exec /usr/libexec/netatalk/netatalk.sh" +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/netatalk.sh b/netatalk.sh new file mode 100755 index 0000000..d16a1c3 --- /dev/null +++ b/netatalk.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +ATALK_BIN=/usr/bin +ATALK_CONF_DIR=/etc/netatalk/ +ATALK_SBIN=/usr/sbin + +# read in netatalk configuration +if [ -f ${ATALK_CONF_DIR}/netatalk.conf ]; then + . ${ATALK_CONF_DIR}/netatalk.conf +fi + +if [ x"${ATALKD_RUN}" != x"no" -a -x ${ATALK_SBIN}/atalkd ]; then + ${ATALK_SBIN}/atalkd + + if [ x"${PAPD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/papd ]; then + ${ATALK_SBIN}/papd + fi + + # check for timelord in bin directory + if [ x"${TIMELORD_RUN}" = x"yes" -a -x ${ATALK_BIN}/timelord ]; then + ${ATALK_BIN}/timelord + fi + + # check for timelord in sbin directory + if [ x"${TIMELORD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/timelord ]; then + ${ATALK_SBIN}/timelord + fi + + # check for a2boot in bin directory + if [ x"${A2BOOT_RUN}" = x"yes" -a -x ${ATALK_BIN}/a2boot ]; then + ${ATALK_BIN}/a2boot + fi + + # check for a2boot in sbin directory + if [ x"${A2BOOT_RUN}" = x"yes" -a -x ${ATALK_SBIN}/a2boot ]; then + ${ATALK_SBIN}/a2boot + fi +fi + +if [ x"${CNID_METAD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/cnid_metad ]; then + ${ATALK_SBIN}/cnid_metad $CNID_CONFIG +fi + +if [ x"${AFPD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/afpd ]; then + ${ATALK_SBIN}/afpd ${AFPD_UAMLIST} -g ${AFPD_GUEST} \ + -c ${AFPD_MAX_CLIENTS} -n \"${ATALK_NAME}${ATALK_ZONE}\" +fi diff --git a/netatalk.spec b/netatalk.spec index fa1bffe..e79bb1c 100644 --- a/netatalk.spec +++ b/netatalk.spec @@ -1,22 +1,22 @@ Summary: Daemon which provides POSIX-compliant *NIX/*BSD systems with the ability to share files and printers with Apple Macintosh Name: netatalk Version: 2.2.0 -Release: 1%{?dist} +Release: 2%{?dist} Epoch: 4 License: GPLv2+ Group: System Environment/Daemons Source0: http://download.sourceforge.net/netatalk/netatalk-%{version}.tar.bz2 +Source1: netatalk.service Source2: netatalk.pam-system-auth +Source3: netatalk.sh Patch1: netatalk-2.0.2-uams_no_pie.patch Patch2: netatalk-2.0.4-extern_ucreator.patch Url: http://netatalk.sourceforge.net/ Requires: pam -Requires(post): /sbin/chkconfig /sbin/ldconfig +Requires(post): /sbin/chkconfig Requires(preun): /sbin/chkconfig -Requires(preun): /sbin/service -Requires(postun): /sbin/service /sbin/ldconfig BuildRequires: cracklib-devel openssl-devel pam quota-devel libtool automake autoconf db4-devel pam-devel tcp_wrappers-devel libgcrypt-devel BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -36,6 +36,16 @@ Group: Development/Libraries This package contains the header files for building Appletalk networking programs. +%package sysvinit +Group: System Environment/Daemons +Summary: SysV initscript for netatalk +Requires: %{name} = %{version}-%{release} +Requires(preun): /sbin/service +Requires(postun): /sbin/service + +%description sysvinit +The netatalk-sysvinit contains SysV initscritps support. + %prep %setup -q @@ -106,6 +116,11 @@ cp -fp %{SOURCE2} config.example # XXX bad hack until this file is updated in glibc-headers: rm -f $RPM_BUILD_ROOT/usr/include/netatalk/at.h +mkdir -p $RPM_BUILD_ROOT/lib/systemd/system +mkdir -p $RPM_BUILD_ROOT/usr/libexec/netatalk +install -m 644 %{SOURCE1} $RPM_BUILD_ROOT/lib/systemd/system +install -m 755 %{SOURCE3} $RPM_BUILD_ROOT/usr/libexec/netatalk + # Clean up .a and .la files find $RPM_BUILD_ROOT -name \*.a -exec rm {} \; find $RPM_BUILD_ROOT -name \*.la -exec rm {} \; @@ -114,23 +129,23 @@ find $RPM_BUILD_ROOT -name \*.la -exec rm {} \; rm -rf $RPM_BUILD_ROOT %post -/sbin/chkconfig --add netatalk -/sbin/ldconfig +/bin/systemctl daemon-reload >/dev/null 2>&1 || : %preun if [ "$1" = "0" ] ; then - # check for existence due to renaming initscritp - if [ -x %{_initrddir}/netatalk ] ; then - /sbin/service netatalk stop > /dev/null 2>&1 - /sbin/chkconfig --del netatalk - fi + /bin/systemctl disable netatalk.service > /dev/null 2>&1 || : + /bin/systemctl stop netatalk.service > /dev/null 2>&1 || : fi %postun -if [ "$1" -ge "1" ]; then - /sbin/service netatalk condrestart > /dev/null 2>&1 || : -fi -/sbin/ldconfig +/bin/systemctl daemon-reload >/dev/null 2>&1 || : + +%triggerun -- %{name} < 2.2.0-2 + /sbin/chkconfig --del netatalk >/dev/null 2>&1 || : + /bin/systemctl try-restart netatalk.service >/dev/null 2>&1 || : + +%triggerpostun -n %{name}-sysvinit -- %{name} < 2.2.0-2 + /sbin/chkconfig --add netatalk >/dev/null 2>&1 || : %files %defattr(-,root,root) @@ -138,7 +153,8 @@ fi %doc doc %doc config.example %dir %{_sysconfdir}/netatalk -%attr(755,root,root) %{_initrddir}/netatalk +/lib/systemd/system/netatalk.service +/usr/libexec/netatalk/netatalk.sh %config(noreplace) %{_sysconfdir}/netatalk/AppleVolumes.default %config(noreplace) %{_sysconfdir}/netatalk/AppleVolumes.system %config(noreplace) %{_sysconfdir}/netatalk/netatalk.conf @@ -166,7 +182,14 @@ fi %{_bindir}/netatalk-config %{_mandir}/man*/netatalk-config.1* +%files sysvinit +%attr(755,root,root) %{_initrddir}/netatalk + %changelog +* Thu Aug 04 2011 Jiri Skala - 4:2.2.0-2 +- fixes #714448 - systemd-service +- moves SysV initscript to subpackage + * Fri Jul 29 2011 Jiri Skala - 4:2.2.0-1 - update to latest upstream netatalk-2.2.0