[Packages] Fix init script props
[packages.git] / net / subversion / files / subversion.init
1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2006 OpenWrt.org
3 START=50
4
5 start_service () {
6         local section="$1"
7         config_get path "$section" path
8         config_get port "$section" port
9
10         if [ ! -d "$path" ]; then
11                 echo "The subversion repository (${path}) does not exist."
12                 echo "Create a new repository and/or change the path in /etc/config/subversion"
13                 echo
14                 echo "Create a new subversion repository with:"
15                 echo "        mkdir -p /srv"
16                 echo "        svnadmin create --fs-type fsfs /srv/svn"
17                 echo
18                 echo "Changing the path using UCI (default path is: /var/local/svn):"
19                 echo "        uci set subversion.cfg1.path="/srv/svn""
20                 echo "        uci commit"
21                 echo "        /etc/init.d/subversion restart"
22                 exit 1
23         fi
24
25         svnserve -d --listen-port ${port} -r ${path}
26 }
27
28 start() {
29         config_load "subversion"
30         config_foreach start_service subversion
31 }
32
33 stop() {
34         killall -9 svnserve
35 }
36
37 restart() {
38         stop
39         start
40 }