From b87219af268e0619fec6c0afc0a332fff7daeae6 Mon Sep 17 00:00:00 2001 From: HAT Date: Tue, 13 Mar 2012 02:17:25 +0900 Subject: [PATCH] update initscripts --- configure.ac | 101 ++++++- distrib/Makefile.am | 2 +- distrib/initscripts/.gitignore | 3 +- distrib/initscripts/Makefile.am | 48 +--- distrib/initscripts/rc.afpd.netbsd.tmpl | 8 +- distrib/initscripts/rc.atalk.bsd.tmpl | 68 +---- distrib/initscripts/rc.atalk.debian.tmpl | 164 +++-------- distrib/initscripts/rc.atalk.gentoo.tmpl | 133 ++------- distrib/initscripts/rc.atalk.redhat-sysv.tmpl | 259 ++++-------------- distrib/initscripts/rc.atalk.suse-sysv.tmpl | 164 +++-------- distrib/initscripts/rc.atalk.systemd.tmpl | 84 ------ distrib/initscripts/rc.atalk.sysv.tmpl | 124 ++------- distrib/initscripts/rc.atalk.tru64.tmpl | 97 ++----- distrib/initscripts/rc.atalkd.netbsd.tmpl | 40 --- distrib/initscripts/rc.cnid_metad.netbsd.tmpl | 3 +- distrib/initscripts/rc.papd.netbsd.tmpl | 22 -- distrib/initscripts/rc.timelord.netbsd.tmpl | 21 -- .../service.atalk-cnid.systemd.tmpl} | 5 +- .../initscripts/service.atalk.systemd.tmpl | 18 +- distrib/systemd/Makefile.am | 3 - distrib/systemd/README | 25 -- distrib/systemd/netatalk.service | 18 -- 22 files changed, 349 insertions(+), 1061 deletions(-) mode change 100755 => 100644 distrib/initscripts/rc.atalk.bsd.tmpl mode change 100755 => 100644 distrib/initscripts/rc.atalk.suse-sysv.tmpl delete mode 100644 distrib/initscripts/rc.atalk.systemd.tmpl mode change 100755 => 100644 distrib/initscripts/rc.atalk.sysv.tmpl mode change 100755 => 100644 distrib/initscripts/rc.atalk.tru64.tmpl delete mode 100644 distrib/initscripts/rc.atalkd.netbsd.tmpl delete mode 100644 distrib/initscripts/rc.papd.netbsd.tmpl delete mode 100644 distrib/initscripts/rc.timelord.netbsd.tmpl rename distrib/{systemd/netatalk-cnid.service => initscripts/service.atalk-cnid.systemd.tmpl} (72%) delete mode 100644 distrib/systemd/Makefile.am delete mode 100644 distrib/systemd/README delete mode 100644 distrib/systemd/netatalk.service diff --git a/configure.ac b/configure.ac index dbd9b2b1..09bc9e58 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -dnl configure.in for netatalk +dnl configure.ac for netatalk AC_INIT(etc/afpd/main.c) @@ -235,6 +235,91 @@ AC_NETATALK_REALPATH dnl Check for sendfile() AC_NETATALK_SENDFILE +AC_ARG_ENABLE(redhat, + [ --enable-redhat obsoleted ],[ + echo "ERROR: --enable-redhat is obsoleted. Use --enable-redhat-sysv or --enable-redhat-systemd." + 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 + 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 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 + 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 + sysv_style=gentoo + fi + AC_MSG_RESULT([enabling gentoo-style sysv support]) + ] +) + +AC_ARG_ENABLE(netbsd, + [ --enable-netbsd use NetBSD-style rc.d configuration ], + if test "x$enableval" = "xyes"; then + sysv_style=netbsd + fi + AC_MSG_RESULT([enabling NetBSD-style rc.d support]) +) + +AC_ARG_ENABLE(debian, + [ --enable-debian use debian-style sysv configuration ],[ + if test "$enableval" = "yes"; then + sysv_style=debian + fi + AC_MSG_RESULT([enabling debian-style sysv support]) + ] +) + +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 -------------------------------------------------------------------------- dnl FHS stuff has to be done last because it overrides other defaults dnl -------------------------------------------------------------------------- @@ -301,6 +386,17 @@ AM_CONDITIONAL(DEFAULT_HOOK, test x$neta_cv_have_libgcrypt != xyes && test x$net AM_CONDITIONAL(USE_BDB, test x$bdb_required = xyes) AM_CONDITIONAL(HAVE_ATFUNCS, test x"$ac_neta_haveatfuncs" = x"yes") +AM_CONDITIONAL(USE_NETBSD, test x$sysv_style = xnetbsd) +AM_CONDITIONAL(USE_REDHAT_SYSV, test x$sysv_style = xredhat-sysv) +AM_CONDITIONAL(USE_SUSE_SYSV, test x$sysv_style = xsuse-sysv) +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) + + dnl --------------------- generate files AC_OUTPUT([Makefile @@ -310,7 +406,7 @@ AC_OUTPUT([Makefile bin/cnid/Makefile bin/cnid/cnid2_create bin/megatron/Makefile - bin/misc/Makefile + bin/misc/Makefile bin/uniconv/Makefile config/Makefile config/pam/Makefile @@ -325,7 +421,6 @@ AC_OUTPUT([Makefile distrib/config/netatalk-config distrib/initscripts/Makefile distrib/m4/Makefile - distrib/systemd/Makefile doc/Makefile etc/Makefile etc/afpd/Makefile diff --git a/distrib/Makefile.am b/distrib/Makefile.am index 5d9bda82..765af279 100644 --- a/distrib/Makefile.am +++ b/distrib/Makefile.am @@ -1,3 +1,3 @@ # Makefile.am for distrib/ -SUBDIRS = config initscripts m4 systemd +SUBDIRS = config initscripts m4 diff --git a/distrib/initscripts/.gitignore b/distrib/initscripts/.gitignore index 8600d948..9f2a0e01 100644 --- a/distrib/initscripts/.gitignore +++ b/distrib/initscripts/.gitignore @@ -7,9 +7,10 @@ rc.atalk.suse-sysv rc.atalk.tru64 rc.atalk.sysv service.atalk.systemd +service.atalk-cnid.systemd netatalk atalk netatalk.service -netatalk.sh +netatalk-cnid.service .gitignore *.o diff --git a/distrib/initscripts/Makefile.am b/distrib/initscripts/Makefile.am index 360dfccd..621c7085 100644 --- a/distrib/initscripts/Makefile.am +++ b/distrib/initscripts/Makefile.am @@ -12,43 +12,36 @@ pkgconfdir = @PKGCONFDIR@ sed -e s@:BINDIR:@${bindir}@ \ -e s@:SBINDIR:@${sbindir}@ \ -e s@:ETCDIR:@${pkgconfdir}@ \ - -e s@:PKGLIBEXECDIR:@${pkglibexecdir}@ \ -e s@:NETATALK_VERSION:@${NETATALK_VERSION}@ \ <$< >$@ GENERATED_FILES = \ rc.afpd.netbsd \ rc.atalk.redhat-sysv \ - rc.atalk.systemd \ rc.atalk.tru64 \ rc.atalk.bsd \ - rc.atalkd.netbsd \ 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.systemd + service.atalk.systemd \ + service.atalk-cnid.systemd TEMPLATES = \ rc.afpd.netbsd.tmpl \ rc.atalk.redhat-sysv.tmpl \ - rc.atalk.systemd.tmpl \ rc.atalk.tru64.tmpl \ rc.atalk.bsd.tmpl \ - rc.atalkd.netbsd.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.systemd.tmpl + service.atalk.systemd.tmpl \ + service.atalk-cnid.systemd.tmpl -CLEANFILES = $(GENERATED_FILES) $(sysv_SCRIPTS) $(service_DATA) afpd atalkd cnid_metad papd timelord +CLEANFILES = $(GENERATED_FILES) $(sysv_SCRIPTS) $(service_DATA) afpd cnid_metad EXTRA_DIST = $(TEMPLATES) # overwrite automake uninstall @@ -85,26 +78,21 @@ endif if USE_SYSTEMD -sysvdir = $(pkglibexecdir) -sysv_SCRIPTS = netatalk.sh - servicedir = /lib/systemd/system -service_DATA = netatalk.service +service_DATA = netatalk.service netatalk-cnid.service -$(sysv_SCRIPTS): rc.atalk.systemd - cp -f rc.atalk.systemd $(sysv_SCRIPTS) - chmod a+x $(sysv_SCRIPTS) +netatalk.service: service.atalk.systemd + cp -f service.atalk.systemd netatalk.service -$(service_DATA): service.atalk.systemd - cp -f service.atalk.systemd $(service_DATA) +netatalk-cnid.service: service.atalk-cnid.systemd + cp -f service.atalk-cnid.systemd netatalk-cnid.service install-data-hook: -systemctl daemon-reload uninstall-startup: -systemctl disable $(service_DATA) - rm -f $(DESTDIR)$(sysvdir)/$(sysv_SCRIPTS) \ - $(DESTDIR)$(servicedir)/$(service_DATA) + rm -f $(DESTDIR)$(servicedir)/$(service_DATA) -systemctl daemon-reload endif @@ -159,28 +147,16 @@ endif if USE_NETBSD sysvdir = /etc/rc.d -sysv_SCRIPTS = afpd atalkd cnid_metad papd timelord +sysv_SCRIPTS = afpd cnid_metad afpd: rc.afpd.netbsd cp -f $< $@ chmod a+x $@ -atalkd: rc.atalkd.netbsd - cp -f $< $@ - chmod a+x $@ - cnid_metad: rc.cnid_metad.netbsd cp -f $< $@ chmod a+x $@ -papd: rc.papd.netbsd - cp -f $< $@ - chmod a+x $@ - -timelord: rc.timelord.netbsd - cp -f $< $@ - chmod a+x $@ - install-data-hook: uninstall-hook: diff --git a/distrib/initscripts/rc.afpd.netbsd.tmpl b/distrib/initscripts/rc.afpd.netbsd.tmpl index 672c2ede..c9223ee1 100644 --- a/distrib/initscripts/rc.afpd.netbsd.tmpl +++ b/distrib/initscripts/rc.afpd.netbsd.tmpl @@ -4,10 +4,7 @@ # REQUIRE: cnid_metad # KEYWORD: shutdown # -# Apple Filing Protocol daemon. (netatalk :NETATALK_VERSION:) -# 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. +# AFP fileserver for Macintosh clients (netatalk :NETATALK_VERSION:) # . /etc/rc.subr @@ -18,8 +15,7 @@ command=":SBINDIR:/afpd" etcdir=":ETCDIR:" pidfile="/var/run/${name}.pid" command_args="-P ${pidfile}" -required_files="$etcdir/afpd.conf $etcdir/AppleVolumes.default $etcdir/AppleVolumes.system" +required_files="$etcdir/afp.conf load_rc_config $name run_rc_command "$1" - diff --git a/distrib/initscripts/rc.atalk.bsd.tmpl b/distrib/initscripts/rc.atalk.bsd.tmpl old mode 100755 new mode 100644 index b3249cc6..068ecfff --- a/distrib/initscripts/rc.atalk.bsd.tmpl +++ b/distrib/initscripts/rc.atalk.bsd.tmpl @@ -1,72 +1,18 @@ #!/bin/sh # # Netatalk :NETATALK_VERSION: 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. # -# -# SUNOS: UNCOMMENT THESE LINES TO LOAD THE KERNEL MODULE. Note that -# modunload-ing netatalk may cause your machine to panic or hang. -# -##echo -n 'loading netatalk: ' -##if [ -f :ETCDIR:/netatalk.o ]; then -## /usr/etc/modload -sym :ETCDIR:/netatalk.o; -##fi - -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 - -netatalk_conf=":ETCDIR:/netatalk.conf" - -[ -f ${netatalk_conf} ] && . ${netatalk_conf} - echo -n 'starting netatalk daemons:' -if [ X"${ATALKD_RUN}" != X"no" ]; then -if [ -x :SBINDIR:/atalkd ]; then - :SBINDIR:/atalkd; echo -n ' atalkd' -fi - -if [ -x :BINDIR:/nbprgstr ]; then - :BINDIR:/nbprgstr -p 4 ${ATALK_NAME}:Workstation - :BINDIR:/nbprgstr -p 4 ${ATALK_NAME}:netatalk - echo -n ' nbprgstr' -fi -fi - -if [ -x :SBINDIR:/papd -a X"${PAPD_RUN}" != X"no" ]; then - :SBINDIR:/papd; echo -n ' papd' -fi - -if [ -x :SBINDIR:/cnid_metad -a X"${CNID_METAD_RUN}" != X"no" ]; then - :SBINDIR:/cnid_metad $CNID_CONFIG - echo -n ' cnid_metad' -fi -if [ -x :SBINDIR:/afpd -a X"${AFPD_RUN}" != X"no" ]; then - :SBINDIR:/afpd ${AFPD_UAMLIST} -g ${AFPD_GUEST} \ - -c ${AFPD_MAX_CLIENTS} -n ${ATALK_NAME}${ATALK_ZONE} - echo -n ' afpd' +if [ -x :SBINDIR:/cnid_metad ]; then + :SBINDIR:/cnid_metad + echo -n ' cnid_metad' fi -if [ -x :SBINDIR:/timelord -a X"${TIMELORD_RUN}" != X"no" ]; then - :SBINDIR:/timelord; echo -n ' timelord' +if [ -x :SBINDIR:/afpd ]; then + :SBINDIR:/afpd + echo -n ' afpd' fi - echo '.' +echo '.' diff --git a/distrib/initscripts/rc.atalk.debian.tmpl b/distrib/initscripts/rc.atalk.debian.tmpl index ac5d8da0..21767a2e 100644 --- a/distrib/initscripts/rc.atalk.debian.tmpl +++ b/distrib/initscripts/rc.atalk.debian.tmpl @@ -20,132 +20,54 @@ SCRIPTNAME=/etc/init.d/$NAME # Guard to prevent execution if netatalk was removed. test -x :SBINDIR:/afpd || exit 0 -# Set defaults. Please change these options in /etc/default/netatalk -ATALK_NAME=`/bin/hostname --short` -ATALK_UNIX_CHARSET='LOCALE' -ATALK_MAC_CHARSET='MAC_ROMAN' - -CNID_METAD_RUN=yes -AFPD_RUN=yes -AFPD_MAX_CLIENTS=50 -AFPD_UAMLIST="-U 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 - -# old /etc/default/netatalk expected hostname in $HOSTNAME by default -HOSTNAME=`/bin/hostname` - -# Read in netatalk configuration. -if [ -f /etc/default/netatalk ]; then - . /etc/default/netatalk -fi - # Start Netatalk servers. atalk_startup() { - if [ x"$ATALKD_RUN" = x"yes" ]; then - - # Try to load the AppleTalk kernel module if it was intended. - if grep -q '^appletalk$' /etc/modules; then - /sbin/modprobe appletalk || echo "[could not load appletalk module]" + if [ -x :SBINDIR:/cnid_metad ] ; then + :SBINDIR:/cnid_metad + echo -n " cnid_metad" fi - - # Start atalkd server. - :SBINDIR:/atalkd - - # register workstation - :BINDIR:/nbprgstr -p 4 "$ATALK_NAME:Workstation$ATALK_ZONE" - :BINDIR:/nbprgstr -p 4 "$ATALK_NAME:netatalk$ATALK_ZONE" - - echo -n " atalkd" - fi - - # prepare startup of file services - if [ "x$CNID_METAD_RUN" = "xyes" -a -x :SBINDIR:/cnid_metad ] ; then - echo -n " cnid_metad" - :SBINDIR:/cnid_metad $CNID_CONFIG - fi - - if [ x"$AFPD_RUN" = x"yes" ]; then - :SBINDIR:/afpd $AFPD_UAMLIST -g $AFPD_GUEST -c $AFPD_MAX_CLIENTS \ - -n "$ATALK_NAME$ATALK_ZONE" - echo -n " afpd" - fi - - if [ "x$ATALKD_RUN" = "xyes" ]; then - if [ "x$PAPD_RUN" = "xyes" ]; then - :SBINDIR:/papd - echo -n " papd" - fi - - if [ x"$TIMELORD_RUN" = x"yes" ]; then - :SBINDIR:/timelord - echo -n " timelord" - fi + + if [ -x :SBINDIR:/afpd ]; then + :SBINDIR:/afpd + echo -n " afpd" fi } case "$1" in - start) - if [ "x$ATALK_BGROUND" = "xyes" -a "x$ATALKD_RUN" = "xyes" ]; then - echo "Starting Netatalk services in the background." - atalk_startup >/dev/null & - else - echo -n "Starting Netatalk services (this will take a while): " - atalk_startup - echo "." - fi - ;; - - stop) - echo -n "Stopping Netatalk Daemons:" - echo -n " afpd" - start-stop-daemon --stop --quiet --oknodo --exec :SBINDIR:/afpd - - echo -n " cnid_metad" - start-stop-daemon --stop --quiet --oknodo --exec :SBINDIR:/cnid_metad - - if test -x :SBINDIR:/papd; then - echo -n " papd" - start-stop-daemon --stop --quiet --oknodo --exec :SBINDIR:/papd - fi - - if test -x :SBINDIR:/timelord; then - echo -n " timelord" - start-stop-daemon --stop --quiet --oknodo --exec :SBINDIR:/timelord - fi - - if test -x :SBINDIR:/atalkd; then - echo -n " atalkd" - start-stop-daemon --stop --quiet --oknodo --exec :SBINDIR:/atalkd - fi - - echo "." - ;; - - restart) - $0 force-reload - ;; - - force-reload) - echo -n "Restarting Netatalk Daemons (this will take a while)" - $0 stop - echo -n "." - sleep 2 - echo -n "." - if $0 start; then - echo "done." - fi - ;; - - *) - echo "Usage: $0 {start|stop|restart|force-reload}" >&2 - exit 1 - ;; + start) + echo -n "Starting Netatalk services: " + atalk_startup + echo "." + ;; + + stop) + echo -n "Stopping Netatalk Daemons:" + echo -n " afpd" + start-stop-daemon --stop --quiet --oknodo --exec :SBINDIR:/afpd + + echo -n " cnid_metad" + start-stop-daemon --stop --quiet --oknodo --exec :SBINDIR:/cnid_metad + + echo "." + ;; + + restart) + $0 force-reload + ;; + + force-reload) + echo -n "Restarting Netatalk Daemons" + $0 stop + echo -n "." + sleep 2 + echo -n "." + if $0 start; then + echo "done." + fi + ;; + + *) + echo "Usage: $0 {start|stop|restart|force-reload}" >&2 + exit 1 + ;; esac diff --git a/distrib/initscripts/rc.atalk.gentoo.tmpl b/distrib/initscripts/rc.atalk.gentoo.tmpl index 5f0c65f1..f7cf2ac2 100644 --- a/distrib/initscripts/rc.atalk.gentoo.tmpl +++ b/distrib/initscripts/rc.atalk.gentoo.tmpl @@ -1,131 +1,32 @@ #!/sbin/runscript # Netatalk :NETATALK_VERSION: 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_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 depend() { - need net - use logger dns + need net + use logger dns } atalk_startup () { -# . :ETCDIR:/netatalk.conf - - if [ "${ATALKD_RUN}" != "no" ]; then - ebegin "Starting atalkd" - start-stop-daemon --start --quiet --exec :SBINDIR:/atalkd - eend $? - - for reg in \ - "${ATALK_NAME}:Workstation${ATALK_ZONE}" \ - "${ATALK_NAME}:netatalk${ATALK_ZONE}" - do - ebegin " Registering $reg" - :BINDIR:/nbprgstr "$reg" - eend $? - done - - if [ "${PAPD_RUN}" = "yes" ]; then - ebegin " Starting papd" - start-stop-daemon --start --quiet --exec :SBINDIR:/papd - eend $? - fi - - fi - - if [ "${CNID_METAD_RUN}" = "yes" ] ; then - ebegin "Starting cnid_metad" - start-stop-daemon --start --quiet --exec :SBINDIR:/cnid_metad -- \ - ${CNID_CONFIG} - eend $? - fi - - - if [ "${AFPD_RUN}" = "yes" ]; then - ebegin "Starting afpd" - start-stop-daemon --start --quiet --exec :SBINDIR:/afpd -- \ - ${AFPD_UAMLIST} -g ${AFPD_GUEST} -c ${AFPD_MAX_CLIENTS} \ - -n "${ATALK_NAME}${ATALK_ZONE}" - eend $? - fi - - if [ "${TIMELORD_RUN}" = "yes" ]; then - ebegin "Starting timelord" - start-stop-daemon --start --quiet --exec :SBINDIR:/timelord - eend $? - fi + ebegin "Starting cnid_metad" + start-stop-daemon --start --quiet --exec :SBINDIR:/cnid_metad + eend $? + + ebegin "Starting afpd" + start-stop-daemon --start --quiet --exec :SBINDIR:/afpd + eend $? } start () { - . :ETCDIR:/netatalk.conf - - if [ x"${ATALK_BGROUND}" = x"yes" -a "${ATALKD_RUN}" != "no" ]; then - echo "Starting netatalk in the background ... " - atalk_startup >& /dev/null & - else - atalk_startup - fi + atalk_startup } stop () { - . :ETCDIR:/netatalk.conf - - if [ "${AFPD_RUN}" = "yes" ]; then - ebegin "Stopping afpd" - start-stop-daemon --stop --quiet --exec :SBINDIR:/afpd - eend $? - fi - - if [ "${TIMELORD_RUN}" = "yes" ]; then - ebegin "Stopping timelord" - start-stop-daemon --stop --quiet --exec :SBINDIR:/timelord - eend $? - fi - - if [ "${ATALKD_RUN}" != "no" ]; then - if [ "${PAPD_RUN}" = "yes" ]; then - ebegin "Stopping papd" - start-stop-daemon --stop --quiet --exec :SBINDIR:/papd - eend $? - fi - - for reg in \ - "${ATALK_NAME}:Workstation${ATALK_ZONE}" \ - "${ATALK_NAME}:netatalk${ATALK_ZONE}" - do - ebegin "Unregistering $reg" - :BINDIR:/nbpunrgstr "$reg" - eend $? - done - - ebegin "Stopping atalkd" - start-stop-daemon --stop --quiet --exec :SBINDIR:/atalkd - eend $? - fi - - if [ "${CNID_METAD_RUN}" = "yes" ] ; then - ebegin "Stopping cnid_metad" - start-stop-daemon --stop --quiet --exec :SBINDIR:/cnid_metad - eend $? - fi + ebegin "Stopping afpd" + start-stop-daemon --stop --quiet --exec :SBINDIR:/afpd + eend $? + + ebegin "Stopping cnid_metad" + start-stop-daemon --stop --quiet --exec :SBINDIR:/cnid_metad + eend $? } diff --git a/distrib/initscripts/rc.atalk.redhat-sysv.tmpl b/distrib/initscripts/rc.atalk.redhat-sysv.tmpl index f066232b..39dc97f0 100644 --- a/distrib/initscripts/rc.atalk.redhat-sysv.tmpl +++ b/distrib/initscripts/rc.atalk.redhat-sysv.tmpl @@ -1,13 +1,8 @@ #! /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. +# description: Netatalk AFP fileserver for Macintosh clients # # Netatalk :NETATALK_VERSION: 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: @@ -19,34 +14,8 @@ ATALK_SBIN=:SBINDIR: # 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 @@ -54,188 +23,72 @@ RETVAL_AFPD=0 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 - + echo "[Network isn't started]"; + exit 1; 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 + if [ -x ${ATALK_SBIN}/cnid_metad ] ; then + echo -n " Starting cnid_metad:" + daemon ${ATALK_SBIN}/cnid_metad + 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 + if [ -x ${ATALK_SBIN}/afpd ] ; then + echo -n " Starting afpd:" + daemon ${ATALK_SBIN}/afpd + 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 + if [ $RETVAL_CNID_METAD -eq 0 -a $RETVAL_AFPD -eq 0 ]; then RETVAL=0 - touch /var/lock/subsys/atalk || RETVAL=1 + 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 + 'start') + echo -n 'Starting Netatalk services: ' + echo + atalk_startup + echo + ;; + 'stop') + echo 'Shutting down Netatalk services: ' + if [ -x ${ATALK_SBIN}/afpd ]; then + echo -n " Stopping afpd:" + killproc afpd + RETVAL_AFPD=$? + echo + fi + + if [ -x ${ATALK_SBIN}/cnid_metad ]; then + echo -n " Stopping cnid_metad:" + killproc cnid_metad + RETVAL_CNID_METAD=$? + echo + fi + + if [ $RETVAL_AFPD -eq 0 -a $RETVAL_CNID_METAD -eq 0 ] ; then + RETVAL=0 + rm -f /var/lock/subsys/atalk || RETVAL=1 + fi + echo "" + ;; + 'restart'|'reload') + $0 stop + $0 start + RETVAL=$? + ;; + 'status') + 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.suse-sysv.tmpl b/distrib/initscripts/rc.atalk.suse-sysv.tmpl old mode 100755 new mode 100644 index e06d0a06..28a614fa --- a/distrib/initscripts/rc.atalk.suse-sysv.tmpl +++ b/distrib/initscripts/rc.atalk.suse-sysv.tmpl @@ -2,158 +2,74 @@ # Copyright (c) 1996-2001 SuSE GmbH Nuernberg, Germany. All rights reserved. # # Author: -# Reinhold Sojer, -# Olaf Hering, +# Reinhold Sojer, +# Olaf Hering, # ### BEGIN INIT INFO # Provides: netatalk # Required-Start: $local_fs # Required-Stop: $local_fs -# Should-Start: $network $named $remote_fs $syslog slpd avahi-daemon +# Should-Start: $network $named $remote_fs $syslog avahi-daemon # Should-Stop: $remote_fs $network $syslog # Default-Start: 3 5 # Default-Stop: -# Description: AFP over TCP and legacy AppleTalk daemons +# Description: Netatalk AFP fileserver for Macintosh clients ### 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 - + if [ -x :SBINDIR:/cnid_metad ] ; then + echo -n " Starting cnid_metad " + startproc :SBINDIR:/cnid_metad + rc_status -v 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 + if [ -x :SBINDIR:/afpd ] ; then + echo -n " Starting afpd " + startproc :SBINDIR:/afpd + 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 + 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 - ;; + if test ! -z "$UID" -a "$UID" != 0 ; then + echo "you have to be root to start netatalk daemons" + rc_failed + else + echo "Starting netatalk..." + atalk_startup + 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 - ;; + echo -n "Shutting down netatalk" + killproc -TERM :SBINDIR:/cnid_metad + killproc -TERM :SBINDIR:/afpd + rc_status -v + ;; restart|reload|force-reload) - $0 stop - $0 start - rc_status - ;; + $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 "Checking for netatalk services" + checkproc :SBINDIR:/cnid_metad && echo -n " cnid_metad: OK " || echo -n " cnid_metad: No process " + 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 - ;; + 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 deleted file mode 100644 index e0bd7fb1..00000000 --- a/distrib/initscripts/rc.atalk.systemd.tmpl +++ /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.sysv.tmpl b/distrib/initscripts/rc.atalk.sysv.tmpl old mode 100755 new mode 100644 index ddad742d..fb0ba96f --- a/distrib/initscripts/rc.atalk.sysv.tmpl +++ b/distrib/initscripts/rc.atalk.sysv.tmpl @@ -2,134 +2,68 @@ # # Start/stop the Netatalk :NETATALK_VERSION: 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. -# # # kill the named process(es) # killproc() { - pid=`/usr/bin/ps -e | - /usr/bin/grep $1 | - /usr/bin/sed -e 's/^ *//' -e 's/ .*//'` - [ "$pid" != "" ] && kill $pid + pid=`/usr/bin/ps -e | + /usr/bin/grep $1 | + /usr/bin/sed -e 's/^ *//' -e 's/ .*//'` + [ "$pid" != "" ] && kill $pid } -# default -ATALK_NAME=`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 - -# old netatalk.conf expected hostname in $HOSTNAME by default -HOSTNAME=`hostname` - -. :ETCDIR:/netatalk.conf - - # # Start the netatalk server processes. # atalk_startup() { - echo 'starting netatalk daemons: \c' - if [ x"${ATALKD_RUN}" != x"no" ]; then - if [ -x :SBINDIR:/atalkd ]; then - :SBINDIR:/atalkd; echo ' atalkd\c' - fi - - if [ -x :BINDIR:/nbprgstr ]; then - :BINDIR:/nbprgstr -p 4 "${ATALK_NAME}:Workstation${ATALK_ZONE}"; - :BINDIR:/nbprgstr -p 4 "${ATALK_NAME}:netatalk${ATALK_ZONE}"; - echo ' nbprgstr\c' - fi - - if [ x"${PAPD_RUN}" = x"yes" -a -x :SBINDIR:/papd ]; then - :SBINDIR:/papd; echo ' papd\c' - fi - - if [ x"${TIMELORD_RUN}" = x"yes" -a -x :SBINDIR:/timelord ]; then - :SBINDIR:/timelord; echo ' timelord\c' - fi - fi - - if [ x"${CNID_METAD_RUN}" = x"yes" -a -x :SBINDIR:/cnid_metad ]; then - :SBINDIR:/cnid_metad $CNID_CONFIG + echo 'starting netatalk daemons: \c' + + if [ -x :SBINDIR:/cnid_metad ]; then + :SBINDIR:/cnid_metad echo ' cnid_metad\c' - fi + fi - if [ x"${AFPD_RUN}" = x"yes" -a -x :SBINDIR:/afpd ]; then - :SBINDIR:/afpd ${AFPD_UAMLIST} -g ${AFPD_GUEST} \ - -c ${AFPD_MAX_CLIENTS} -n "${ATALK_NAME}${ATALK_ZONE}"; echo ' afpd\c' - fi + if [ -x :SBINDIR:/afpd ]; then + :SBINDIR:/afpd + echo ' afpd\c' + fi - echo '.' + echo '.' } case "$1" in -'start') - if [ x"${ATALK_BGROUND}" = x"yes" -a x"${ATALKD_RUN}" != x"no" ]; then - echo "Starting netatalk in the background ... " - atalk_startup > /dev/null & - else + 'start') atalk_startup - fi ;; # # Stop the netatalk server processes. # -'stop') - - echo 'stopping netatalk daemons:\c' - - if [ -x :SBINDIR:/papd ]; then - killproc papd; echo ' papd\c' - fi - - if [ -x :SBINDIR:/afpd ]; then - killproc afpd; echo ' afpd\c' - fi + 'stop') - if [ -x :SBINDIR:/cnid_metad ]; then - killproc cnid_met; echo ' cnid_metad\c' - fi + echo 'stopping netatalk daemons:\c' - if [ -x :SBINDIR:/timelord ]; then - killproc timelord; echo ' timelord\c' - fi + if [ -x :SBINDIR:/afpd ]; then + killproc afpd; echo ' afpd\c' + fi - # kill atalkd last, since without it the plumbing goes away. - if [ -x :SBINDIR:/atalkd ]; then - killproc atalkd; echo ' atalkd\c' - fi + if [ -x :SBINDIR:/cnid_metad ]; then + killproc cnid_metad; echo ' cnid_metad\c' + fi - echo '.' - ;; + echo '.' + ;; # # Usage statement. # -*) - echo "usage: $0 {start|stop}" - exit 1 - ;; + *) + echo "usage: $0 {start|stop}" + exit 1 + ;; esac diff --git a/distrib/initscripts/rc.atalk.tru64.tmpl b/distrib/initscripts/rc.atalk.tru64.tmpl old mode 100755 new mode 100644 index 0c350af4..e7f7678a --- a/distrib/initscripts/rc.atalk.tru64.tmpl +++ b/distrib/initscripts/rc.atalk.tru64.tmpl @@ -2,31 +2,23 @@ # # Start/stop the Netatalk :NETATALK_VERSION: 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: -ATALK_START_ATALKD=0 -ATALK_START_NBPRGSTR=0 -ATALK_START_PAPD=0 ATALK_START_CNID_METAD=1 ATALK_START_AFPD=1 -ATALK_START_TIMELORD=0 # # kill the named process(es) # killproc() { - pid=`/usr/bin/ps -e | - /usr/bin/grep $1 | - /usr/bin/grep -v grep | - /usr/bin/sed -e 's/^ *//' -e 's/ .*//'` - [ "$pid" != "" ] && kill $pid + pid=`/usr/bin/ps -e | + /usr/bin/grep $1 | + /usr/bin/grep -v grep | + /usr/bin/sed -e 's/^ *//' -e 's/ .*//'` + [ "$pid" != "" ] && kill $pid } case "$1" in @@ -35,77 +27,46 @@ case "$1" in # Start the netatalk server processes. # -'start') - - echo 'starting netatalk daemons: \c' - if [ ${ATALK_START_ATALKD} -eq 1 -a -x ${ATALK_SBIN}/atalkd ]; then - ${ATALK_SBIN}/atalkd; echo ' atalkd\c' - fi - - if [ ${ATALK_START_NBPRGSTR} -eq 1 -a -x ${ATALK_BIN}/nbprgstr ]; then - ${ATALK_BIN}/nbprgstr -p 4 `hostname|sed 's/\..*$//'`:Workstation - ${ATALK_BIN}/nbprgstr -p 4 `hostname|sed 's/\..*$//'`:netatalk - echo ' nbprgstr\c' - fi - - if [ ${ATALK_START_PAPD} -eq 1 -a -x ${ATALK_SBIN}/papd ]; then - ${ATALK_SBIN}/papd; echo ' papd\c' - fi + 'start') - if [ ${ATALK_START_CNID_METAD} -eq 1 -a -x ${ATALK_SBIN}/cnid_metad ]; then - ${ATALK_SBIN}/cnid_metad; echo ' cnid_metad\c' - fi + echo 'starting netatalk daemons: \c' + if [ -x ${ATALK_SBIN}/cnid_metad ]; then + ${ATALK_SBIN}/cnid_metad; echo ' cnid_metad\c' + fi - if [ ${ATALK_START_AFPD} -eq 1 -a -x ${ATALK_SBIN}/afpd ]; then - ${ATALK_SBIN}/afpd; echo ' afpd\c' - fi + if [ -x ${ATALK_SBIN}/afpd ]; then + ${ATALK_SBIN}/afpd; echo ' afpd\c' + fi - if [ ${ATALK_START_TIMELORD} -eq 1 -a -x ${ATALK_SBIN}/timelord ]; then - ${ATALK_SBIN}/timelord; echo ' timelord\c' - fi + echo '.' - echo '.' - - ;; + ;; # # Stop the netatalk server processes. # -'stop') - - echo 'stopping netatalk daemons:\c' - - if [ -x ${ATALK_SBIN}/papd ]; then - killproc papd; echo ' papd\c' - fi - - if [ -x ${ATALK_SBIN}/afpd ]; then - killproc afpd; echo ' afpd\c' - fi + 'stop') - if [ -x ${ATALK_SBIN}/cnid_metad ]; then - killproc cnid_metad; echo ' cnid_metad\c' - fi + echo 'stopping netatalk daemons:\c' - if [ -x ${ATALK_SBIN}/timelord ]; then - killproc timelord; echo ' timelord\c' - fi + if [ -x ${ATALK_SBIN}/afpd ]; then + killproc afpd; echo ' afpd\c' + fi - # kill atalkd last, since without it the plumbing goes away. - if [ -x ${ATALK_SBIN}/atalkd ]; then - killproc atalkd; echo ' atalkd\c' - fi + if [ -x ${ATALK_SBIN}/cnid_metad ]; then + killproc cnid_metad; echo ' cnid_metad\c' + fi - echo '.' - ;; + echo '.' + ;; # # Usage statement. # -*) - echo "usage: $0 {start|stop}" - exit 1 - ;; + *) + echo "usage: $0 {start|stop}" + exit 1 + ;; esac diff --git a/distrib/initscripts/rc.atalkd.netbsd.tmpl b/distrib/initscripts/rc.atalkd.netbsd.tmpl deleted file mode 100644 index d531204b..00000000 --- a/distrib/initscripts/rc.atalkd.netbsd.tmpl +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh -# -# PROVIDE: atalkd -# REQUIRE: DAEMON -# -# AppleTalk daemon. (netatalk :NETATALK_VERSION:) -# 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. -# - -. /etc/rc.subr - -name="atalkd" -rcvar=$name -command=":SBINDIR:/atalkd" -pidfile="/var/run/${name}.pid" -register=":BINDIR:/nbprgstr" -myhostname=`hostname|sed 's/\..*$//'` -required_files=":ETCDIR:/atalkd.conf $register" - -start_cmd="atalkd_start" - -atalkd_start() -{ - if [ -x $command ]; then - echo 'Starting atalkd.' - $command $command_args - fi - - if [ -x $register ]; then - echo 'Setting AppleTalk info with nbprgstr.' - $register -p 4 $myhostname:Workstation - $register -p 4 $myhostname:netatalk - fi -} - -load_rc_config $name -run_rc_command "$1" - diff --git a/distrib/initscripts/rc.cnid_metad.netbsd.tmpl b/distrib/initscripts/rc.cnid_metad.netbsd.tmpl index caeba08e..2da0dcfe 100644 --- a/distrib/initscripts/rc.cnid_metad.netbsd.tmpl +++ b/distrib/initscripts/rc.cnid_metad.netbsd.tmpl @@ -2,7 +2,8 @@ # # PROVIDE: cnid_metad # -# Start cnid_dbd daemons on request. (netatalk :NETATALK_VERSION:) +# CNID database daemon for AFP fileserver (netatalk :NETATALK_VERSION:) +# Start cnid_dbd daemons on request. # The cnid_dbd is an implementation for accessing to CNID databases # through a dedicated daemon process. # diff --git a/distrib/initscripts/rc.papd.netbsd.tmpl b/distrib/initscripts/rc.papd.netbsd.tmpl deleted file mode 100644 index f32cb7cb..00000000 --- a/distrib/initscripts/rc.papd.netbsd.tmpl +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -# -# PROVIDE: papd -# REQUIRE: atalkd -# -# AppleTalk print server daemon. (netatalk :NETATALK_VERSION:) -# Make sure not to start atalkd in the background: -# its data structures must have time to stablize before running the -# other processes. -# - -. /etc/rc.subr - -name="papd" -rcvar=$name -command=":SBINDIR:/papd" -pidfile="/var/run/${name}.pid" -required_files=":ETCDIR:/papd.conf" - -load_rc_config $name -run_rc_command "$1" - diff --git a/distrib/initscripts/rc.timelord.netbsd.tmpl b/distrib/initscripts/rc.timelord.netbsd.tmpl deleted file mode 100644 index aae4b7a3..00000000 --- a/distrib/initscripts/rc.timelord.netbsd.tmpl +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# -# PROVIDE: timelord -# REQUIRE: atalkd -# -# AppleTalk time server daemon. (netatalk :NETATALK_VERSION:) -# Make sure not to start atalkd in the background: -# its data structures must have time to stablize before running the -# other processes. -# - -. /etc/rc.subr - -name="timelord" -rcvar=$name -command=":SBINDIR:/timelord" -pidfile="/var/run/${name}.pid" - -load_rc_config $name -run_rc_command "$1" - diff --git a/distrib/systemd/netatalk-cnid.service b/distrib/initscripts/service.atalk-cnid.systemd.tmpl similarity index 72% rename from distrib/systemd/netatalk-cnid.service rename to distrib/initscripts/service.atalk-cnid.systemd.tmpl index 8edfcbab..93da2a58 100644 --- a/distrib/systemd/netatalk-cnid.service +++ b/distrib/initscripts/service.atalk-cnid.systemd.tmpl @@ -1,5 +1,4 @@ -# This is experimental service file. -# See distrib/systemd/README +# This file is part of netatalk :NETATALK_VERSION:. [Unit] Description=Netatalk CNID database daemon for AFP fileserver @@ -10,7 +9,7 @@ Requires=netatalk.service [Service] Type=forking GuessMainPID=no -ExecStart=/usr/sbin/cnid_metad -l log_note +ExecStart=:SBINDIR:/cnid_metad Restart=always RestartSec=1 diff --git a/distrib/initscripts/service.atalk.systemd.tmpl b/distrib/initscripts/service.atalk.systemd.tmpl index 794baa56..6d42ed9e 100644 --- a/distrib/initscripts/service.atalk.systemd.tmpl +++ b/distrib/initscripts/service.atalk.systemd.tmpl @@ -1,17 +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 slpd.service avahi-daemon.service +Description=Netatalk AFP fileserver for Macintosh clients +After=syslog.target network.target avahi-daemon.service netatalk-cnid.service +Requires=netatalk-cnid.service [Service] -Type=oneshot -ExecStart=/bin/sh -c "exec :PKGLIBEXECDIR:/netatalk.sh" -RemainAfterExit=yes +Type=forking +GuessMainPID=no +ExecStart=:SBINDIR:/afpd +Restart=always +RestartSec=1 [Install] WantedBy=multi-user.target +Also=netatalk-cnid.service diff --git a/distrib/systemd/Makefile.am b/distrib/systemd/Makefile.am deleted file mode 100644 index 2fad3e55..00000000 --- a/distrib/systemd/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ -# Makefile for distrib/systemd/ - -EXTRA_DIST = README netatalk.service netatalk-cnid.service diff --git a/distrib/systemd/README b/distrib/systemd/README deleted file mode 100644 index 15c83bf1..00000000 --- a/distrib/systemd/README +++ /dev/null @@ -1,25 +0,0 @@ -The service file of the current Netatalk is not appropriate because it use -a shell-script "netatalk.sh". - -Two experimental files are for future netatalk 3.0. - - netatalk.service - netatalk-cnid.service - -You can control starting/stopping by netatalk.service only -because netatalk-cnid.service is controlled automatically. - - # systemctl enable|disable netatalk.service - # systemctl start|stop|restart netatalk.service - -These files start daemons directly and do not read "netatalk.conf". -Therefore, you need to edit files for setting options. - - ATALK_NAME: set in afpd.conf instead - AFPD_MAX_CLIENTS: set in netatalk.service by using -c - AFPD_UAMLIST: set in afpd.conf instead - AFPD_GUEST: set in afpd.conf instead - CNID_CONFIG: set in netatalk-cnid.service by using -l and -f options - -There are no service files for atalkd, papd, timelord and a2boot -because AppleTalk feature is due to be abolished in netatalk 3.0. diff --git a/distrib/systemd/netatalk.service b/distrib/systemd/netatalk.service deleted file mode 100644 index 7c6857c1..00000000 --- a/distrib/systemd/netatalk.service +++ /dev/null @@ -1,18 +0,0 @@ -# This is experimental service file. -# See distrib/systemd/README - -[Unit] -Description=Netatalk AFP fileserver for Macintosh clients -After=syslog.target network.target slpd.service avahi-daemon.service netatalk-cnid.service -Requires=netatalk-cnid.service - -[Service] -Type=forking -GuessMainPID=no -ExecStart=/usr/sbin/afpd -c 20 -Restart=always -RestartSec=1 - -[Install] -WantedBy=multi-user.target -Also=netatalk-cnid.service -- 2.39.2