b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 1 | #!/bin/sh /etc/rc.common |
| 2 | # Copyright (C) 2006-2016 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 ${path}" |
| 17 | echo " svnadmin create --fs-type fsfs ${path}" |
| 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 | } |