From 23052d8f013188302dd9faee47f6911e4ed0e1e1 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sun, 21 Mar 2010 02:35:28 +0000 Subject: [PATCH] uhttpd: complete init script and sample configuration --- contrib/package/uhttpd/files/uhttpd.config | 7 ++++++- contrib/package/uhttpd/files/uhttpd.init | 8 ++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/contrib/package/uhttpd/files/uhttpd.config b/contrib/package/uhttpd/files/uhttpd.config index 97a43f4c0..9c4cd305b 100644 --- a/contrib/package/uhttpd/files/uhttpd.config +++ b/contrib/package/uhttpd/files/uhttpd.config @@ -10,7 +10,7 @@ config uhttpd main # CGI url prefix, will be searched in docroot. # Default is /cgi-bin - option cgi_prefix /cgi-bin + option cgi_prefix /cgi-bin # Lua url prefix and handler script. # Lua support is disabled if no prefix given. @@ -25,3 +25,8 @@ config uhttpd main list listen_https 0.0.0.0:443 # list listen_https [::]:443 + # Basic auth realm, defaults to local hostname +# option realm OpenWrt + + # Configuration file in busybox httpd format +# option config /etc/httpd.conf diff --git a/contrib/package/uhttpd/files/uhttpd.init b/contrib/package/uhttpd/files/uhttpd.init index 08c6a3929..b13cd60f3 100755 --- a/contrib/package/uhttpd/files/uhttpd.init +++ b/contrib/package/uhttpd/files/uhttpd.init @@ -18,10 +18,11 @@ append_arg() { local cfg="$1" local var="$2" local opt="$3" + local def="$4" local val config_get val "$cfg" "$var" - [ -n "$val" ] && append UHTTPD_ARGS "$opt $val" + [ -n "$val" -o -n "$def" ] && append UHTTPD_ARGS "$opt ${val:-$def}" } start_instance() @@ -29,10 +30,13 @@ start_instance() UHTTPD_ARGS="" local cfg="$1" + local realm="$(uci get system.@system[0].hostname 2>/dev/null)" local ssl append_arg "$cfg" home "-h" - append_arg "$cfg" cgi_prefix "-c" + append_arg "$cfg" realm "-r" "${realm:-OpenWrt}" + append_arg "$cfg" config "-c" + append_arg "$cfg" cgi_prefix "-x" append_arg "$cfg" lua_prefix "-l" append_arg "$cfg" lua_handler "-L" -- 2.25.1