X-Git-Url: http://git.ozo.com/?a=blobdiff_plain;f=package%2Fbusybox%2Ffiles%2Fhttpd;h=f7e166d0ad06cbe31774ac82d4242e5457ca9cb4;hb=41d62be633139751f8188f4541a9ded605f360d0;hp=35b7f62948821547b4f27a45d141edefcb462933;hpb=b2f43424402231050937792fb8b78d0184643a98;p=openwrt-10.03%2F.git diff --git a/package/busybox/files/httpd b/package/busybox/files/httpd index 35b7f6294..f7e166d0a 100755 --- a/package/busybox/files/httpd +++ b/package/busybox/files/httpd @@ -1,12 +1,52 @@ #!/bin/sh /etc/rc.common # Copyright (C) 2006 OpenWrt.org + START=50 +HTTPD_BIN="/usr/sbin/httpd" + +system_config() { + local cfg="$1" + + config_get hostname "$cfg" hostname +} + +httpd_config() { + local cfg="$1" + local c_file port realm home + + config_get c_file "$cfg" c_file + [ -n "$c_file" -a -f "$c_file" ] && append args "-c \"$c_file\"" + config_get port "$cfg" port + append args "-p ${port:-80}" + config_get home "$cfg" home + home="${home:-/www}" + [ -d "$home" ] || return 1 + append args "-h \"$home\"" + config_get realm "$cfg" realm + realm="${realm:-$hostname}" + append args "-r \"$realm\"" + eval "$HTTPD_BIN $args" +} start() { - include /lib/network - scan_interfaces - config_get ifname wan hostname - [ -d /www ] && httpd -p 80 -h /www -r ${hostname:-OpenWrt} + [ -x "$HTTPD_BIN" ] || return 1 + + unset hostname + config_load system + config_foreach system_config system + hostname="${hostname:-OpenWrt}" + + unset args + config_load httpd + [ "$?" != "0" ] && { + uci_set_default httpd <