[DIRECTFB] Placeholder
[openwrt/mini2440.git] / package / busybox / files / httpd
blob3714a02de552b4d5e150ab659c4d4bdc61ead557
1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2006 OpenWrt.org
4 START=50
5 HTTPD_BIN="/usr/sbin/httpd"
7 system_config() {
8 local cfg="$1"
10 config_get hostname "$cfg" hostname
13 httpd_config() {
14 local cfg="$1"
15 local c_file port realm home args
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"
31 start() {
32 [ -x "$HTTPD_BIN" ] || return 1
34 unset hostname
35 config_load system
36 config_foreach system_config system
37 hostname="${hostname:-OpenWrt}"
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
49 config_foreach httpd_config httpd
52 stop() {
53 killall httpd