mtd: bump release
[openwrt.git] / package / busybox / files / httpd
1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2006 OpenWrt.org
3
4 START=50
5 HTTPD_BIN="/usr/sbin/httpd"
6
7 system_config() {
8 local cfg="$1"
9
10 config_get hostname "$cfg" hostname
11 }
12
13 httpd_config() {
14 local cfg="$1"
15 local c_file port realm home args
16
17 config_get c_file "$cfg" c_file
18 [ -n "$c_file" -a -f "$c_file" ] && append args "-c \"$c_file\""
19 config_get port "$cfg" port
20 append args "-p ${port:-80}"
21 config_get home "$cfg" home
22 home="${home:-/www}"
23 [ -d "$home" ] || return 1
24 append args "-h \"$home\""
25 config_get realm "$cfg" realm
26 realm="${realm:-$hostname}"
27 append args "-r \"$realm\""
28 eval "$HTTPD_BIN $args"
29 }
30
31 start() {
32 [ -x "$HTTPD_BIN" ] || return 1
33
34 unset hostname
35 config_load system
36 config_foreach system_config system
37 hostname="${hostname:-OpenWrt}"
38
39 unset args
40 config_load httpd
41 [ "$?" != "0" ] && {
42 uci_set_default httpd <<EOF
43 config 'httpd'
44 option 'port' '80'
45 option 'home' '/www'
46 EOF
47 config_load httpd
48 }
49 config_foreach httpd_config httpd
50 }
51
52 stop() {
53 killall httpd
54 }
This page took 0.040877 seconds and 5 git commands to generate.