]> git.pld-linux.org Git - packages/systemd.git/commitdiff
- added support for pre_start/post_stop scripts
authorJan Rękorajski <baggins@pld-linux.org>
Sun, 10 Jun 2012 11:07:25 +0000 (11:07 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    pld-rc-inetd-generator.sh -> 1.3

pld-rc-inetd-generator.sh

index 10859a2385becf1485d4a0c131d9993c9cd4e872..d4ac416079dcb335c25307c03919a5a8863eeef5 100644 (file)
@@ -1,8 +1,5 @@
 #!/bin/sh
-#
-# TODO:
-#      pre_start_service() and pre_stop_service()
-#
+
 parse_one_service() {
        SOCKET_FILE="${CURRENT_SERVICE}.socket"
        SERVICE_FILE="${CURRENT_SERVICE}.service"
@@ -78,6 +75,22 @@ parse_one_service() {
                echo "$DAEMONARGS" >>$SERVICE_FILE
        fi
 
+       if typeset -f pre_start_service 2>&1 >/dev/null ; then
+               echo "#!/bin/sh" >${CURRENT_SERVICE}_pre_start.sh
+               typeset -f pre_start_service >>${CURRENT_SERVICE}_pre_start.sh
+               echo "pre_start_service" >>${CURRENT_SERVICE}_pre_start.sh
+               chmod u+x ${CURRENT_SERVICE}_pre_start.sh
+               echo "ExecStartPre=${CURRENT_SERVICE}_pre_start.sh" >>$SERVICE_FILE
+       fi
+
+       if typeset -f pre_stop_service 2>&1 >/dev/null ; then
+               echo "#!/bin/sh" >${CURRENT_SERVICE}_post_stop.sh
+               typeset -f pre_stop_service >>${CURRENT_SERVICE}_post_stop.sh
+               echo "pre_stop_service" >>${CURRENT_SERVICE}_post_stop.sh
+               chmod u+x ${CURRENT_SERVICE}_post_stop.sh
+               echo "ExecStopPost=${CURRENT_SERVICE}_post_stop.sh" >>$SERVICE_FILE
+       fi
+
        echo >>$SERVICE_FILE
        echo "[Install]" >>$SERVICE_FILE
        echo "Also=${CURRENT_SERVICE}.socket" >>$SERVICE_FILE
This page took 0.367633 seconds and 4 git commands to generate.