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