]> arthur.barton.de Git - netatalk.git/commitdiff
systemd initscript: some fixes
authorHAT <hat@fa2.so-net.ne.jp>
Sun, 28 Aug 2011 15:51:42 +0000 (00:51 +0900)
committerHAT <hat@fa2.so-net.ne.jp>
Sun, 28 Aug 2011 15:51:42 +0000 (00:51 +0900)
distrib/initscripts/Makefile.am
distrib/initscripts/rc.atalk.redhat-systemd.tmpl
distrib/initscripts/service.atalk.redhat-systemd.tmpl

index 3ff9246b4b93542efdca39db4c76af3f3a1c3451..85eb8f44c27185d8662a97782ce975aac03e3cc5 100644 (file)
@@ -98,12 +98,13 @@ $(service_DATA): service.atalk.redhat-systemd
        cp -f service.atalk.redhat-systemd $(service_DATA)
 
 install-data-hook:
-       -systemctl enable $(sysv_SCRIPTS)
+       -systemctl daemon-reload
 
 uninstall-startup:
-       -systemctl disable $(sysv_SCRIPTS)
+       -systemctl disable $(service_DATA)
        rm -f $(DESTDIR)$(sysvdir)/$(sysv_SCRIPTS)      \
                $(DESTDIR)$(servicedir)/$(service_DATA)
+       -systemctl daemon-reload
 
 endif
 
index e05972b3d7e72e229b99b1353e234295db7084ba..7468d3a71eb3dfbdbbdd88a5656bfe1588321c85 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# Netatalk daemons.
+# Netatalk startup script for systemd.
 
 ATALK_BIN=:BINDIR:
 ATALK_CONF_DIR=:ETCDIR:
@@ -30,44 +30,52 @@ 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
+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
+    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
+    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}
+            -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
index 57316299362797a426ece99e5660fb37f18ac12d..034e5fb2f6eefe2cc22df54ad7395d441a1f4f07 100644 (file)
@@ -1,4 +1,4 @@
-# netatalk service file for systemd
+# This file is part of netatalk.
 
 [Unit]
 Description=File and Printer sharing for Macintosh clients
@@ -6,7 +6,7 @@ After=syslog.target network.target
 
 [Service]
 Type=oneshot
-ExecStart=/bin/bash -c "exec :PKGLIBEXECDIR:/netatalk.sh"
+ExecStart=/bin/sh -c "exec :PKGLIBEXECDIR:/netatalk.sh"
 RemainAfterExit=yes
 
 [Install]