aboutsummaryrefslogtreecommitdiffstats
path: root/package/busybox
diff options
context:
space:
mode:
authorTravis Kemen <thepeople@openwrt.org>2008-02-28 19:56:09 +0000
committerTravis Kemen <thepeople@openwrt.org>2008-02-28 19:56:09 +0000
commitddd9272aa0b1da09f6cff4c90a5a211db7c15849 (patch)
tree14e707782827f718f2d1e9517b86035d345913ca /package/busybox
parentdae8207a65f7e4af3fd3f43273e6667a49ec738d (diff)
downloadupstream-ddd9272aa0b1da09f6cff4c90a5a211db7c15849.tar.gz
upstream-ddd9272aa0b1da09f6cff4c90a5a211db7c15849.tar.bz2
upstream-ddd9272aa0b1da09f6cff4c90a5a211db7c15849.zip
Fix a wrong variable names (ifname, wan) and enhance httpd's init script by more configurable options. Signed-off-by: Lubos Stanek (lubek) <lubek@lubek.name>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@10536 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/busybox')
-rwxr-xr-xpackage/busybox/files/httpd48
1 files changed, 44 insertions, 4 deletions
diff --git a/package/busybox/files/httpd b/package/busybox/files/httpd
index 35b7f62948..f7e166d0ad 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 <<EOF
+config 'httpd'
+ option 'port' '80'
+ option 'home' '/www'
+EOF
+ config_load httpd
+ }
+ config_foreach httpd_config httpd
}
stop() {