1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2015 OpenWrt.org
10 config_get repository
"$cfg" repository
11 if [ -z "$repository" ]; then
12 echo "repository is not defined in $1, skipping"
16 config_get_bool create
"$cfg" create
0
18 if [ "$create" -eq 0 -a ! -f "$repository" ]; then
19 echo "in $1 create option is '$create' and repository '$repository' is not a regular file, skipping"
23 if [ "$create" -eq 1 -a ! -d `dirname $repository` ]; then
24 mkdir
-p `dirname $repository`
25 if [ "$?" -ne 0 ]; then
26 echo "could not create directory, skipping"
31 config_get port
"$cfg" port
""
32 if [ -z "$port" ]; then
33 echo "port is not defined in $1, skipping"
37 config_get_bool debug
"$cfg" debug
0
38 config_get_bool localhost
"$cfg" localhost
1
39 config_get_bool scgi
"$cfg" scgi
0
42 procd_set_param
command /usr
/bin
/fossil server
"$repository" --port $port
43 [ "$debug" -eq 1 ] && procd_append_param
command --th-trace
44 [ "$create" -eq 1 ] && procd_append_param
command --user root
--create
45 [ "$localhost" -eq 1 ] && procd_append_param
command --localhost
46 [ "$scgi" -eq 1 ] && procd_append_param
command --scgi
47 procd_set_param respawn
53 config_foreach start_instance
'server'