packages/subversion: use new service functions
[packages.git] / net / subversion / files / subversion.init
index 6b24f58..c2bcc07 100644 (file)
@@ -1,11 +1,12 @@
 #!/bin/sh /etc/rc.common
-# Copyright (C) 2006 OpenWrt.org
+# Copyright (C) 2006-2011 OpenWrt.org
+
 START=50
 
-start_service () {
+start_instance () {
        local section="$1"
-       config_get path "$section" path
-       config_get port "$section" port
+       config_get path "$section" 'path'
+       config_get port "$section" 'port'
 
        if [ ! -d "$path" ]; then
                echo "The subversion repository (${path}) does not exist."
@@ -16,20 +17,21 @@ start_service () {
                echo "        svnadmin create --fs-type fsfs /srv/svn"
                echo
                echo "Changing the path using UCI (default path is: /var/local/svn):"
-               echo "        uci set subversion.cfg1.path="/srv/svn""
+               echo "        uci set subversion.@[0].path="/srv/svn""
                echo "        uci commit"
                echo "        /etc/init.d/subversion restart"
-               exit 1
+               return 1
        fi
 
-       svnserve -d --listen-port ${port} -r ${path}
+       service_start /usr/bin/svnserve -d --listen-port ${port} -r ${path}
 }
 
 start() {
-       config_load "subversion"
-       config_foreach start_service subversion
+       config_load 'subversion'
+       config_foreach start_instance 'subversion'
 }
 
 stop() {
-       killall -9 svnserve
+       SERVICE_SIG_STOP="INT" \
+       service_stop /usr/bin/svnserve
 }