]> arthur.barton.de Git - netatalk.git/commitdiff
new configure option "--enable-suse-systemd" for openSUSE12.1 and later.
authorHAT <hat@fa2.so-net.ne.jp>
Mon, 28 Nov 2011 17:51:28 +0000 (02:51 +0900)
committerHAT <hat@fa2.so-net.ne.jp>
Mon, 28 Nov 2011 17:51:28 +0000 (02:51 +0900)
"--enable-suse" is renamed "--enable-suse-sysv".

NEWS
configure.ac
distrib/initscripts/.gitignore
distrib/initscripts/Makefile.am
distrib/initscripts/rc.atalk.redhat-systemd.tmpl [deleted file]
distrib/initscripts/rc.atalk.suse-sysv.tmpl [new file with mode: 0755]
distrib/initscripts/rc.atalk.suse.tmpl [deleted file]
distrib/initscripts/rc.atalk.systemd.tmpl [new file with mode: 0644]
distrib/initscripts/service.atalk.redhat-systemd.tmpl [deleted file]
distrib/initscripts/service.atalk.systemd.tmpl [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index a56a194658f5e0ef699b11a08ab78ea0283f7540..8cdd6881acff2b71da4aa1b4357b3de3f6c2936f 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,10 @@ Changes in 2.2.2
        created for the original connecting user. Said differently: if you
        know the password of adminauthuser, you can authenticate as any other
        user.
+* NEW: configure option "--enable-suse-systemd" for openSUSE12.1 and later.
+       "--enable-redhat-systemd" and "--enable-suse-systemd" are same as
+       "--enable-systemd".
+       "--enable-suse" is renamed "--enable-suse-sysv".
 * NEW: experimental systemd service files in distrib/systemd/
 * UPD: afpd: Enhanced POSIX ACL mapping semantics, from Laura Mueller
 * UPD: afpd: Reset options every time a :DEFAULT: line is found in a
index 41d2cc834fc5f21c31492b22786e845f3a02a8ad..d4caed4441ba79d4aae7bff5a0aa39e8a12e3b5a 100644 (file)
@@ -393,7 +393,6 @@ AC_ARG_ENABLE(locking,
 AC_ARG_ENABLE(redhat,
        [  --enable-redhat         obsoleted ],[
        echo "ERROR: --enable-redhat is obsoleted. Use --enable-redhat-sysv or --enable-redhat-systemd."
-       echo "exit 1"
        exit 1
        ]
 )
@@ -417,14 +416,30 @@ AC_ARG_ENABLE(redhat-systemd,
 )
 
 AC_ARG_ENABLE(suse,
-       [  --enable-suse           use suse-style sysv configuration ],[
+       [  --enable-suse           obsoleted ],[
+       echo "ERROR: --enable-suse is obsoleted. Use --enable-suse-sysv or --enable-suse-systemd."
+       exit 1
+       ]
+)
+
+AC_ARG_ENABLE(suse-sysv,
+       [  --enable-suse-sysv      use suse-style sysv configuration ],[
        if test "$enableval" = "yes"; then
-               sysv_style=suse
+               sysv_style=suse-sysv
        fi
        AC_MSG_RESULT([enabling suse-style sysv support])
        ]
 )
 
+AC_ARG_ENABLE(suse-systemd,
+       [  --enable-suse-systemd   use suse-style systemd (>=openSUSE12.1) configuration ],[
+       if test "$enableval" = "yes"; then
+               sysv_style=suse-systemd
+       fi
+       AC_MSG_RESULT([enabling suse-style systemd support])
+       ]
+)
+
 AC_ARG_ENABLE(gentoo,
        [  --enable-gentoo         use gentoo-style sysv configuration ],[
        if test "$enableval" = "yes"; then
@@ -451,6 +466,15 @@ AC_ARG_ENABLE(debian,
        ]
 )
 
+AC_ARG_ENABLE(systemd,
+       [  --enable-systemd        use general systemd configuration],[
+       if test "$enableval" = "yes"; then
+               sysv_style=systemd
+       fi
+       AC_MSG_RESULT([enabling general systemd support])
+       ]
+)
+
 dnl ----- timelord compilation (disabled by default)
 AC_MSG_CHECKING([whether timelord should be compiled])
 compile_timelord=no
@@ -1274,13 +1298,13 @@ 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_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_SUSE_SYSV, test x$sysv_style = xsuse-sysv)
 AM_CONDITIONAL(USE_SHADOWPW, test x$shadowpw = xyes)
 AM_CONDITIONAL(USE_TRU64, test x$sysv_style = xtru64)
 AM_CONDITIONAL(USE_SOLARIS, test x$sysv_style = xsolaris)
 AM_CONDITIONAL(USE_GENTOO, test x$sysv_style = xgentoo)
 AM_CONDITIONAL(USE_DEBIAN, test x$sysv_style = xdebian)
+AM_CONDITIONAL(USE_SYSTEMD, test x$sysv_style = xsystemd || test x$sysv_style = xredhat-systemd || test x$sysv_style = xsuse-systemd)
 AM_CONDITIONAL(USE_UNDEF, test x$sysv_style = x)
 AM_CONDITIONAL(USE_BDB, test x$bdb_required = xyes)
 AM_CONDITIONAL(USE_APPLETALK, test x$netatalk_cv_ddp_enabled = xyes)
index 150a119881a3e839df9631f4cb5f9366fd9bf92d..8600d948d60807980141689b845e0d14e5f2fafb 100644 (file)
@@ -2,11 +2,11 @@ Makefile
 Makefile.in
 rc.atalk.bsd
 rc.atalk.redhat-sysv
-rc.atalk.redhat-systemd
-rc.atalk.suse
+rc.atalk.systemd
+rc.atalk.suse-sysv
 rc.atalk.tru64
 rc.atalk.sysv
-service.atalk.redhat-systemd
+service.atalk.systemd
 netatalk
 atalk
 netatalk.service
index 5d73af0b2f24059c9ec348c3c79c85140d6cf482..360dfccd478762cdfe8c61b06589394ac5fcc9ce 100644 (file)
@@ -19,34 +19,34 @@ pkgconfdir = @PKGCONFDIR@
 GENERATED_FILES = \
        rc.afpd.netbsd          \
        rc.atalk.redhat-sysv    \
-       rc.atalk.redhat-systemd \
+       rc.atalk.systemd        \
        rc.atalk.tru64          \
        rc.atalk.bsd            \
        rc.atalkd.netbsd        \
-       rc.atalk.suse           \
+       rc.atalk.suse-sysv      \
        rc.cnid_metad.netbsd    \
        rc.papd.netbsd          \
        rc.timelord.netbsd      \
        rc.atalk.sysv           \
        rc.atalk.gentoo         \
        rc.atalk.debian         \
-       service.atalk.redhat-systemd
+       service.atalk.systemd
 
 TEMPLATES = \
        rc.afpd.netbsd.tmpl             \
        rc.atalk.redhat-sysv.tmpl       \
-       rc.atalk.redhat-systemd.tmpl    \
+       rc.atalk.systemd.tmpl           \
        rc.atalk.tru64.tmpl             \
        rc.atalk.bsd.tmpl               \
        rc.atalkd.netbsd.tmpl           \
-       rc.atalk.suse.tmpl              \
+       rc.atalk.suse-sysv.tmpl         \
        rc.cnid_metad.netbsd.tmpl       \
        rc.papd.netbsd.tmpl             \
        rc.timelord.netbsd.tmpl         \
        rc.atalk.sysv.tmpl              \
        rc.atalk.gentoo.tmpl            \
        rc.atalk.debian.tmpl            \
-       service.atalk.redhat-systemd.tmpl
+       service.atalk.systemd.tmpl
 
 CLEANFILES = $(GENERATED_FILES) $(sysv_SCRIPTS) $(service_DATA) afpd atalkd cnid_metad papd timelord
 EXTRA_DIST = $(TEMPLATES)
@@ -80,10 +80,10 @@ uninstall-startup:
 endif
 
 #
-# checking for "redhat" style systemd scripts:
+# checking for general systemd scripts:
 #
 
-if USE_REDHAT_SYSTEMD
+if USE_SYSTEMD
 
 sysvdir        = $(pkglibexecdir)
 sysv_SCRIPTS = netatalk.sh
@@ -91,12 +91,12 @@ 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)
+$(sysv_SCRIPTS): rc.atalk.systemd
+       cp -f rc.atalk.systemd $(sysv_SCRIPTS)
        chmod a+x $(sysv_SCRIPTS)
 
-$(service_DATA): service.atalk.redhat-systemd
-       cp -f service.atalk.redhat-systemd $(service_DATA)
+$(service_DATA): service.atalk.systemd
+       cp -f service.atalk.systemd $(service_DATA)
 
 install-data-hook:
        -systemctl daemon-reload
@@ -113,13 +113,13 @@ endif
 # checking for "SuSE" style sysv scripts:
 #
 
-if USE_SUSE
+if USE_SUSE_SYSV
 
 sysvdir        = /etc/init.d
 sysv_SCRIPTS = netatalk
 
-$(sysv_SCRIPTS): rc.atalk.suse
-       cp -f rc.atalk.suse $(sysv_SCRIPTS)
+$(sysv_SCRIPTS): rc.atalk.suse-sysv
+       cp -f rc.atalk.suse-sysv $(sysv_SCRIPTS)
        chmod a+x $(sysv_SCRIPTS)
 
 install-data-hook:
diff --git a/distrib/initscripts/rc.atalk.redhat-systemd.tmpl b/distrib/initscripts/rc.atalk.redhat-systemd.tmpl
deleted file mode 100644 (file)
index e0bd7fb..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-#!/bin/sh
-
-# Netatalk :NETATALK_VERSION: startup script for systemd.
-
-# The method of using this script is not suitable.
-# This script will be deleted in the future.
-
-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
-
-netatalk_startup() {
-    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
-}
-
-if [ x"${ATALK_BGROUND}" = x"yes" -a x"${ATALKD_RUN}" != x"no" ]; then 
-    netatalk_startup >& /dev/null &
-else
-    netatalk_startup
-fi
diff --git a/distrib/initscripts/rc.atalk.suse-sysv.tmpl b/distrib/initscripts/rc.atalk.suse-sysv.tmpl
new file mode 100755 (executable)
index 0000000..68328e6
--- /dev/null
@@ -0,0 +1,159 @@
+#! /bin/sh
+# Copyright (c) 1996-2001 SuSE GmbH Nuernberg, Germany.  All rights reserved.
+#
+# Author: 
+#      Reinhold Sojer, <reinhold@suse.de>
+#      Olaf Hering, <olh@suse.de>
+# 
+### BEGIN INIT INFO
+# Provides:       netatalk
+# Required-Start: $local_fs
+# Required-Stop: $local_fs
+# Should-Start:  $network $named $remote_fs $syslog slpd
+# Should-Stop:   $remote_fs $network $syslog
+# Default-Start:  3 5
+# Default-Stop:
+# Description:    AFP over TCP and legacy AppleTalk daemons
+### END INIT INFO
+
+# Netatalk :NETATALK_VERSION:
+
+ATALK_NAME=`hostname|sed 's/\..*$//'`
+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
+
+. /etc/rc.status
+. :ETCDIR:/netatalk.conf
+
+# startup code for everything
+atalk_startup() {
+    if [ x"${ATALKD_RUN}" != x"no" ]; then 
+       echo -n "  Starting atalkd ... "
+       :SBINDIR:/atalkd ; my_ec=$?
+
+       if [ -x :BINDIR:/nbprgstr -a "$my_ec" = "0" ]; then     
+           echo -n ".. "
+           :BINDIR:/nbprgstr -p 4 ${ATALK_NAME}:Workstation
+           echo -n ". "
+           :BINDIR:/nbprgstr -p 4 ${ATALK_NAME}:netatalk
+       fi      
+       if [ "$my_ec" != "0" ] ; then false ; fi
+       rc_status -v
+       
+       rc_reset
+
+       if [ x"${PAPD_RUN}" = x"yes"  -a -x :SBINDIR:/papd ]; then
+           echo -n "  Starting papd"
+           :SBINDIR:/papd
+           rc_status -v
+       fi
+
+       rc_reset
+
+       if [ x"${TIMELORD_RUN}" = x"yes"  -a -x :SBINDIR:/timelord ]; then
+           echo -n "  Starting timelord"
+           :SBINDIR:/timelord
+           rc_status -v
+       fi
+
+       rc_reset
+
+    fi
+
+    if [ x"${CNID_METAD_RUN}" = x"yes" -a -x :SBINDIR:/cnid_metad ] ; then
+           echo -n "  Starting cnid_metad "
+           startproc :SBINDIR:/cnid_metad ${CNID_CONFIG}
+           rc_status -v
+    fi
+
+    if [ x"${AFPD_RUN}" = x"yes" -a -x :SBINDIR:/afpd ] ; then
+           echo -n "  Starting afpd ("
+           echo -n ${AFPD_UAMLIST} -g ${AFPD_GUEST} \
+               -c ${AFPD_MAX_CLIENTS} -n ${ATALK_NAME}${ATALK_ZONE}
+           echo -n ")"
+           startproc :SBINDIR:/afpd ${AFPD_UAMLIST} -g ${AFPD_GUEST} \
+               ${AFPD_OPTIONS} \
+               -c ${AFPD_MAX_CLIENTS} -n "${ATALK_NAME}${ATALK_ZONE}"
+           rc_status -v
+    fi
+
+       touch /var/lock/subsys/atalk 
+}
+
+case "$1" in
+    start)
+       if test ! -z "$UID" -a "$UID" != 0 ; then
+               echo "you have to be root to start netatalk daemons"
+               rc_failed
+       else
+       if [ x"${ATALK_BGROUND}" = x"yes" -a x"${ATALKD_RUN}" != x"no" ]; then 
+           echo -n "Starting netatalk in the background ..."
+           atalk_startup >& /dev/null &
+           rc_status -v
+       else
+           echo "Starting netatalk (this may take a while) ..."
+           atalk_startup
+       fi
+       fi
+       ;;
+    stop)
+       echo -n "Shutting down netatalk"
+       if test -x :SBINDIR:/papd ; then
+           killproc -TERM :SBINDIR:/papd
+       fi
+       if test -x :SBINDIR:/timelord ; then
+           killproc -TERM :SBINDIR:/timelord
+       fi
+       if test -x :SBINDIR:/atalkd ; then
+           killproc -TERM :SBINDIR:/atalkd
+       fi
+       killproc -TERM :SBINDIR:/cnid_metad
+       killproc -TERM :SBINDIR:/afpd
+
+       rc_status -v
+       ;;
+    restart|reload|force-reload)
+       $0 stop
+       $0 start
+       rc_status
+       ;;
+    status)
+       echo "Checking for netatalk services"
+       if [ x"${ATALKD_RUN}" = x"yes" -a -x :SBINDIR:/atalkd ] ; then
+           checkproc :SBINDIR:/atalkd && echo -n "atalkd: OK   " || echo -n "atalkd: No process        "
+       fi
+       if [ x"${PAPD_RUN}" = x"yes" -a -x :SBINDIR:/papd ] ; then
+           checkproc :SBINDIR:/papd && echo -n "papd: OK       " || echo -n "papd: No process  "
+       fi
+       if [ x"${TIMELORD_RUN}" = x"yes" -a -x :SBINDIR:/timelord ] ; then
+           checkproc :SBINDIR:/timelord && echo -n   " timelord: OK    " || echo -n " timelord: No process     "
+       fi
+       if [ x"${CNID_METAD_RUN}" = x"yes" ] ; then
+           checkproc :SBINDIR:/cnid_metad && echo -n " cnid_metad: OK  " || echo -n " cnid_metad: No process   "
+       fi
+       checkproc :SBINDIR:/afpd && echo "afpd: OK" || echo "afpd: No process"
+       # assume that afpd is the "main" process ...
+       checkproc :SBINDIR:/afpd
+       rc_status -v
+       ;;
+    *)
+       echo "Usage: $0 {start|stop|restart|status}"
+       exit 1
+       ;;
+esac
+
+rc_exit
diff --git a/distrib/initscripts/rc.atalk.suse.tmpl b/distrib/initscripts/rc.atalk.suse.tmpl
deleted file mode 100755 (executable)
index 68328e6..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-#! /bin/sh
-# Copyright (c) 1996-2001 SuSE GmbH Nuernberg, Germany.  All rights reserved.
-#
-# Author: 
-#      Reinhold Sojer, <reinhold@suse.de>
-#      Olaf Hering, <olh@suse.de>
-# 
-### BEGIN INIT INFO
-# Provides:       netatalk
-# Required-Start: $local_fs
-# Required-Stop: $local_fs
-# Should-Start:  $network $named $remote_fs $syslog slpd
-# Should-Stop:   $remote_fs $network $syslog
-# Default-Start:  3 5
-# Default-Stop:
-# Description:    AFP over TCP and legacy AppleTalk daemons
-### END INIT INFO
-
-# Netatalk :NETATALK_VERSION:
-
-ATALK_NAME=`hostname|sed 's/\..*$//'`
-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
-
-. /etc/rc.status
-. :ETCDIR:/netatalk.conf
-
-# startup code for everything
-atalk_startup() {
-    if [ x"${ATALKD_RUN}" != x"no" ]; then 
-       echo -n "  Starting atalkd ... "
-       :SBINDIR:/atalkd ; my_ec=$?
-
-       if [ -x :BINDIR:/nbprgstr -a "$my_ec" = "0" ]; then     
-           echo -n ".. "
-           :BINDIR:/nbprgstr -p 4 ${ATALK_NAME}:Workstation
-           echo -n ". "
-           :BINDIR:/nbprgstr -p 4 ${ATALK_NAME}:netatalk
-       fi      
-       if [ "$my_ec" != "0" ] ; then false ; fi
-       rc_status -v
-       
-       rc_reset
-
-       if [ x"${PAPD_RUN}" = x"yes"  -a -x :SBINDIR:/papd ]; then
-           echo -n "  Starting papd"
-           :SBINDIR:/papd
-           rc_status -v
-       fi
-
-       rc_reset
-
-       if [ x"${TIMELORD_RUN}" = x"yes"  -a -x :SBINDIR:/timelord ]; then
-           echo -n "  Starting timelord"
-           :SBINDIR:/timelord
-           rc_status -v
-       fi
-
-       rc_reset
-
-    fi
-
-    if [ x"${CNID_METAD_RUN}" = x"yes" -a -x :SBINDIR:/cnid_metad ] ; then
-           echo -n "  Starting cnid_metad "
-           startproc :SBINDIR:/cnid_metad ${CNID_CONFIG}
-           rc_status -v
-    fi
-
-    if [ x"${AFPD_RUN}" = x"yes" -a -x :SBINDIR:/afpd ] ; then
-           echo -n "  Starting afpd ("
-           echo -n ${AFPD_UAMLIST} -g ${AFPD_GUEST} \
-               -c ${AFPD_MAX_CLIENTS} -n ${ATALK_NAME}${ATALK_ZONE}
-           echo -n ")"
-           startproc :SBINDIR:/afpd ${AFPD_UAMLIST} -g ${AFPD_GUEST} \
-               ${AFPD_OPTIONS} \
-               -c ${AFPD_MAX_CLIENTS} -n "${ATALK_NAME}${ATALK_ZONE}"
-           rc_status -v
-    fi
-
-       touch /var/lock/subsys/atalk 
-}
-
-case "$1" in
-    start)
-       if test ! -z "$UID" -a "$UID" != 0 ; then
-               echo "you have to be root to start netatalk daemons"
-               rc_failed
-       else
-       if [ x"${ATALK_BGROUND}" = x"yes" -a x"${ATALKD_RUN}" != x"no" ]; then 
-           echo -n "Starting netatalk in the background ..."
-           atalk_startup >& /dev/null &
-           rc_status -v
-       else
-           echo "Starting netatalk (this may take a while) ..."
-           atalk_startup
-       fi
-       fi
-       ;;
-    stop)
-       echo -n "Shutting down netatalk"
-       if test -x :SBINDIR:/papd ; then
-           killproc -TERM :SBINDIR:/papd
-       fi
-       if test -x :SBINDIR:/timelord ; then
-           killproc -TERM :SBINDIR:/timelord
-       fi
-       if test -x :SBINDIR:/atalkd ; then
-           killproc -TERM :SBINDIR:/atalkd
-       fi
-       killproc -TERM :SBINDIR:/cnid_metad
-       killproc -TERM :SBINDIR:/afpd
-
-       rc_status -v
-       ;;
-    restart|reload|force-reload)
-       $0 stop
-       $0 start
-       rc_status
-       ;;
-    status)
-       echo "Checking for netatalk services"
-       if [ x"${ATALKD_RUN}" = x"yes" -a -x :SBINDIR:/atalkd ] ; then
-           checkproc :SBINDIR:/atalkd && echo -n "atalkd: OK   " || echo -n "atalkd: No process        "
-       fi
-       if [ x"${PAPD_RUN}" = x"yes" -a -x :SBINDIR:/papd ] ; then
-           checkproc :SBINDIR:/papd && echo -n "papd: OK       " || echo -n "papd: No process  "
-       fi
-       if [ x"${TIMELORD_RUN}" = x"yes" -a -x :SBINDIR:/timelord ] ; then
-           checkproc :SBINDIR:/timelord && echo -n   " timelord: OK    " || echo -n " timelord: No process     "
-       fi
-       if [ x"${CNID_METAD_RUN}" = x"yes" ] ; then
-           checkproc :SBINDIR:/cnid_metad && echo -n " cnid_metad: OK  " || echo -n " cnid_metad: No process   "
-       fi
-       checkproc :SBINDIR:/afpd && echo "afpd: OK" || echo "afpd: No process"
-       # assume that afpd is the "main" process ...
-       checkproc :SBINDIR:/afpd
-       rc_status -v
-       ;;
-    *)
-       echo "Usage: $0 {start|stop|restart|status}"
-       exit 1
-       ;;
-esac
-
-rc_exit
diff --git a/distrib/initscripts/rc.atalk.systemd.tmpl b/distrib/initscripts/rc.atalk.systemd.tmpl
new file mode 100644 (file)
index 0000000..e0bd7fb
--- /dev/null
@@ -0,0 +1,84 @@
+#!/bin/sh
+
+# Netatalk :NETATALK_VERSION: startup script for systemd.
+
+# The method of using this script is not suitable.
+# This script will be deleted in the future.
+
+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
+
+netatalk_startup() {
+    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
+}
+
+if [ x"${ATALK_BGROUND}" = x"yes" -a x"${ATALKD_RUN}" != x"no" ]; then 
+    netatalk_startup >& /dev/null &
+else
+    netatalk_startup
+fi
diff --git a/distrib/initscripts/service.atalk.redhat-systemd.tmpl b/distrib/initscripts/service.atalk.redhat-systemd.tmpl
deleted file mode 100644 (file)
index 1af8576..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-# This file is part of netatalk :NETATALK_VERSION:.
-
-# The method of using shell-script "netatalk.sh" is not suitable.
-# The future service files are due to start daemons directly.
-# See netatalk-xxx/distrib/systemd/ directory in tarball.
-
-[Unit]
-Description=File and Printer sharing for Macintosh clients
-After=syslog.target network.target
-
-[Service]
-Type=oneshot
-ExecStart=/bin/sh -c "exec :PKGLIBEXECDIR:/netatalk.sh"
-RemainAfterExit=yes
-
-[Install]
-WantedBy=multi-user.target
diff --git a/distrib/initscripts/service.atalk.systemd.tmpl b/distrib/initscripts/service.atalk.systemd.tmpl
new file mode 100644 (file)
index 0000000..1af8576
--- /dev/null
@@ -0,0 +1,17 @@
+# This file is part of netatalk :NETATALK_VERSION:.
+
+# The method of using shell-script "netatalk.sh" is not suitable.
+# The future service files are due to start daemons directly.
+# See netatalk-xxx/distrib/systemd/ directory in tarball.
+
+[Unit]
+Description=File and Printer sharing for Macintosh clients
+After=syslog.target network.target
+
+[Service]
+Type=oneshot
+ExecStart=/bin/sh -c "exec :PKGLIBEXECDIR:/netatalk.sh"
+RemainAfterExit=yes
+
+[Install]
+WantedBy=multi-user.target