From: HAT Date: Thu, 25 Aug 2011 16:43:47 +0000 (+0900) Subject: new configure option "--enable-redhat-systemd" for Fedora15 and later. X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8ba2fce04e6a86ec350b7e083745fdc1d7f1dcdf;p=netatalk.git new configure option "--enable-redhat-systemd" for Fedora15 and later. "--enable-redhat" is renamed "--enable-redhat-sysv". suggested by netatalk-2.2.0-4.fc17.src.rpm --- diff --git a/NEWS b/NEWS index dcfe798c..b6b387c4 100644 --- a/NEWS +++ b/NEWS @@ -3,9 +3,12 @@ Changes in 2.2.1 * NEW: afpd: disable continous service feature by default, new option -keepsessions to enable it -* UPD: afpd: Enhance ACL support detection for volumes: enable them per volume if - 1) ACL support compiled in, 2) the volume supports ACLs, 3) the new volume - option "noacls" is not set for the volume. +* NEW: configure option "--enable-redhat-systemd" for Fedora15 and later. + "--enable-redhat" is renamed "--enable-redhat-sysv". +* UPD: afpd: Enhance ACL support detection for volumes: enable them per volume + if + 1) ACL support compiled in, 2) the volume supports ACLs, 3) the new + volume option "noacls" is not set for the volume. The previous behaviour was to enable ACL support for a volume if 1) it was compiled in and 2) the volume supported ACLs. There was no way to disable ACLs for a volume. @@ -24,13 +27,13 @@ Changes in 2.2.1 * FIX: afpd: fix a crash when searching for a UUID that is not a special local UUID and LDAP support is not compiled in * FIX: afpd: .volinfo file not created on first volume access if user in rolist -* FIX: afpd: possible crash at startup when registering with Avahi when Avahi is - not running +* FIX: afpd: possible crash at startup when registering with Avahi + when Avahi is not running * FIX: afpd: return correct user/group type when mapping UUIDs to names -* FIX: afpd: for directories add DARWIN_ACE_DELETE ACE if DARWIN_ACE_ADD_SUBDIRECTORY - is set -* FIX: afpd: afpd crashed when it failed to register with Avahi because eg user - service registration is disabled in the Avahi config +* FIX: afpd: for directories add DARWIN_ACE_DELETE ACE + if DARWIN_ACE_ADD_SUBDIRECTORY is set +* FIX: afpd: afpd crashed when it failed to register with Avahi because eg + user service registration is disabled in the Avahi config * FIX: cnid_dbd: increase BerkeleyDB locks and lockobjs * FIX: cnid_dbd: implement -d option, deletes CNID db * FIX: dbd: better detection of local (or SMB/NFS) modifications on AFP volumes @@ -38,12 +41,13 @@ Changes in 2.2.1 * FIX: Sourcecode distribution: add missing headers * FIX: Solaris 10: missing dirfd replacement function * FIX: case-conversion of surrogate pair -* FIX: Compilation error on GNU/kFreeBSD, fixes Bug ID 3392794 and Debian #630349 +* FIX: Compilation error on GNU/kFreeBSD, fixes Bug ID 3392794 and + Debian #630349 * FIX: Fix Debian Bug#637025 * FIX: Multiple *BSD compilation compatibility fixes, Bug ID 3380785 * FIX: precompose_w() failed if tail character is decomposed surrogate pair -Changes in 2.2 +Changes in 2.2.0 ============== * NEW: afpd: new volume option "nonetids" @@ -63,7 +67,8 @@ Changes in 2.2 * FIX: afpd: new catsearch was broken * FIX: afpd: only use volume UUIDs in master afpd * FIX: dbd: Multiple fixes, reliable locking -* FIX: ad file suite: fix an error that resulted in CNID database inconsistencies +* FIX: ad file suite: fix an error that resulted in CNID database + inconsistencies Changes in 2.2beta4 =================== diff --git a/configure.in b/configure.in index 7c939c20..d78cfa51 100644 --- a/configure.in +++ b/configure.in @@ -385,16 +385,32 @@ AC_ARG_ENABLE(locking, ) - AC_ARG_ENABLE(redhat, - [ --enable-redhat use redhat-style sysv configuration ],[ + [ --enable-redhat obsoleted ],[ + echo "ERROR: --enable-redhat is obsoleted. Use --enable-redhat-sysv or --enable-redhat-systemd." + echo "exit 1" + exit 1 + ] +) + +AC_ARG_ENABLE(redhat-sysv, + [ --enable-redhat-sysv use redhat-style sysv (upstart) configuration ],[ if test "$enableval" = "yes"; then - sysv_style=redhat + sysv_style=redhat-sysv fi AC_MSG_RESULT([enabling redhat-style sysv support]) ] ) +AC_ARG_ENABLE(redhat-systemd, + [ --enable-redhat-systemd use redhat-style systemd (>=Fedora15) configuration ],[ + if test "$enableval" = "yes"; then + sysv_style=redhat-systemd + fi + AC_MSG_RESULT([enabling redhat-style systemd support]) + ] +) + AC_ARG_ENABLE(suse, [ --enable-suse use suse-style sysv configuration ],[ if test "$enableval" = "yes"; then @@ -1261,7 +1277,8 @@ AM_CONDITIONAL(BUILD_PAM, test x$compile_pam = xyes) AM_CONDITIONAL(USE_PGP, test x$compile_pgp = xyes) AM_CONDITIONAL(DEFAULT_HOOK, test x$neta_cv_have_libgcrypt != xyes && test x$neta_cv_have_openssl != xyes) AM_CONDITIONAL(USE_NETBSD, test x$sysv_style = xnetbsd) -AM_CONDITIONAL(USE_REDHAT, test x$sysv_style = xredhat) +AM_CONDITIONAL(USE_REDHAT_SYSV, test x$sysv_style = xredhat-sysv) +AM_CONDITIONAL(USE_REDHAT_SYSTEMD, test x$sysv_style = xredhat-systemd) AM_CONDITIONAL(USE_SUSE, test x$sysv_style = xsuse) AM_CONDITIONAL(USE_SHADOWPW, test x$shadowpw = xyes) AM_CONDITIONAL(USE_TRU64, test x$sysv_style = xtru64) diff --git a/distrib/initscripts/.gitignore b/distrib/initscripts/.gitignore index 3ed4c80c..af1675fd 100644 --- a/distrib/initscripts/.gitignore +++ b/distrib/initscripts/.gitignore @@ -1,10 +1,12 @@ Makefile Makefile.in rc.atalk.bsd -rc.atalk.redhat +rc.atalk.redhat-sysv +rc.atalk.redhat-systemd rc.atalk.suse rc.atalk.tru64 rc.atalk.sysv +service.atalk.redhat-systemd netatalk atalk .gitignore diff --git a/distrib/initscripts/Makefile.am b/distrib/initscripts/Makefile.am index 833b0872..3ff9246b 100644 --- a/distrib/initscripts/Makefile.am +++ b/distrib/initscripts/Makefile.am @@ -12,11 +12,13 @@ pkgconfdir = @PKGCONFDIR@ sed -e s@:BINDIR:@${bindir}@ \ -e s@:SBINDIR:@${sbindir}@ \ -e s@:ETCDIR:@${pkgconfdir}@ \ + -e s@:PKGLIBEXECDIR:@${pkglibexecdir}@ \ <$< >$@ GENERATED_FILES = \ rc.afpd.netbsd \ - rc.atalk.redhat \ + rc.atalk.redhat-sysv \ + rc.atalk.redhat-systemd \ rc.atalk.tru64 \ rc.atalk.bsd \ rc.atalkd.netbsd \ @@ -26,11 +28,13 @@ GENERATED_FILES = \ rc.timelord.netbsd \ rc.atalk.sysv \ rc.atalk.gentoo \ - rc.atalk.debian + rc.atalk.debian \ + service.atalk.redhat-systemd TEMPLATES = \ rc.afpd.netbsd.tmpl \ - rc.atalk.redhat.tmpl \ + rc.atalk.redhat-sysv.tmpl \ + rc.atalk.redhat-systemd.tmpl \ rc.atalk.tru64.tmpl \ rc.atalk.bsd.tmpl \ rc.atalkd.netbsd.tmpl \ @@ -40,9 +44,10 @@ TEMPLATES = \ rc.timelord.netbsd.tmpl \ rc.atalk.sysv.tmpl \ rc.atalk.gentoo.tmpl \ - rc.atalk.debian.tmpl + rc.atalk.debian.tmpl \ + service.atalk.redhat-systemd.tmpl -CLEANFILES = $(GENERATED_FILES) $(sysv_SCRIPTS) afpd atalkd cnid_metad papd timelord +CLEANFILES = $(GENERATED_FILES) $(sysv_SCRIPTS) $(service_DATA) afpd atalkd cnid_metad papd timelord EXTRA_DIST = $(TEMPLATES) # overwrite automake uninstall @@ -55,13 +60,13 @@ uninstall: uninstall-startup # checking for "redhat" style sysv scripts: # -if USE_REDHAT +if USE_REDHAT_SYSV sysvdir = /etc/rc.d/init.d sysv_SCRIPTS = netatalk -$(sysv_SCRIPTS): rc.atalk.redhat - cp -f rc.atalk.redhat $(sysv_SCRIPTS) +$(sysv_SCRIPTS): rc.atalk.redhat-sysv + cp -f rc.atalk.redhat-sysv $(sysv_SCRIPTS) chmod a+x $(sysv_SCRIPTS) install-data-hook: @@ -73,6 +78,35 @@ uninstall-startup: endif +# +# checking for "redhat" style systemd scripts: +# + +if USE_REDHAT_SYSTEMD + +sysvdir = $(pkglibexecdir) +sysv_SCRIPTS = netatalk.sh + +servicedir = /lib/systemd/system +service_DATA = netatalk.service + +$(sysv_SCRIPTS): rc.atalk.redhat-systemd + cp -f rc.atalk.redhat-systemd $(sysv_SCRIPTS) + chmod a+x $(sysv_SCRIPTS) + +$(service_DATA): service.atalk.redhat-systemd + cp -f service.atalk.redhat-systemd $(service_DATA) + +install-data-hook: + -systemctl enable $(sysv_SCRIPTS) + +uninstall-startup: + -systemctl disable $(sysv_SCRIPTS) + rm -f $(DESTDIR)$(sysvdir)/$(sysv_SCRIPTS) \ + $(DESTDIR)$(servicedir)/$(service_DATA) + +endif + # # checking for "SuSE" style sysv scripts: # diff --git a/distrib/initscripts/rc.atalk.redhat-systemd.tmpl b/distrib/initscripts/rc.atalk.redhat-systemd.tmpl new file mode 100644 index 00000000..e05972b3 --- /dev/null +++ b/distrib/initscripts/rc.atalk.redhat-systemd.tmpl @@ -0,0 +1,73 @@ +#!/bin/sh + +# Netatalk daemons. + +ATALK_BIN=:BINDIR: +ATALK_CONF_DIR=:ETCDIR: +ATALK_SBIN=:SBINDIR: + +# default +ATALK_NAME=`echo ${HOSTNAME}|cut -d. -f1` +ATALK_UNIX_CHARSET='LOCALE' +ATALK_MAC_CHARSET='MAC_ROMAN' + +CNID_METAD_RUN=yes +AFPD_RUN=yes +AFPD_MAX_CLIENTS=20 +AFPD_UAMLIST="-U uams_dhx.so,uams_dhx2.so" +AFPD_GUEST=nobody +CNID_CONFIG="-l log_note" + +ATALKD_RUN=no +PAPD_RUN=no +TIMELORD_RUN=no +A2BOOT_RUN=no +ATALK_ZONE= +ATALK_BGROUND=no + +# 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 ${ATALK_BIN}/nbprgstr ]; then + ${ATALK_BIN}/nbprgstr -p 4 ${ATALK_NAME}:Workstation${ATALK_ZONE} + ${ATALK_BIN}/nbprgstr -p 4 ${ATALK_NAME}:netatalk${ATALK_ZONE} + fi + + 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/distrib/initscripts/rc.atalk.redhat-sysv.tmpl b/distrib/initscripts/rc.atalk.redhat-sysv.tmpl new file mode 100644 index 00000000..79b613bd --- /dev/null +++ b/distrib/initscripts/rc.atalk.redhat-sysv.tmpl @@ -0,0 +1,241 @@ +#! /bin/sh +# chkconfig: - 91 35 +# description: This package is an implementation of "AFP over TCP" +# and provides printer, file sharing, and routing +# services via legacy AppleTalk networking protocol. +# +# Netatalk daemons. +# If you use AppleTalk, Make sure not to start atalkd in the background: +# its data structures must have time to stablize before running the +# other processes. + +ATALK_BIN=:BINDIR: +ATALK_CONF_DIR=:ETCDIR: +ATALK_SBIN=:SBINDIR: + +# Source function library. +. /etc/rc.d/init.d/functions + +# Source networking configuration. +. /etc/sysconfig/network + +# default +ATALK_NAME=`echo ${HOSTNAME}|cut -d. -f1` +ATALK_UNIX_CHARSET='LOCALE' +ATALK_MAC_CHARSET='MAC_ROMAN' + +CNID_METAD_RUN=yes +AFPD_RUN=yes +AFPD_MAX_CLIENTS=20 +AFPD_UAMLIST="-U uams_dhx.so,uams_dhx2.so" +AFPD_GUEST=nobody +CNID_CONFIG="-l log_note" + +ATALKD_RUN=no +PAPD_RUN=no +TIMELORD_RUN=no +A2BOOT_RUN=no +ATALK_ZONE= +ATALK_BGROUND=no + +# read in netatalk configuration +if [ -f ${ATALK_CONF_DIR}/netatalk.conf ]; then + . ${ATALK_CONF_DIR}/netatalk.conf +fi + +# initialize return values +RETVAL=1 +RETVAL_ATALKD=0 +RETVAL_PAPD=0 +RETVAL_CNID_METAD=0 +RETVAL_AFPD=0 + +# startup code for everything +atalk_startup() { + # Check that networking is up. + if [ ${NETWORKING} = "no" ]; then + echo "[Network isn't started]"; + exit 1; + fi + + if [ ! -f ${ATALK_CONF_DIR}/netatalk.conf ]; then + echo "[${ATALK_CONF_DIR}/netatalk.conf not found]"; + exit 6; + fi + + if [ x"${ATALKD_RUN}" != x"no" -a -x ${ATALK_SBIN}/atalkd ]; then + # Quickly probe for appletalk and warn if we can't find it + #/sbin/modprobe appletalk || echo "[could not load appletalk module]" + # Check for IP Encapsulation support + #/sbin/modprobe ipddp || echo "[could not load IP encapsulation]" + echo -n " Starting atalkd:" + daemon ${ATALK_SBIN}/atalkd + RETVAL_ATALKD=$? + echo + + if [ -x ${ATALK_BIN}/nbprgstr ]; then + action " Registering ${ATALK_NAME}:Workstation${ATALK_ZONE}:" ${ATALK_BIN}/nbprgstr -p 4 \"${ATALK_NAME}:Workstation${ATALK_ZONE}\" + action " Registering ${ATALK_NAME}:netatalk${ATALK_ZONE}:" ${ATALK_BIN}/nbprgstr -p 4 \"${ATALK_NAME}:netatalk${ATALK_ZONE}\" + fi + + if [ x"${PAPD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/papd ]; then + echo -n " Starting papd:" + daemon ${ATALK_SBIN}/papd + RETVAL_PAPD=$? + echo + fi + + # check for timelord in bin directory + if [ x"${TIMELORD_RUN}" = x"yes" -a -x ${ATALK_BIN}/timelord ]; then + echo -n " Starting timelord" + daemon ${ATALK_BIN}/timelord + echo + fi + + # check for timelord in sbin directory + if [ x"${TIMELORD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/timelord ]; then + echo -n " Starting timelord" + daemon ${ATALK_SBIN}/timelord + echo + fi + + # check for a2boot in bin directory + if [ x"${A2BOOT_RUN}" = x"yes" -a -x ${ATALK_BIN}/a2boot ]; then + echo -n " Starting a2boot" + daemon ${ATALK_BIN}/a2boot + echo + fi + + # check for a2boot in sbin directory + if [ x"${A2BOOT_RUN}" = x"yes" -a -x ${ATALK_SBIN}/a2boot ]; then + echo -n " Starting a2boot" + daemon ${ATALK_SBIN}/a2boot + echo + fi + + fi + + if [ x"${CNID_METAD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/cnid_metad ] ; then + echo -n " Starting cnid_metad:" + daemon ${ATALK_SBIN}/cnid_metad $CNID_CONFIG + RETVAL_CNID_METAD=$? + echo + fi + + if [ x"${AFPD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/afpd ] ; then + echo -n " Starting afpd:" + daemon ${ATALK_SBIN}/afpd ${AFPD_UAMLIST} -g ${AFPD_GUEST} \ + -c ${AFPD_MAX_CLIENTS} -n \"${ATALK_NAME}${ATALK_ZONE}\" + RETVAL_AFPD=$? + echo + fi + + if [ $RETVAL_ATALKD -eq 0 -a $RETVAL_PAPD -eq 0 -a $RETVAL_CNID_METAD -eq 0 -a $RETVAL_AFPD -eq 0 ]; then + RETVAL=0 + touch /var/lock/subsys/atalk || RETVAL=1 + fi +} + +case "$1" in +'start') + echo -n 'Starting Netatalk services: ' + if [ x"${ATALK_BGROUND}" = x"yes" -a x"${ATALKD_RUN}" != x"no" ]; then + echo -n "(backgrounded)" + atalk_startup >& /dev/null & + else + echo + atalk_startup + fi + echo + ;; +'stop') + echo 'Shutting down Netatalk services: ' + if [ x"${ATALKD_RUN}" != x"no" ]; then + if [ x"${PAPD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/papd ]; then + echo -n " Stopping papd:" + killproc papd + RETVAL_PAPD=$? + echo + fi + + # checking for timelord in bin directory + if [ x"${TIMELORD_RUN}" = x"yes" -a -x ${ATALK_BIN}/timelord ]; then + echo -n " Stopping timelord:" + killproc timelord + echo + fi + + # checking for timelord in sbin directory + if [ x"${TIMELORD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/timelord ]; then + echo -n " Stopping timelord:" + killproc timelord + echo + fi + + # checking for a2boot in bin directory + if [ x"${A2BOOT_RUN}" = x"yes" -a -x ${ATALK_BIN}/a2boot ]; then + echo -n " Stopping a2boot:" + killproc a2boot + echo + fi + + # checking for a2boot in sbin directory + if [ x"${A2BOOT_RUN}" = x"yes" -a -x ${ATALK_SBIN}/a2boot ]; then + echo -n " Stopping a2boot:" + killproc a2boot + echo + fi + + action " Unregistering ${ATALK_NAME}:Workstation${ATALK_ZONE}:" ${ATALK_BIN}/nbpunrgstr \"${ATALK_NAME}:Workstation${ATALK_ZONE}\" + action " Unregistering ${ATALK_NAME}:netatalk${ATALK_ZONE}:" ${ATALK_BIN}/nbpunrgstr \"${ATALK_NAME}:netatalk${ATALK_ZONE}\" + + # kill atalkd last, since without it the plumbing goes away. + if [ -x ${ATALK_SBIN}/atalkd ]; then + echo -n " Stopping atalk:" + killproc atalkd + RETVAL_ATALKD=$? + echo + fi + fi + + # kill this separately as we also do AFP/tcp + if [ x"${AFPD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/afpd ]; then + echo -n " Stopping afpd:" + killproc afpd + RETVAL_AFPD=$? + echo + fi + + if [ x"${CNID_METAD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/cnid_metad ]; then + echo -n " Stopping cnid_metad:" + killproc cnid_metad + RETVAL_CNID_METAD=$? + echo + fi + + if [ $RETVAL_ATALKD -eq 0 -a $RETVAL_PAPD -eq 0 -a $RETVAL_AFPD -eq 0 ] ; then + RETVAL=0 + rm -f /var/lock/subsys/atalk || RETVAL=1 + fi + echo "" + ;; + 'restart'|'reload') + $0 stop + $0 start + RETVAL=$? + ;; + 'status') + status atalkd + status papd + status timelord + status a2boot + status cnid_metad + status afpd + RETVAL=$? + ;; + *) + echo "Usage: $0 {start|stop|restart|reload|status}" + exit 2 +esac + +exit $RETVAL diff --git a/distrib/initscripts/rc.atalk.redhat.tmpl b/distrib/initscripts/rc.atalk.redhat.tmpl deleted file mode 100644 index 79b613bd..00000000 --- a/distrib/initscripts/rc.atalk.redhat.tmpl +++ /dev/null @@ -1,241 +0,0 @@ -#! /bin/sh -# chkconfig: - 91 35 -# description: This package is an implementation of "AFP over TCP" -# and provides printer, file sharing, and routing -# services via legacy AppleTalk networking protocol. -# -# Netatalk daemons. -# If you use AppleTalk, Make sure not to start atalkd in the background: -# its data structures must have time to stablize before running the -# other processes. - -ATALK_BIN=:BINDIR: -ATALK_CONF_DIR=:ETCDIR: -ATALK_SBIN=:SBINDIR: - -# Source function library. -. /etc/rc.d/init.d/functions - -# Source networking configuration. -. /etc/sysconfig/network - -# default -ATALK_NAME=`echo ${HOSTNAME}|cut -d. -f1` -ATALK_UNIX_CHARSET='LOCALE' -ATALK_MAC_CHARSET='MAC_ROMAN' - -CNID_METAD_RUN=yes -AFPD_RUN=yes -AFPD_MAX_CLIENTS=20 -AFPD_UAMLIST="-U uams_dhx.so,uams_dhx2.so" -AFPD_GUEST=nobody -CNID_CONFIG="-l log_note" - -ATALKD_RUN=no -PAPD_RUN=no -TIMELORD_RUN=no -A2BOOT_RUN=no -ATALK_ZONE= -ATALK_BGROUND=no - -# read in netatalk configuration -if [ -f ${ATALK_CONF_DIR}/netatalk.conf ]; then - . ${ATALK_CONF_DIR}/netatalk.conf -fi - -# initialize return values -RETVAL=1 -RETVAL_ATALKD=0 -RETVAL_PAPD=0 -RETVAL_CNID_METAD=0 -RETVAL_AFPD=0 - -# startup code for everything -atalk_startup() { - # Check that networking is up. - if [ ${NETWORKING} = "no" ]; then - echo "[Network isn't started]"; - exit 1; - fi - - if [ ! -f ${ATALK_CONF_DIR}/netatalk.conf ]; then - echo "[${ATALK_CONF_DIR}/netatalk.conf not found]"; - exit 6; - fi - - if [ x"${ATALKD_RUN}" != x"no" -a -x ${ATALK_SBIN}/atalkd ]; then - # Quickly probe for appletalk and warn if we can't find it - #/sbin/modprobe appletalk || echo "[could not load appletalk module]" - # Check for IP Encapsulation support - #/sbin/modprobe ipddp || echo "[could not load IP encapsulation]" - echo -n " Starting atalkd:" - daemon ${ATALK_SBIN}/atalkd - RETVAL_ATALKD=$? - echo - - if [ -x ${ATALK_BIN}/nbprgstr ]; then - action " Registering ${ATALK_NAME}:Workstation${ATALK_ZONE}:" ${ATALK_BIN}/nbprgstr -p 4 \"${ATALK_NAME}:Workstation${ATALK_ZONE}\" - action " Registering ${ATALK_NAME}:netatalk${ATALK_ZONE}:" ${ATALK_BIN}/nbprgstr -p 4 \"${ATALK_NAME}:netatalk${ATALK_ZONE}\" - fi - - if [ x"${PAPD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/papd ]; then - echo -n " Starting papd:" - daemon ${ATALK_SBIN}/papd - RETVAL_PAPD=$? - echo - fi - - # check for timelord in bin directory - if [ x"${TIMELORD_RUN}" = x"yes" -a -x ${ATALK_BIN}/timelord ]; then - echo -n " Starting timelord" - daemon ${ATALK_BIN}/timelord - echo - fi - - # check for timelord in sbin directory - if [ x"${TIMELORD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/timelord ]; then - echo -n " Starting timelord" - daemon ${ATALK_SBIN}/timelord - echo - fi - - # check for a2boot in bin directory - if [ x"${A2BOOT_RUN}" = x"yes" -a -x ${ATALK_BIN}/a2boot ]; then - echo -n " Starting a2boot" - daemon ${ATALK_BIN}/a2boot - echo - fi - - # check for a2boot in sbin directory - if [ x"${A2BOOT_RUN}" = x"yes" -a -x ${ATALK_SBIN}/a2boot ]; then - echo -n " Starting a2boot" - daemon ${ATALK_SBIN}/a2boot - echo - fi - - fi - - if [ x"${CNID_METAD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/cnid_metad ] ; then - echo -n " Starting cnid_metad:" - daemon ${ATALK_SBIN}/cnid_metad $CNID_CONFIG - RETVAL_CNID_METAD=$? - echo - fi - - if [ x"${AFPD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/afpd ] ; then - echo -n " Starting afpd:" - daemon ${ATALK_SBIN}/afpd ${AFPD_UAMLIST} -g ${AFPD_GUEST} \ - -c ${AFPD_MAX_CLIENTS} -n \"${ATALK_NAME}${ATALK_ZONE}\" - RETVAL_AFPD=$? - echo - fi - - if [ $RETVAL_ATALKD -eq 0 -a $RETVAL_PAPD -eq 0 -a $RETVAL_CNID_METAD -eq 0 -a $RETVAL_AFPD -eq 0 ]; then - RETVAL=0 - touch /var/lock/subsys/atalk || RETVAL=1 - fi -} - -case "$1" in -'start') - echo -n 'Starting Netatalk services: ' - if [ x"${ATALK_BGROUND}" = x"yes" -a x"${ATALKD_RUN}" != x"no" ]; then - echo -n "(backgrounded)" - atalk_startup >& /dev/null & - else - echo - atalk_startup - fi - echo - ;; -'stop') - echo 'Shutting down Netatalk services: ' - if [ x"${ATALKD_RUN}" != x"no" ]; then - if [ x"${PAPD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/papd ]; then - echo -n " Stopping papd:" - killproc papd - RETVAL_PAPD=$? - echo - fi - - # checking for timelord in bin directory - if [ x"${TIMELORD_RUN}" = x"yes" -a -x ${ATALK_BIN}/timelord ]; then - echo -n " Stopping timelord:" - killproc timelord - echo - fi - - # checking for timelord in sbin directory - if [ x"${TIMELORD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/timelord ]; then - echo -n " Stopping timelord:" - killproc timelord - echo - fi - - # checking for a2boot in bin directory - if [ x"${A2BOOT_RUN}" = x"yes" -a -x ${ATALK_BIN}/a2boot ]; then - echo -n " Stopping a2boot:" - killproc a2boot - echo - fi - - # checking for a2boot in sbin directory - if [ x"${A2BOOT_RUN}" = x"yes" -a -x ${ATALK_SBIN}/a2boot ]; then - echo -n " Stopping a2boot:" - killproc a2boot - echo - fi - - action " Unregistering ${ATALK_NAME}:Workstation${ATALK_ZONE}:" ${ATALK_BIN}/nbpunrgstr \"${ATALK_NAME}:Workstation${ATALK_ZONE}\" - action " Unregistering ${ATALK_NAME}:netatalk${ATALK_ZONE}:" ${ATALK_BIN}/nbpunrgstr \"${ATALK_NAME}:netatalk${ATALK_ZONE}\" - - # kill atalkd last, since without it the plumbing goes away. - if [ -x ${ATALK_SBIN}/atalkd ]; then - echo -n " Stopping atalk:" - killproc atalkd - RETVAL_ATALKD=$? - echo - fi - fi - - # kill this separately as we also do AFP/tcp - if [ x"${AFPD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/afpd ]; then - echo -n " Stopping afpd:" - killproc afpd - RETVAL_AFPD=$? - echo - fi - - if [ x"${CNID_METAD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/cnid_metad ]; then - echo -n " Stopping cnid_metad:" - killproc cnid_metad - RETVAL_CNID_METAD=$? - echo - fi - - if [ $RETVAL_ATALKD -eq 0 -a $RETVAL_PAPD -eq 0 -a $RETVAL_AFPD -eq 0 ] ; then - RETVAL=0 - rm -f /var/lock/subsys/atalk || RETVAL=1 - fi - echo "" - ;; - 'restart'|'reload') - $0 stop - $0 start - RETVAL=$? - ;; - 'status') - status atalkd - status papd - status timelord - status a2boot - status cnid_metad - status afpd - RETVAL=$? - ;; - *) - echo "Usage: $0 {start|stop|restart|reload|status}" - exit 2 -esac - -exit $RETVAL diff --git a/distrib/initscripts/service.atalk.redhat-systemd.tmpl b/distrib/initscripts/service.atalk.redhat-systemd.tmpl new file mode 100644 index 00000000..57316299 --- /dev/null +++ b/distrib/initscripts/service.atalk.redhat-systemd.tmpl @@ -0,0 +1,13 @@ +# netatalk service file for systemd + +[Unit] +Description=File and Printer sharing for Macintosh clients +After=syslog.target network.target + +[Service] +Type=oneshot +ExecStart=/bin/bash -c "exec :PKGLIBEXECDIR:/netatalk.sh" +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target