mirror of
				git://git.openwrt.org/openwrt/openwrt.git
				synced 2025-11-03 22:44:27 -05:00 
			
		
		
		
	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>
SVN-Revision: 10536
This commit is contained in:
		
							parent
							
								
									53d0423381
								
							
						
					
					
						commit
						603f612d83
					
				@ -1,12 +1,52 @@
 | 
				
			|||||||
#!/bin/sh /etc/rc.common
 | 
					#!/bin/sh /etc/rc.common
 | 
				
			||||||
# Copyright (C) 2006 OpenWrt.org
 | 
					# Copyright (C) 2006 OpenWrt.org
 | 
				
			||||||
 | 
					
 | 
				
			||||||
START=50
 | 
					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() {
 | 
					start() {
 | 
				
			||||||
	include /lib/network
 | 
						[ -x "$HTTPD_BIN" ] || return 1
 | 
				
			||||||
	scan_interfaces
 | 
					
 | 
				
			||||||
        config_get ifname wan hostname
 | 
						unset hostname
 | 
				
			||||||
	[ -d /www ] && httpd -p 80 -h /www -r ${hostname:-OpenWrt}
 | 
						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() {
 | 
					stop() {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user