File paths.diff of Package webif

Index: webif_0.3-8/usr/lib/webif/webif.sh
===================================================================
--- webif_0.3-8.orig/usr/lib/webif/webif.sh
+++ webif_0.3-8/usr/lib/webif/webif.sh
@@ -14,31 +14,28 @@
 # Configuration files referenced:
 #
 #
 
-libdir=/usr/lib/webif
-wwwdir=/www
-cgidir=/www/cgi-bin/webif
-rootdir=/cgi-bin/webif
-indexpage=index.sh
-. /usr/lib/webif/functions.sh
-. /lib/config/uci.sh
+confdir=/etc/webif
+. $confdir/webif-paths.sh
+. $libdir/functions.sh
+. $libdir/config/uci.sh
 
 categories() {
 	grep '##WEBIF:' $cgidir/.categories $cgidir/*.sh 2>/dev/null | \
 		awk -v "selected=$1" \
 			-v "rootdir=$rootdir" \
 			-v "indexpage=$indexpage" \
-			-f /usr/lib/webif/categories.awk -
+			-f $libdir/categories.awk -
 }
 
 subcategories() {
 	grep -H "##WEBIF:name:$1:" $cgidir/*.sh 2>/dev/null | \
 		sed -e 's,^.*/\([a-zA-Z\.\-]*\):\(.*\)$,\2:\1,' | \
 		sort -n | \
 		awk -v "selected=$2" \
 			-v "rootdir=$rootdir" \
-			-f /usr/lib/webif/subcategories.awk -
+			-f $libdir/subcategories.awk -
 }
 
 ShowWIPWarning() {
 	echo "<div class=\"warning\">@TR<<big_warning#WARNING>>: @TR<<page_incomplete#This page is incomplete and may not work correctly, or at all.>></div>"
@@ -125,11 +122,11 @@ header() {
 	_use_apply_progressbar="$CONFIG_general_use_apply_progressbar"
 	_uptime="$(uptime)"
 	_loadavg="${_uptime#*load average: }"
 	_uptime="${_uptime#*up }"
-	_uptime="${_uptime%%, load *}"
+	_uptime="${_uptime%%,  load *}"
 	_hostname=$(cat /proc/sys/kernel/hostname)
-	_webif_rev=$(cat /www/.version)
+	_webif_rev=$(cat $wwwdir/.version)
 	_head="${3:+<h2>$3$_saved_title</h2>}"
 	_form="${5:+<form enctype=\"multipart/form-data\" action=\"$5\" method=\"post\"><input type=\"hidden\" name=\"submit\" value=\"1\" />}"
 	_savebutton="${5:+<div class=\"page-save\"><input type=\"submit\" name=\"action\" value=\"@TR<<Save Changes>>\" /></div>}"        
 	_categories=$(categories $1)
@@ -306,11 +303,11 @@ apply_passwd() {
 }
 
 display_form() {
 	if empty "$1"; then
-		awk -F'|' -f /usr/lib/webif/common.awk -f /usr/lib/webif/form.awk
+		awk -F'|' -f $libdir/common.awk -f $libdir/form.awk
 	else
-		echo "$1" | awk -F'|' -f /usr/lib/webif/common.awk -f /usr/lib/webif/form.awk
+		echo "$1" | awk -F'|' -f $libdir/common.awk -f $libdir/form.awk
 	fi
 }
 
 list_remove() {
Index: webif_0.3-8/usr/lib/webif/functions.sh
===================================================================
--- webif_0.3-8.orig/usr/lib/webif/functions.sh
+++ webif_0.3-8/usr/lib/webif/functions.sh
@@ -3,9 +3,11 @@
 # Webif^2 utility functions - X-Wrt
 #
 # This file is compatible with White Russian and Kamikaze.
 #
-. /etc/functions.sh
+. /etc/webif/webif-paths.sh
+. $libdir/config/functions.new
+. $libdir/config/functions-net.sh
 [ -f /etc/functions_ex.sh ] && {
 . /etc/functions_ex.sh
 }
 
@@ -46,9 +48,9 @@ is_bcm947xx() {
 }
 
 is_kamikaze() {
 	# todo: switch to a more reliable check of kamikaze
-	[ -s "/etc/config/network" ] || grep -iq "KAMIKAZE" "/etc/banner"
+	[ -s "/etc/webif/network" ] || grep -iq "KAMIKAZE" "/etc/banner"
 }
 
 has_nvram_support() {
 	exists "/usr/sbin/nvram"
@@ -91,9 +93,9 @@ mkuniqfilename() {
 #  the changes.
 #
 load_settings() {
 	equal "$1" "nvram" || {
-		exists /etc/config/$1 && . /etc/config/$1
+		exists /etc/webif/$1 && . /etc/webif/$1
 	}
 	exists /tmp/.webif/config-$1 && . /tmp/.webif/config-$1
 }
 
@@ -116,11 +118,11 @@ save_setting() {
 # validate form variables using validate.awk
 #
 validate() {
 	if empty "$1"; then
-		eval "$(awk -f /usr/lib/webif/validate.awk)"
+		eval "$(awk -f $libdir/validate.awk)"
 	else
-		eval "$(echo "$1" | awk -f /usr/lib/webif/validate.awk)"
+		eval "$(echo "$1" | awk -f $libdir/validate.awk)"
 	fi
 }
 
 #
Index: webif_0.3-8/etc/functions.new
===================================================================
--- webif_0.3-8.orig/etc/functions.new
+++ webif_0.3-8/etc/functions.new
@@ -1,9 +1,9 @@
 #!/bin/sh
 # Copyright (C) 2006 OpenWrt.org
 # Copyright (C) 2006 Fokus Fraunhofer <carsten.tittel@fokus.fraunhofer.de>
 
-. /lib/config/uci-depends.sh
+. /usr/lib/webif/config/uci-depends.new
 
 alias debug=${DEBUG:-:}
 
 # valid interface?
Index: webif_0.3-8/bin/uci
===================================================================
--- webif_0.3-8.orig/bin/uci
+++ webif_0.3-8/bin/uci
@@ -17,13 +17,13 @@
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
-. /etc/functions.sh
+. /usr/lib/webif/config/functions.new
 [ -f "/etc/functions_ex.sh" ] && {
 . /etc/functions_ex.sh
 }
-include /lib/config
+include /usr/lib/webif/config
 
 SEP="[^0-9A-Za-z_]"
 
 do_get() {
@@ -104,9 +104,9 @@ do_show() {
 		uci_usage show
 		exit 1
 	}
 	
-	for package in ${PACKAGE:-$(cd /etc/config; ls)}; do
+	for package in ${PACKAGE:-$(cd /etc/webif; ls)}; do
 		SECTION=""
 	
 		config_cb() {
 			if [ -z "$CONFIG" -o "$CONFIG" = "$2" ]; then
Index: webif_0.3-8/usr/lib/webif/webif-mklanglist.sh
===================================================================
--- webif_0.3-8.orig/usr/lib/webif/webif-mklanglist.sh
+++ webif_0.3-8/usr/lib/webif/webif-mklanglist.sh
@@ -1,15 +1,25 @@
 #!/bin/sh
+. /etc/webif/webif-paths.sh
 LANGLIST_NEEDS_UPDATE=0
-languages_root="/etc/languages.root"
-languages_lst="/etc/languages.lst"
+languages_root="/etc/webif/languages.root"
+languages_lst="/etc/webif/languages.lst"
+
 if [ ! -f "$languages_lst" ]; then
-	cp -pf "$languages_root" "$languages_lst" 2>/dev/null
+	#cp -pf "$languages_root" "$languages_lst" 2>/dev/null
+	echo "option|en|English" $languages_lst
+	for nm in $libdir/lang/*/common.txt; do
+		ln=${nm%/common.txt}
+		if test -h $ln; then continue; fi
+		ln=${ln##*/}
+		echo "option|$ln|$ln" >> $languages_lst
+	done
 fi
+
 # rebuild the language list only after ipkg update
-for listfile in $(ls /usr/lib/ipkg/lists/* 2>/dev/null); do
-	[ "$listfile" -nt "$languages_lst" ] && LANGLIST_NEEDS_UPDATE=1
-done
+#for listfile in $(ls /usr/lib/ipkg/lists/* 2>/dev/null); do
+#	[ "$listfile" -nt "$languages_lst" ] && LANGLIST_NEEDS_UPDATE=1
+#done
 if [ "$LANGLIST_NEEDS_UPDATE" -eq "1" ]; then
 	tmplanglst=$(mktemp "/tmp/.webif-XXXXXX")
 	version_current=$(ipkg list_installed webif | grep "^webif -" | cut -d' ' -f3 | sed 's/\./\./')
 	for lngpkg in $(ipkg list webif-lang-* | sed "/webif-lang-[^[:space:]]* - ${version_current} -/!d; s/webif-lang-\([^[:space:]]*\)[[:space:]]-[[:space:]]${version_current}[[:space:]]-[[:space:]]\([^[:space:]]*\).*/option\|\1\|\2/"); do
Index: webif_0.3-8/usr/lib/webif/webif-mkthemelist.sh
===================================================================
--- webif_0.3-8.orig/usr/lib/webif/webif-mkthemelist.sh
+++ webif_0.3-8/usr/lib/webif/webif-mkthemelist.sh
@@ -1,7 +1,19 @@
 #!/bin/sh
-themes_lst="/etc/themes.lst"
+. /etc/webif/webif-paths.sh
+themes_lst="/etc/webif/themes.lst"
 tmpthemeslst=$(mktemp "/tmp/.webif-XXXXXX")
+if test ! -f $themes_lst; then
+	0> $themes_lst
+	for nm in $wwwdir/themes/*/name; do
+		name=$(cat $nm)
+		th=${nm%/name}
+		if test -h $th; then continue; fi
+		th=${th##*/}
+		echo "option|$th|$name" >> $themes_lst
+	done
+fi
+if false; then
 ipkg list | awk '/webif-theme/ { gsub("webif-theme-",""); print "option|"$1"|"$5}' | sort | uniq >> "$tmpthemeslst"
 if [ "'cat $tmpthemeslst'" != "" ]; then
 	if [ "'cat $tmpthemeslst'" != "'cat $themes_lst'" ]; then
 		rm -f "$themes_lst"
@@ -9,4 +21,5 @@ if [ "'cat $tmpthemeslst'" != "" ]; then
 		mv -f "$tmpthemeslst" "$themes_lst"
 	fi
 fi
 rm -f $tmpthemeslst
+fi
Index: webif_0.3-8/usr/lib/webif/apply.sh
===================================================================
--- webif_0.3-8.orig/usr/lib/webif/apply.sh
+++ webif_0.3-8/usr/lib/webif/apply.sh
@@ -9,10 +9,11 @@
 #	file-*		Undefined format for whatever
 #	edited-files-*  raw edited files
 #
 #
-. /usr/lib/webif/functions.sh
-. /lib/config/uci.sh
+. /etc/webif/webif-paths.sh
+. $libdir/functions.sh
+. $libdir/config/uci.sh
 cron_init="/etc/init.d/S60cron"
 
 # log apply messages to syslog
 apply_enable_logging="0"
@@ -34,18 +35,18 @@ HANDLERS_config='
 
 HANDLERS_file='
 	dnsmasq.conf) mv /tmp/.webif/file-dnsmasq.conf /etc/dnsmasq.conf && restart_dnsmasq;;
 	ethers) rm -f /etc/ethers; mv $config /etc/ethers; reload_dnsmasq;;
-	firewall) mv /tmp/.webif/file-firewall /etc/config/firewall && reload_firewall;;
+	firewall) mv /tmp/.webif/file-firewall /etc/webif/firewall && reload_firewall;;
 	hosts) rm -f /etc/hosts; mv $config /etc/hosts; reload_dnsmasq;;
 '
 
 HANDLERS_edited_file='
 	/etc/dnsmasq.conf) restart_dnsmasq;;
 	/etc/ethers) reload_dnsmasq;;
 	/etc/firewall.user) reload_firewall;;
 	/etc/hosts) reload_dnsmasq;;
-	/etc/config/firewall) reload_firewall;;
+	/etc/webif/firewall) reload_firewall;;
 	/etc/crontabs/root) restart_cron;;
 '
 
 HANDLERS_uci='
@@ -88,9 +89,9 @@ echo_action_done() {
 	log_message "@TR<<apply_Done#Done>>." "$2"
 }
 
 # for some reason a for loop with "." doesn't work
-eval "$(cat /usr/lib/webif/apply-*.sh 2>&-)"
+eval "$(cat $libdir/apply-*.sh 2>&-)"
 
 reload_dnsmasq() {
 	echo_reloading_settings "@TR<<apply_dnsmasq#dnsmasq>>"
 	killall -q -HUP dnsmasq
@@ -433,20 +434,23 @@ switch_language() {
 init_theme() {
 	! equal "$CONFIG_theme_id" "$CONFIG_orig_theme_id" && {
 		log_message "@TR<<apply_Initializing_theme#Initializing theme>>"
 		# if theme isn't present, then install it		
-		! exists "/www/themes/$CONFIG_theme_id/webif.css" && {
+		! exists "$wwwdir/themes/$CONFIG_theme_id/webif.css" && {
 			install_package "webif-theme-$CONFIG_theme_id"	
 		}
-		if ! exists "/www/themes/$CONFIG_theme_id/webif.css"; then
+		if ! exists "$wwwdir/themes/$CONFIG_theme_id/webif.css"; then
 			# if theme still not installed, there was an error
 			log_message "@TR<<aplly_Error#Error>>: @TR<<aplly_theme_installation_failed#theme package installation failed>>."
 		else
 			# create symlink to new active theme if its not already set right
-			current_theme=$(ls /www/themes/active -l | cut -d '>' -f 2 | sed s/'\/www\/themes\/'//g)
+			# Note that goes outside of http root hierarchy (and back in it again)
+			current_theme=$(readlink $themelink)
+			current_theme=${themelink##*/}
 			! equal "$current_theme" "$CONFIG_theme_id" && {
-				rm /www/themes/active
-				ln -s /www/themes/$CONFIG_theme_id /www/themes/active
+				rm $themelink
+				ln -s $wwwdir/themes/$CONFIG_theme_id $themelink
+				#touch $wwwdir/themes/active/webif.css
 			}
 		fi		
 		echo_action_done
 	}
Index: webif_0.3-8/usr/lib/webif/backup.default
===================================================================
--- webif_0.3-8.orig/usr/lib/webif/backup.default
+++ webif_0.3-8/usr/lib/webif/backup.default
@@ -33,8 +33,10 @@ config filemask
 
 config directorymask
 	option directorymask	'/etc/config'
 config directorymask
+	option directorymask	'/etc/webif'
+config directorymask
 	option directorymask	'/etc/crontabs'
 config directorymask
 	option directorymask	'/etc/dropbear'
 config directorymask
Index: webif_0.3-8/www/cgi-bin/webif/network-firewall.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/network-firewall.sh
+++ webif_0.3-8/www/cgi-bin/webif/network-firewall.sh
@@ -1,10 +1,11 @@
 #!/usr/bin/webif-page
 <?
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 
 mkdir -p /tmp/.webif
-exists /tmp/.webif/file-firewall && FW_FILE=/tmp/.webif/file-firewall || FW_FILE=/etc/config/firewall
+exists /tmp/.webif/file-firewall && FW_FILE=/tmp/.webif/file-firewall || FW_FILE=/etc/webif/firewall
 exists "$FW_FILE" || touch "$FW_FILE" >&- 2>&-
 FW_FILE_NEW="/tmp/.webif/file-firewall-new"
 
 empty "$FORM_cancel" || {
@@ -168,10 +169,9 @@ awk \
 	-v del_dport="$FORM_del_dport" \
 	-v del_layer7="$FORM_del_layer7" \
 	-v data_submit="$FORM_data_submit" \
 	-v new_match="$FORM_new_match" \
-	-f /usr/lib/webif/common.awk \
-	-f /usr/lib/common.awk \
+	-f $libdir/common.awk \
 	-f - "$FW_FILE" <<EOF
 function set_data() {
 	_l["proto"] = proto
 	_l["src"] = src
@@ -325,9 +325,9 @@ END {
 	print "</table>"
 	print "<br /><br />"
 	print "<div class=\\"settings-help\\" style=\\"margin-left:0;\\">"
 	print "<h4>@TR<<Firewall>>:</h4>"
-	print "<p>@TR<<firewall_help_general|Here you can forward ports and more. If you wish to manually configure these instead, use '/etc/config/firewall', not '/etc/firewall.user'. Although either works, only the former is used by this page.>></p>"
+	print "<p>@TR<<firewall_help_general|Here you can forward ports and more. If you wish to manually configure these instead, use '/etc/webif/firewall', not '/etc/firewall.user'. Although either works, only the former is used by this page.>></p>"
 	print "<h4>@TR<<Forwarding a port>>:</h4>"
 	print "<p>@TR<<firewall_help_fw_port_example1|If you would like to forward port 999 TCP from the internet to a local computer at 192.168.1.100, it might look like below:>></p>"
 	print "<p>@TR<<firewall_help_fw_port_example|Destination ports: 999 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Target: 192.168.1.100 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Port: &lt;blank&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Protocol: TCP>></p>"
 	print "<h4>@TR<<Forwarding a port range>>:</h4>"
Index: webif_0.3-8/www/cgi-bin/webif/network-qos.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/network-qos.sh
+++ webif_0.3-8/www/cgi-bin/webif/network-qos.sh
@@ -19,12 +19,13 @@
 # NVRAM variables referenced:
 #   none
 #
 # Configuration files referenced:
-#   /etc/config/qos
+#   /etc/webif/qos
 #
 #
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 
 header "Network" "QoS" "@TR<<QOS Configuration>>" ' onload="modechange()" ' "$SCRIPT_NAME"
 
 if ! empty "$FORM_install_nbd"; then
@@ -260,9 +261,9 @@ field|@TR<<Show Advanced Rules>>|field_w
 select|webif_advanced|$FORM_webif_advanced
 option|1|@TR<<qos_adv_enabled#Enabled>>
 option|0|@TR<<qos_adv_disabled#Disabled>>
 helpitem|Advanced
-helptext|HelpText Advanced#Normally users just use the form below to configure QoS. Some people may need access to the more advanced settings. Alternatively, you can <a href="./system-editor.sh?path=/etc/config&amp;edit=qos">manually edit the config</a>
+helptext|HelpText Advanced#Normally users just use the form below to configure QoS. Some people may need access to the more advanced settings. Alternatively, you can <a href="./system-editor.sh?path=/etc/webif&amp;edit=qos">manually edit the config</a>
 end_form
 EOF
 
 # show the current ruleset in a table
Index: webif_0.3-8/www/cgi-bin/webif/status-leases.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/status-leases.sh
+++ webif_0.3-8/www/cgi-bin/webif/status-leases.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page
 <?
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 ###################################################################
 # Status DHCP Leases
 #
 # This page is synchronized between kamikaze and WR branches. Changes to it *must* 
@@ -24,9 +25,9 @@
 # NVRAM variables referenced:
 #  wan_ifname, dhcp_read_ethers (white russian)
 #
 # Configuration files referenced:
-#  /etc/config/network (kamikaze)
+#  /etc/webif/network (kamikaze)
 #  /etc/dnsmasq.conf (kamikaze)
 #  /etc/ethers (both)
 #
 # Kernel proc interface:
Index: webif_0.3-8/www/cgi-bin/webif/system-confman.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/system-confman.sh
+++ webif_0.3-8/www/cgi-bin/webif/system-confman.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page "-U /tmp -u 4096"
 <?
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 ###################################################################
 # System Backup & Restore page
 #
 # Description:
@@ -12,9 +13,9 @@
 #	Dmytro Dykhman <dmytro@iroot.ca>
 #	Lubos Stanek <lubek@users.berlios.de> - total redesign, the uci configuration
 #
 # Configuration files referenced:
-#	/etc/config/backup
+#	/etc/webif/backup
 #
 
 lf_IFS="
 "
@@ -40,9 +41,9 @@ config_cb() {
 	esac
 }
 
 make_backup() {
-	[ ! -f /etc/config/backup ] && cp -pf /usr/lib/webif/backup.default /etc/config/backup >/dev/null 2>&1
+	[ ! -f /etc/webif/backup ] && cp -pf $libdir/backup.default /etc/webif/backup >/dev/null 2>&1
 	uci_load "backup"
 	local tmpdir bkstamp nvram_selector seccfg seccfg_type seccfg_mask tmpgz prepwd oldIFS dir file file_path realname tmpgz_name tmpgz_path
 	echo "<form method=\"post\" name=\"backupreturn\" action=\"$SCRIPT_NAME\">"
 	echo "<h3><strong>@TR<<system_confman_Backup_Configuration#Backup Configuration>></strong></h3>"
@@ -246,9 +247,9 @@ restore_selection() {
 				for cpfile in $filelist; do
 					tmpfpath="${cpfile%/*}"
 					[ ! -d "$editpath$tmpfpath" ] && mkdir -p "$editpath$tmpfpath"
 					cp -fp "$tmpdir$cpfile" "$editpath$cpfile"
-					[ "$tmpfpath" = "/etc/config" ] && {
+					[ "$tmpfpath" = "/etc/webif" ] && {
 						ucifile="${cpfile##*/}"
 						[ "$ucifile" != "firewall" ] && {
 							[ ! -d "$ucipath" ] && mkdir -p "$ucipath"
 							touch "$ucipath/$ucifile"
Index: webif_0.3-8/www/cgi-bin/webif/vpn-pptp.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/vpn-pptp.sh
+++ webif_0.3-8/www/cgi-bin/webif/vpn-pptp.sh
@@ -1,9 +1,10 @@
 #!/usr/bin/webif-page "-U /tmp -u 4096"
 <?
 # from: http://coova.org
-. /usr/lib/webif/webif.sh
-. /etc/functions-net.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
+. $libdir/config/functions-net.sh
 
 load_settings "pptp"
 
 if empty "$FORM_submit"; then
@@ -110,9 +111,9 @@ awk -v "url=$SCRIPT_NAME" \
 	-v "host=$FORM_host" \
 	-v "user=$FORM_user" \
 	-v "pass=$FORM_pass" \
 	-v "ip=$FORM_ip" \
-	-f /usr/lib/webif/common.awk -f - /etc/ppp/users.pptp /etc/ppp/peers.pptp <<EOF
+	-f $libdir/common.awk -f - /etc/ppp/users.pptp /etc/ppp/peers.pptp <<EOF
 BEGIN {
 	FS="[ \\t]"
 	print "<form enctype=\\"multipart/form-data\\" method=\\"post\\">"
 	start_form("@TR<<PPTP Client Connections>>"," style=\"display:none;\" id=\"pptppeers\"")
@@ -153,9 +154,9 @@ EOF
 awk -v "url=$SCRIPT_NAME" \
 	-v "user=$FORM_user" \
 	-v "pass=$FORM_pass" \
 	-v "ip=$FORM_ip" \
-	-f /usr/lib/webif/common.awk -f - /etc/ppp/users.pptpd <<EOF
+	-f $libdir/common.awk -f - /etc/ppp/users.pptpd <<EOF
 BEGIN {
 	FS="[ \\t]"
 	print "<form enctype=\\"multipart/form-data\\" method=\\"post\\">"
 	start_form("@TR<<PPTP VPN Users>>"," style=\"display:none;\" id=\"pptpusers\"")
Index: webif_0.3-8/www/cgi-bin/webif/system-settings.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/system-settings.sh
+++ webif_0.3-8/www/cgi-bin/webif/system-settings.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page
 <?
-. "/usr/lib/webif/webif.sh"
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 
 ###################################################################
 # system configuration page
 #
@@ -238,25 +239,25 @@ is_bcm947xx && {
 #
 #
 # start with list of available installable theme packages
 #
-! exists "/etc/themes.lst" && {
+! exists "/etc/webif/themes.lst" && {
 	# create list if it doesn't exist ..
-	/usr/lib/webif/webif-mkthemelist.sh	
+	$libdir/webif-mkthemelist.sh
 }
-THEMES=$(cat "/etc/themes.lst")
+THEMES=$(cat "/etc/webif/themes.lst")
 for str in $temp_t; do
 	THEME="$THEME
 		option|$str"
 done
 
-# enumerate installed themes by finding all subdirectories of /www/theme
+# enumerate installed themes by finding all subdirectories of $wwwdir/themes
 # this lets users install themes not built into packages.
 #
-for curtheme in /www/themes/*; do
-	curtheme=$(echo "$curtheme" | sed s/'\/www\/themes\/'//g)
-	if exists "/www/themes/$curtheme/name"; then
-		theme_name=$(cat "/www/themes/$curtheme/name")
+for curtheme in $wwwdir/themes/*; do
+	curtheme=$(echo "$curtheme" | sed "s@$wwwdir/themes/@@g")
+	if exists "$wwwdir/themes/$curtheme/name"; then
+		theme_name=$(cat "$wwwdir/themes/$curtheme/name")
 	else
 		theme_name="$curtheme"
 	fi
 	! equal "$curtheme" "active" && {
@@ -275,10 +276,10 @@ dangerous_form_help=""
 
 #####################################################################
 # Initialize LANGUAGES form
 # create list if it doesn't exist ..
-/usr/lib/webif/webif-mklanglist.sh
-LANGUAGES=$(cat "/etc/languages.lst")
+$libdir/webif-mklanglist.sh
+LANGUAGES=$(cat "/etc/webif/languages.lst")
 
 is_bcm947xx && {
 	bootwait_form="field|@TR<<Boot Wait>>
 	select|boot_wait|$FORM_boot_wait
@@ -337,9 +338,9 @@ TIMEZONE_OPTS=$(
 				print "optgroup|@TR<<system_settings_group_unknown_TZ#Unknown>>"
 				if (oldtz[1] == "-") oldtz[1] = "@TR<<system_settings_User_or_old_TZ#User defined (or out of date)>>"
 				print "option|" timezoneinfo "|" oldtz[1]
 			}
-		}' < /usr/lib/webif/timezones.csv 2>/dev/null
+		}' < $libdir/timezones.csv 2>/dev/null
 
 )
 #######################################################
 cat <<EOF
Index: webif_0.3-8/lib/config/uci-depends.new
===================================================================
--- webif_0.3-8.orig/lib/config/uci-depends.new
+++ webif_0.3-8/lib/config/uci-depends.new
@@ -83,9 +83,9 @@ config_clear() {
 	done
 }
 
 config_load() {
-	local file="/etc/config/$1"
+	local file="/etc/webif/$1"
 	_C=0
 	CONFIG_SECTIONS=
 	CONFIG_NUM_SECTIONS=0
 	CONFIG_SECTION=
Index: webif_0.3-8/lib/config/uci.sh
===================================================================
--- webif_0.3-8.orig/lib/config/uci.sh
+++ webif_0.3-8/lib/config/uci.sh
@@ -40,9 +40,9 @@ uci_apply_defaults() {(
 )}
 
 uci_call_awk() {
 	local CMD="$*"
-	awk -f $UCI_ROOT/lib/config/uci.awk -f - <<EOF
+	awk -f /usr/lib/webif/config/uci.awk -f - <<EOF
 BEGIN {
 	$CMD
 }
 EOF
@@ -149,12 +149,12 @@ uci_commit() {
 			return 0
 		}
 		
 		config_load "$PACKAGE"
-		CONFIG_FILENAME="${CONFIG_FILENAME:-$UCI_ROOT/etc/config/$PACKAGE_BASE}"
+		CONFIG_FILENAME="${CONFIG_FILENAME:-$UCI_ROOT/etc/webif/$PACKAGE_BASE}"
 		uci_do_update "$CONFIG_FILENAME" "$updatestr" > "/tmp/.uci/$PACKAGE_BASE.new" && {
 			mv -f "/tmp/.uci/$PACKAGE_BASE.new" "$CONFIG_FILENAME" && \
 			rm -f "/tmp/.uci/$PACKAGE_BASE"
 		} 
 	)
 	$LOCK -u "/tmp/.uci/$PACKAGE_BASE.lock"
-}
\ No newline at end of file
+}
Index: webif_0.3-8/lib/config/uci.awk
===================================================================
--- webif_0.3-8.orig/lib/config/uci.awk
+++ webif_0.3-8/lib/config/uci.awk
@@ -18,9 +18,9 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
 # parameters: 1
 function config_load(package, var) {
-	while (("/bin/ash -c '. /etc/functions.sh; unset NO_EXPORT; config_load \""package"\"; env | grep \"^CONFIG_\"'" | getline) == 1) {
+	while (("/bin/ash -c '. /usr/lib/webif/config/functions.new; unset NO_EXPORT; config_load \""package"\"; env | grep \"^CONFIG_\"'" | getline) == 1) {
 		sub("^CONFIG_", "")
 		if (match($0, "=") == 0) {
 			if (var != "") CONFIG[var] = CONFIG[var] "\n" $0
 			next
@@ -182,5 +182,5 @@ function uci_update_config(cfg, update, 
 		cfg = cfg "\nconfig \"" stype "\" \"" section "\"\n"
 	}
 
 	return cfg
-}
\ No newline at end of file
+}
Index: webif_0.3-8/www/cgi-bin/webif/info-about.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/info-about.sh
+++ webif_0.3-8/www/cgi-bin/webif/info-about.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page
 <?
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 ###################################################################
 # About page
 #
 # Description:
@@ -20,9 +21,9 @@
 #   none
 #
 header "Info" "About" "<img src=\"/images/abt.jpg\" alt=\"@TR<<About>>\" />@TR<<About>>" '' ''
 
-this_revision=$(cat "/www/.version")
+this_revision=$(cat "$wwwdir/.version")
 
 ?>
 <script src="/js/scrollbox.js" type="text/javascript"></script>
 <h2><a href="http://www.x-wrt.org">@TR<<X-Wrt Extensions>></a> &ndash; webif&sup2;</h2>
Index: webif_0.3-8/www/cgi-bin/webif/info.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/info.sh
+++ webif_0.3-8/www/cgi-bin/webif/info.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page
 <?
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 #
 # This page is synchronized between kamikaze and WR branches. Changes to it *must* 
 # be followed by running the webif-sync.sh script.
 #
@@ -14,9 +15,9 @@ SHOW_BANNER=0	# set to show /etc/banner
 XWRT_BRANCH="trunk"
 package_filename="webif_latest_stable.ipk"
 version_url="http://ftp.berlios.de/pub/xwrt/"
 
-this_revision=$(cat "/www/.version")
+this_revision=$(cat "$wwwdir/.version")
 revision_text=" r$this_revision "
 version_file=".version-stable"
 daily_checked=""
 upgrade_button=""
@@ -53,9 +54,9 @@ if [ -n "$FORM_install_webif" ]; then
 	echo "<pre>"
 	ipkg -V 0 update
 	ipkg install "${version_url}${package_filename}" -force-overwrite -force-reinstall| uniq
 	echo "</pre>"
-	this_revision=$(cat "/www/.version")
+	this_revision=$(cat "$wwwdir/.version")
 	# update the active language package
 	uci_load "webif"
 	curlang="$CONFIG_general_lang"
 	! equal "$(ipkg status "webif-lang-${curlang}" 2>/dev/null | grep "^Status: " | grep " installed" )" "" && {
Index: webif_0.3-8/www/cgi-bin/webif/graphs-cpu.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/graphs-cpu.sh
+++ webif_0.3-8/www/cgi-bin/webif/graphs-cpu.sh
@@ -2,18 +2,19 @@
 <?
 #
 #credit goes to arantius and GasFed
 #
-. /usr/lib/webif/webif.sh
-. /www/cgi-bin/webif/graphs-subcategories.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
+. $cgidir/graphs-subcategories.sh
 
 header "Graphs" "graphs_cpu_subcategory#CPU" "@TR<<graphs_cpu_CPU_Usage#CPU Usage>>" "" ""
 # IE (all versions) does not support the object tag with svg!
-#	<object data="" width="500" height="250" type="image/svg+xml">@TR<<graphs_svg_required#This object requires the SVG support.>></object>
+#	<object data="" width="600" height="300" type="image/svg+xml">@TR<<graphs_svg_required#This object requires the SVG support.>></object>
 ?>
 <center>
 	<embed src="/cgi-bin/webif/graph_cpu_svg.sh?data.sh"
-		width="500" height="250" type="image/svg+xml" />
+		width="600" height="300" type="image/svg+xml" />
 </center>
 <? footer ?>
 <!--
 ##WEBIF:name:Graphs:1:graphs_cpu_subcategory#CPU
Index: webif_0.3-8/www/cgi-bin/webif/graphs-if.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/graphs-if.sh
+++ webif_0.3-8/www/cgi-bin/webif/graphs-if.sh
@@ -2,18 +2,19 @@
 <?
 #
 #credit goes to arantius and GasFed
 #
-. /usr/lib/webif/webif.sh
-. /www/cgi-bin/webif/graphs-subcategories.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
+. $cgidir/graphs-subcategories.sh
 
 header "Graphs" "graphs_if_Traffic#Traffic>> $FORM_if@TR<<" "@TR<<graphs_if_Traffic_of_Interface#Traffic of Interface>> $FORM_if" "" ""
 # IE (all versions) does not support the object tag with svg!
-#	<object data="" width="500" height="250" type="image/svg+xml">@TR<<graphs_svg_required#This object requires the SVG support.>></object>
+#	<object data="" width="600" height="300" type="image/svg+xml">@TR<<graphs_svg_required#This object requires the SVG support.>></object>
 ?>
 <center>
 <?if [ "$FORM_if" ] ?>
 	<embed src="/cgi-bin/webif/graph_if_svg.sh?if=<? echo -n ${FORM_if} ?>"
-		width="500" height="250" type="image/svg+xml" />
+		width="600" height="300" type="image/svg+xml" />
 <?fi?>
 </center>
 <? footer ?>
Index: webif_0.3-8/www/cgi-bin/webif/graph_cpu_svg.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/graph_cpu_svg.sh
+++ webif_0.3-8/www/cgi-bin/webif/graph_cpu_svg.sh
@@ -1,6 +1,9 @@
 #!/usr/bin/webif-page
-Content-Type: image/svg+xml 
+Content-Type: image/svg+xml
 Content-Disposition: inline
 Pragma: no-cache
 
-<? cat /www/svggraph/graph_cpu.svg ?>
\ No newline at end of file
+<?
+. /etc/webif/webif-paths.sh
+cat $wwwdir/svggraph/graph_cpu.svg
+?>
Index: webif_0.3-8/www/cgi-bin/webif/graph_if_svg.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/graph_if_svg.sh
+++ webif_0.3-8/www/cgi-bin/webif/graph_if_svg.sh
@@ -1,6 +1,9 @@
 #!/usr/bin/webif-page
-Content-Type: image/svg+xml 
+Content-Type: image/svg+xml
 Content-Disposition: inline
 Pragma: no-cache
 
-<? cat /www/svggraph/graph_if.svg ?>
\ No newline at end of file
+<?
+. /etc/webif/webif-paths.sh
+cat $wwwdir/svggraph/graph_if.svg
+?>
Index: webif_0.3-8/etc/config/webif-paths.sh
===================================================================
--- /dev/null
+++ webif_0.3-8/etc/config/webif-paths.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+# Directories for the web interface
+# Helper scripts
+libdir=/usr/lib/webif
+# further assumption: Translations are at $libdir/lang/*
+# http root
+wwwdir=/usr/share/webif/www
+# further assumption: Themes are at $www/themes/*
+# themeswitcher
+themelink=/var/lib/webif/activetheme
+# webif cgi-bin dir
+cgidir=/usr/share/webif/www/cgi-bin/webif
+# webif cgi-bin dir relative to http root
+# (hardcoded at some places, so don't change for now)
+rootdir=/cgi-bin/webif
+# Landing page
+indexpage=index.sh
+
Index: webif_0.3-8/www/cgi-bin/webif/config.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/config.sh
+++ webif_0.3-8/www/cgi-bin/webif/config.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page
 <?
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 
 update_changes
 
 case "$CHANGES" in
@@ -52,9 +53,9 @@ case "$FORM_mode" in
 	save)
 		header "$FORM_cat" . "@TR<<Updating config...|Updating your configuration...>>"
 		CHANGES=""
 		echo "<pre>"
-		sh /usr/lib/webif/apply.sh 2>&1
+		sh $libdir/apply.sh 2>&1
 		echo "</pre>${FORM_prev:+<meta http-equiv=\"refresh\" content=\"4; URL=$FORM_prev\" />}"
 		;;
 esac
 
Index: webif_0.3-8/www/cgi-bin/webif/download.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/download.sh
+++ webif_0.3-8/www/cgi-bin/webif/download.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/haserl
 <?
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 ###################################################################
 # download.sh
 #
 # Description:
@@ -98,5 +99,5 @@ echo "<body>"
 echo "<p><b>Error</b> downloading a file<br />"
 echo "Redirecting to <a href=\"$redir\">previous page</a></p>"
 echo "</body>"
 echo "</html>"
-?>
\ No newline at end of file
+?>
Index: webif_0.3-8/www/cgi-bin/webif/iframe.mini-info.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/iframe.mini-info.sh
+++ webif_0.3-8/www/cgi-bin/webif/iframe.mini-info.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page
 <?
-	. "/usr/lib/webif/webif.sh"
+	. /etc/webif/webif-paths.sh
+	. $libdir/webif.sh
 	mini_header "Status" "Status" "@TR<<Device Status>>" ''
 
 	MEMINFO=$(cat "/proc/meminfo")
 	nI="0"
Index: webif_0.3-8/www/cgi-bin/webif/log-browse.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/log-browse.sh
+++ webif_0.3-8/www/cgi-bin/webif/log-browse.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page
 <?
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 
 #---------------------------------------------
 # sets the type of log: file or circular
 # defaults to circular, wich is the default install for openwrt
Index: webif_0.3-8/www/cgi-bin/webif/log-dmesg.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/log-dmesg.sh
+++ webif_0.3-8/www/cgi-bin/webif/log-dmesg.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page
 <?
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 
 header "Log" "Kernel" "@TR<<log_dmesg_Kernel_Ring_Buffer#Kernel Ring Buffer>>"
 ?>
 <iframe src="log-dmesg_frame.sh" width="90%" height="300" scrolling="auto">
Index: webif_0.3-8/www/cgi-bin/webif/log-dmesg_frame.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/log-dmesg_frame.sh
+++ webif_0.3-8/www/cgi-bin/webif/log-dmesg_frame.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page
 <?
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 
 mini_header
 echo -n "<body><div class=\"logread\"><pre>"
 dmesg -s$((2**14)) | sed ' s/\&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g' ?></pre>
Index: webif_0.3-8/www/cgi-bin/webif/log-read.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/log-read.sh
+++ webif_0.3-8/www/cgi-bin/webif/log-read.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page
 <?
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 
 #$meta_refresh="<meta http-equiv=\"refresh\" content=\"5; URL=log-read.sh\">"
 
 header "Log" "Syslog" "@TR<<Syslog View>>" '' ""
Index: webif_0.3-8/www/cgi-bin/webif/log-read_frame.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/log-read_frame.sh
+++ webif_0.3-8/www/cgi-bin/webif/log-read_frame.sh
@@ -1,8 +1,9 @@
 #!/usr/bin/webif-page
 <?
-. /usr/lib/webif/webif.sh
-. /etc/runsyslogd.conf
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
+#. /etc/runsyslogd.conf
 colorize_script=""
 
 mini_header
 echo -n "<body><div class=\"logread\"><pre>"
Index: webif_0.3-8/www/cgi-bin/webif/log-setup.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/log-setup.sh
+++ webif_0.3-8/www/cgi-bin/webif/log-setup.sh
@@ -1,8 +1,9 @@
 #!/usr/bin/webif-page
 <?
-. /usr/lib/webif/webif.sh
-. /etc/runsyslogd.conf
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
+#. /etc/runsyslogd.conf
 
 load_settings log
 
 #header "Log" "Syslog Settings" "@TR<<syslog Settings>>"  ' onload="modechange()" ' "$SCRIPT_NAME"
Index: webif_0.3-8/www/cgi-bin/webif/logout.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/logout.sh
+++ webif_0.3-8/www/cgi-bin/webif/logout.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page
 <?
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 ###################################################################
 # Logout
 #
 # Description:
Index: webif_0.3-8/www/cgi-bin/webif/network-dhcpiface.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/network-dhcpiface.sh
+++ webif_0.3-8/www/cgi-bin/webif/network-dhcpiface.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page
 <?
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 header "Network" "DHCP" "@TR<<DHCP Interfaces>>" '' "$SCRIPT_NAME"
 
 load_settings network
 
@@ -90,9 +91,9 @@ fi
 awk -v "name=@TR<<Name>>" \
 	-v "interface=@TR<<Interface>>" \
 	-v "interfaces=@TR<<Interfaces>>" \
 	-v "action=@TR<<Action>>" \
-	-f /usr/lib/webif/common.awk -f - /etc/dnsmasq.options <<EOF
+	-f $libdir/common.awk -f - /etc/dnsmasq.options <<EOF
 BEGIN{
 	start_form("@TR<<Interfaces>>")
 	print "<table style=\\"width: 90%\\">"
 	print "<tr><th>" name "</th><th>" interface "</th><th>" interfaces "</th><th>" action "</th></tr>"
@@ -112,9 +113,9 @@ EOF
 		fi
 		echo "<tr><td $style>$ifname</td><td $style>$IFACE</td><td $style>$IFACES</td><td $style><a href=\"network-dhcpiface.sh?action=modify&amp;iface=$ifname\">@TR<<Modify>></a></td></tr>"
 	done
 
-awk -f /usr/lib/webif/common.awk -f - /etc/dnsmasq.options <<EOF
+awk -f $libdir/common.awk -f - /etc/dnsmasq.options <<EOF
 BEGIN{
 	print "</table><br />"
 	end_form();
 }
@@ -141,9 +142,9 @@ if [ -n "$FORM_iface" ]; then
 			-v "value=@TR<<Value>>" \
 			-v "action=@TR<<Action>>" \
 			-v "macaddress=@TR<<MAC Address>>" \
 			-v "iface=$FORM_iface" \
-			-v "ip=$FORM_dhcp_ip" -f /usr/lib/webif/common.awk -f - $DNSMASQ_FILE <<EOF
+			-v "ip=$FORM_dhcp_ip" -f $libdir/common.awk -f - $DNSMASQ_FILE <<EOF
 BEGIN {
 	FS=","
 	start_form("@TR<<Options For>> $FORM_iface")
 	print "<table style=\"width: 90%\"><tr><th>" param "</th><th>" value "</th><th>" action "</th></tr>"
@@ -178,9 +179,9 @@ EOF
 			-v "value=@TR<<Value>>" \
 			-v "action=@TR<<Action>>" \
 			-v "macaddress=@TR<<MAC Address>>" \
 			-v "iface=$FORM_iface" \
-			-v "ip=$FORM_dhcp_ip" -f /usr/lib/webif/common.awk -f - /etc/dnsmasq.options <<EOF
+			-v "ip=$FORM_dhcp_ip" -f $libdir/common.awk -f - /etc/dnsmasq.options <<EOF
 BEGIN {
 	FS=":"
 	print "<tr><td><select id=\\"hop\\" name=\\"hop\\">"
 }
Index: webif_0.3-8/www/cgi-bin/webif/network-dhcpsettings.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/network-dhcpsettings.sh
+++ webif_0.3-8/www/cgi-bin/webif/network-dhcpsettings.sh
@@ -1,8 +1,9 @@
 #!/usr/bin/webif-page
 <?
-. /usr/lib/webif/webif.sh
-. /etc/functions.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
+. $wwwdir/config/functions.new
 load_settings network
 
 if empty "$FORM_submit"; then
 	FORM_dhcp_cache_size=${dhcp_cache_size:-$(nvram get dhcp_cache_size)}
Index: webif_0.3-8/www/cgi-bin/webif/network-ez-ipupdate.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/network-ez-ipupdate.sh
+++ webif_0.3-8/www/cgi-bin/webif/network-ez-ipupdate.sh
@@ -1,9 +1,10 @@
 #!/usr/bin/webif-page
 <?
 ddns_dir="/etc/ez-ipupdate"
 ddns_msg="$ddns_dir/ez-ipupdate.msg"
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 
 header "Network" "DynDNS" "@TR<<DynDNS Settings>>" '' "$SCRIPT_NAME"
 has_pkgs ez-ipupdate
 
Index: webif_0.3-8/www/cgi-bin/webif/network-hosts.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/network-hosts.sh
+++ webif_0.3-8/www/cgi-bin/webif/network-hosts.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page
 <?
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 
 # header "Network" "Hosts"...
 
 exists /tmp/.webif/file-hosts  && HOSTS_FILE=/tmp/.webif/file-hosts || HOSTS_FILE=/etc/hosts
@@ -96,9 +97,9 @@ EOF
 # Hosts in /etc/hosts
 awk -v "url=$SCRIPT_NAME" \
 	-v "ip=$FORM_host_ip" \
 	-v "name=$FORM_host_name" \
-	-f /usr/lib/webif/common.awk \
+	-f $libdir/common.awk \
 	-f - $HOSTS_FILE <<EOF
 BEGIN {
 	FS="[ \t]"
 	odd=1
@@ -151,9 +152,9 @@ EOF
 
 # Static DHCP mappings (/etc/ethers)
 awk -v "url=$SCRIPT_NAME" \
 	-v "mac=$FORM_dhcp_mac" \
-	-v "ip=$FORM_dhcp_ip" -f /usr/lib/webif/common.awk -f - $ETHERS_FILE <<EOF
+	-v "ip=$FORM_dhcp_ip" -f $libdir/common.awk -f - $ETHERS_FILE <<EOF
 
 BEGIN {
 	FS="[ \\t]"
 	odd=1
Index: webif_0.3-8/www/cgi-bin/webif/network-logread-ez-ipupdate.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/network-logread-ez-ipupdate.sh
+++ webif_0.3-8/www/cgi-bin/webif/network-logread-ez-ipupdate.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page
 <?
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 
 header "Network" "Settings" "DynDNS Syslog View" '' "$SCRIPT_NAME"
 
 ?>
Index: webif_0.3-8/www/cgi-bin/webif/network-misc.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/network-misc.sh
+++ webif_0.3-8/www/cgi-bin/webif/network-misc.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page
 <?
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 ###################################################################
 # Misc. Network Configuration
 #
 # Description:
Index: webif_0.3-8/www/cgi-bin/webif/network-services.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/network-services.sh
+++ webif_0.3-8/www/cgi-bin/webif/network-services.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page
 <?
-. "/usr/lib/webif/webif.sh"
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 ###################################################################
 # Services configuration page
 #
 # This page is synchronized between kamikaze and WR branches. Changes to it *must* 
Index: webif_0.3-8/www/cgi-bin/webif/network-vlan.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/network-vlan.sh
+++ webif_0.3-8/www/cgi-bin/webif/network-vlan.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page
 <?
-. "/usr/lib/webif/webif.sh"
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 ###################################################################
 # VLAN configuration page
 #
 # Description:
Index: webif_0.3-8/www/cgi-bin/webif/network-wakeonlan.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/network-wakeonlan.sh
+++ webif_0.3-8/www/cgi-bin/webif/network-wakeonlan.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page
 <?
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 
 HOSTS_FILE=/etc/hosts
 ETHERS_FILE=/etc/ethers
 
Index: webif_0.3-8/www/cgi-bin/webif/network-wan-lan.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/network-wan-lan.sh
+++ webif_0.3-8/www/cgi-bin/webif/network-wan-lan.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page
 <?
-. "/usr/lib/webif/webif.sh"
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 ###################################################################
 # WAN and LAN configuration page
 #
 # Description:
@@ -195,17 +196,17 @@ text|pptp_server_ip|$FORM_pptp_server_ip
 	WWAN_OPTION="option|wwan|@TR<<UMTS/GPRS>>"
 	WWAN_COUNTRY_LIST=$(
 		awk '	BEGIN{FS=":"}
 			$1 ~ /[ \t]*#/ {next}
-			{print "option|" $1 "|@TR<<" $2 ">>"}' < /usr/lib/webif/apn.csv
+			{print "option|" $1 "|@TR<<" $2 ">>"}' < $libdir/apn.csv
 	)
 	JS_APN_DB=$(
 		awk '	BEGIN{FS=":"}
 			$1 ~ /[ \t]*#/ {next}
 			{print "	apnDB." $1 " = new Object;"
 			 print "	apnDB." $1 ".name = \"" $3 "\";"
 			 print "	apnDB." $1 ".user = \"" $4 "\";"
-			 print "	apnDB." $1 ".pass = \"" $5 "\";\n"}' < /usr/lib/webif/apn.csv
+			 print "	apnDB." $1 ".pass = \"" $5 "\";\n"}' < $libdir/apn.csv
 	)
 }
 
 header "Network" "WAN-LAN" "@TR<<WAN-LAN Configuration>>" ' onload="modechange()" ' "$SCRIPT_NAME"
Index: webif_0.3-8/www/cgi-bin/webif/network-wifi-lan.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/network-wifi-lan.sh
+++ webif_0.3-8/www/cgi-bin/webif/network-wifi-lan.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page
 <?
-. "/usr/lib/webif/webif.sh"
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 load_settings network
 wifi_interface=$(nvram get wl0_ifname)
 
 for interface in $(nvram get lan_ifnames |sed s/$wifi_interface//); do
Index: webif_0.3-8/www/cgi-bin/webif/network-wlan-advanced.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/network-wlan-advanced.sh
+++ webif_0.3-8/www/cgi-bin/webif/network-wlan-advanced.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page
 <?
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 ###################################################################
 # Advanced wireless configuration
 #
 # Description:
Index: webif_0.3-8/www/cgi-bin/webif/network-wlan.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/network-wlan.sh
+++ webif_0.3-8/www/cgi-bin/webif/network-wlan.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page
 <?
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 ###################################################################
 # Wireless configuration
 #
 # Description:
Index: webif_0.3-8/www/cgi-bin/webif/reboot.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/reboot.sh
+++ webif_0.3-8/www/cgi-bin/webif/reboot.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page
 <?
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 
 timeout=40
 if empty "$FORM_reboot"; then
 	reboot_msg="<form method=\"post\" action=\"$SCRIPT_NAME\"><input type=\"submit\" value=\" @TR<<Yes, really reboot now>> \" name=\"reboot\" /></form>"
Index: webif_0.3-8/www/cgi-bin/webif/status-asterisk.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/status-asterisk.sh
+++ webif_0.3-8/www/cgi-bin/webif/status-asterisk.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page
 <?
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 header "Status" "Asterisk" "@TR<<Asterisk Simple Managment>>"
 
 if [ -e /var/run/asterisk.pid ]; then
 
Index: webif_0.3-8/www/cgi-bin/webif/status-basic.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/status-basic.sh
+++ webif_0.3-8/www/cgi-bin/webif/status-basic.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page
 <?
-. "/usr/lib/webif/webif.sh"
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 header "Status" "System" "@TR<<Device Status>>"
 
 echo "<meta http-equiv=\"refresh\" content=\"20\" />"
 
Index: webif_0.3-8/www/cgi-bin/webif/status-connection.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/status-connection.sh
+++ webif_0.3-8/www/cgi-bin/webif/status-connection.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page
 <?
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 header "Status" "Netstat" "@TR<<Netstat>>"
 ###################################################################
 # TCP/IP status page
 #
Index: webif_0.3-8/www/cgi-bin/webif/status-conntrackread.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/status-conntrackread.sh
+++ webif_0.3-8/www/cgi-bin/webif/status-conntrackread.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page
 <?
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 header "Status" "Conntrack Table" "@TR<<Conntrack Table>>"
 echo "<table><tbody><tr><td><div class=smalltext><pre>"
 cat /proc/net/ip_conntrack | sort
 echo "</pre></div></td></tr></tbody></table>"
Index: webif_0.3-8/www/cgi-bin/webif/status-diag.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/status-diag.sh
+++ webif_0.3-8/www/cgi-bin/webif/status-diag.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page
 <?
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 ###################################################################
 # Diagnostics
 #
 # This page is synchronized between kamikaze and WR branches. Changes to it *must* 
@@ -48,17 +49,17 @@ does_process_exist() {
 }
 
 ! empty "$FORM_ping_button" || ! empty "$FORM_tracert_button" && {
 	! empty "$FORM_ping_button" && {		
-		sanitized=$(echo "$FORM_ping_hostname" | awk -f "/usr/lib/webif/sanitize.awk")	
+		sanitized=$(echo "$FORM_ping_hostname" | awk -f "$libdir/sanitize.awk")
 		! empty "$sanitized" && {
 			diag_command="ping -c 4 $sanitized"		
 		}
 	}
 
 	! empty "$FORM_tracert_button" && {
 		echo "$please_wait_msg"
-		sanitized=$(echo "$FORM_tracert_hostname" | awk -f "/usr/lib/webif/sanitize.awk")	
+		sanitized=$(echo "$FORM_tracert_hostname" | awk -f "$libdir/sanitize.awk")
 		! empty "$sanitized" && {
 			diag_command="traceroute $sanitized"		
 		}
 	}
Index: webif_0.3-8/www/cgi-bin/webif/status-interfaces.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/status-interfaces.sh
+++ webif_0.3-8/www/cgi-bin/webif/status-interfaces.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page
 <?
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 header "Status" "Interfaces" "@TR<<Interfaces>>"
 
 # get WAN stats
 wan_config=$(ifconfig 2>&1 | grep -A 6 "`nvram get wan_ifname`[[:space:]]")
Index: webif_0.3-8/www/cgi-bin/webif/status-iptables.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/status-iptables.sh
+++ webif_0.3-8/www/cgi-bin/webif/status-iptables.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page
 <?
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 ###################################################################
 # Netfilter status page
 #
 # Description:
Index: webif_0.3-8/www/cgi-bin/webif/status-openvpn.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/status-openvpn.sh
+++ webif_0.3-8/www/cgi-bin/webif/status-openvpn.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page
 <?
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 
 header "Status" "OpenVPN" "@TR<<OpenVPN Status>>"
 
 equal "$(nvram get openvpn_cli)" "1" && {
Index: webif_0.3-8/www/cgi-bin/webif/status-pppoe.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/status-pppoe.sh
+++ webif_0.3-8/www/cgi-bin/webif/status-pppoe.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page
 <?
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 header "Status" "PPPoE" "@TR<<PPPoE Status>>"
 ?>
 <?
 if [ "$FORM_action" = "reconnect" ]; then
Index: webif_0.3-8/www/cgi-bin/webif/status-pptp.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/status-pptp.sh
+++ webif_0.3-8/www/cgi-bin/webif/status-pptp.sh
@@ -1,8 +1,9 @@
 #!/usr/bin/webif-page
 <?
 # from: http://coova.org
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 
 header "Status" "PPTP" "@TR<<PPTP Status>>"
 
 if [ ! -e /etc/ppp/functions.sh ]; then
Index: webif_0.3-8/www/cgi-bin/webif/status-processes.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/status-processes.sh
+++ webif_0.3-8/www/cgi-bin/webif/status-processes.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page
 <?
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 ###################################################################
 # download.sh
 #
 # Description:
Index: webif_0.3-8/www/cgi-bin/webif/status-qos.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/status-qos.sh
+++ webif_0.3-8/www/cgi-bin/webif/status-qos.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page
 <?
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 
 header_inject_head=$(cat <<EOF
 <style type="text/css">
 <!--
Index: webif_0.3-8/www/cgi-bin/webif/status-usb.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/status-usb.sh
+++ webif_0.3-8/www/cgi-bin/webif/status-usb.sh
@@ -3,9 +3,10 @@
 #
 # This page is synchronized between kamikaze and WR branches. Changes to it *must* 
 # be followed by running the webif-sync.sh script.
 #
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 
 if ! empty "$FORM_umount"; then
 	if ! empty "$FORM_mountpoint"; then
 		err_umount=$(umount $FORM_mountpoint 2>&1)
Index: webif_0.3-8/www/cgi-bin/webif/status-wlan-survey.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/status-wlan-survey.sh
+++ webif_0.3-8/www/cgi-bin/webif/status-wlan-survey.sh
@@ -27,9 +27,10 @@
 #
 #
 #
 
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 
 header_inject_head=$(cat <<EOF
 <style type="text/css">
 <!--
Index: webif_0.3-8/www/cgi-bin/webif/status-wwaninfo.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/status-wwaninfo.sh
+++ webif_0.3-8/www/cgi-bin/webif/status-wwaninfo.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page
 <?
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 
 header_inject_head=$(cat <<EOF
 <style type="text/css">
 /*<![CDATA[*/
@@ -88,9 +89,9 @@ EOF
 # the comgt package has changed the executable
 COMGT=$(which comgt 2>/dev/null)
 empty "$COMGT" && COMGT=$(which gcom 2>/dev/null)
 # the webif^2's comgt query script
-COMGTWEBIF="/usr/lib/webif/comgt.webif"
+COMGTWEBIF="$libdir/comgt.webif"
 
 [ -x "$COMGT" ] && [ -s "$COMGTWEBIF" ] && {
 	DEVICES="/dev/usb/tts/2 /dev/noz2"
 	for DEV in $DEVICES
Index: webif_0.3-8/www/cgi-bin/webif/system-cron.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/system-cron.sh
+++ webif_0.3-8/www/cgi-bin/webif/system-cron.sh
@@ -19,9 +19,10 @@
 crondir_base="/var/spool/cron"
 cron_realdir="/etc/spool/cron/crontabs"
 crondir="$crondir_base/crontabs"
 
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 
 load_settings "cron"
 
 [ -z $FORM_submit ] && {
Index: webif_0.3-8/www/cgi-bin/webif/system-crontabs.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/system-crontabs.sh
+++ webif_0.3-8/www/cgi-bin/webif/system-crontabs.sh
@@ -1,9 +1,10 @@
 #!/usr/bin/webif-page
 <?
 crondir="/etc/crontabs/"
 
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 
 load_settings "cron"
 
 header "System" "Crontabs" "@TR<<Cron Tables>>" "$SCRIPT_NAME"
@@ -29,5 +30,5 @@ EOF
 
 footer ?>
 <!--
 ##WEBIF:name:System:175:Crontabs
--->
\ No newline at end of file
+-->
Index: webif_0.3-8/www/cgi-bin/webif/system-editor.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/system-editor.sh
+++ webif_0.3-8/www/cgi-bin/webif/system-editor.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page
 <?
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 ###################################################################
 # system-editor
 #
 # Description:
@@ -23,11 +24,11 @@
 # Configuration files referenced:
 #       none
 #
 # Required components:
-#       /usr/lib/webif/common.awk
-#       /usr/lib/webif/browser.awk
-#       /usr/lib/webif/editor.awk
+#       $libdir/common.awk
+#       $libdir/browser.awk
+#       $libdir/editor.awk
 #
 
 header_inject_head=$(cat <<EOF
 <script type="text/javascript">
@@ -172,10 +173,10 @@ if empty "$FORM_edit"; then
 	(ls -alLe "$FORM_path" 2>/dev/null | sed '/^[^d]/d';
 		ls -alLe "$FORM_path" 2>/dev/null | sed '/^[d]/d') 2>/dev/null | awk \
 		-v url="$SCRIPT_NAME" \
 		-v path="$FORM_path" \
-		-f /usr/lib/webif/common.awk \
-		-f /usr/lib/webif/browser.awk
+		-f $libdir/common.awk \
+		-f $libdir/browser.awk
 else
 	exists "$saved_filename" && {
 		edit_filename="$saved_filename"
 	} || {
@@ -184,10 +185,10 @@ else
 	cat "$edit_filename" 2>/dev/null | awk \
 		-v url="$SCRIPT_NAME" \
 		-v path="$FORM_path" \
 		-v file="$FORM_edit" \
-		-f /usr/lib/webif/common.awk \
-		-f /usr/lib/webif/editor.awk
+		-f $libdir/common.awk \
+		-f $libdir/editor.awk
 fi
 
 footer ?>
 <!--
Index: webif_0.3-8/www/cgi-bin/webif/system-ipkg.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/system-ipkg.sh
+++ webif_0.3-8/www/cgi-bin/webif/system-ipkg.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page
 <?
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 ###################################################################
 # Packages configuration page
 #
 # Description:
Index: webif_0.3-8/www/cgi-bin/webif/system-nvram.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/system-nvram.sh
+++ webif_0.3-8/www/cgi-bin/webif/system-nvram.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page
 <?
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 ###################################################################
 # NVRAM settings page
 #
 # Description:
Index: webif_0.3-8/www/cgi-bin/webif/system-password.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/system-password.sh
+++ webif_0.3-8/www/cgi-bin/webif/system-password.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page
 <? 
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 
 empty "$FORM_submit" || {
 	SAVED=1
 	validate <<EOF
Index: webif_0.3-8/www/cgi-bin/webif/system-snmp.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/system-snmp.sh
+++ webif_0.3-8/www/cgi-bin/webif/system-snmp.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page
 <?
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 ###################################################################
 # SNMP daemon configuration page
 #
 # Waiting to port to kamikaze...
Index: webif_0.3-8/www/cgi-bin/webif/system-startup.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/system-startup.sh
+++ webif_0.3-8/www/cgi-bin/webif/system-startup.sh
@@ -1,7 +1,8 @@
 #!/usr/bin/webif-page
 <?
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 ###################################################################
 # startup
 #
 # Description:
@@ -26,11 +27,11 @@
 #	/etc/init.d/S95custom-user-startup
 #	/etc/init.d/.x95custom-user-startup-default
 #
 # Required components:
-#       /usr/lib/webif/common.awk
-#       /usr/lib/webif/browser.awk
-#       /usr/lib/webif/editor.awk
+#       $libdir/common.awk
+#       $libdir/browser.awk
+#       $libdir/editor.awk
 #
 
 header_inject_head=$(cat <<EOF
 <script type="text/javascript">
@@ -186,10 +187,10 @@ if empty "$FORM_edit"; then
 	(ls -alLe "$FORM_path" 2>/dev/null | sed '/^[^d]/d';
 		ls -alLe "$FORM_path" 2>/dev/null | sed '/^[d]/d') 2>/dev/null | awk \
 		-v url="$SCRIPT_NAME" \
 		-v path="$FORM_path" \
-		-f /usr/lib/webif/common.awk \
-		-f /usr/lib/webif/browser.awk
+		-f $libdir/common.awk \
+		-f $libdir/browser.awk
 else
 	exists "$saved_filename" && {
 		edit_filename="$saved_filename"
 	} || {
@@ -198,10 +199,10 @@ else
 	cat "$edit_filename" 2>/dev/null | awk \
 		-v url="$SCRIPT_NAME" \
 		-v path="$FORM_path" \
 		-v file="$FORM_edit" \
-		-f /usr/lib/webif/common.awk \
-		-f /usr/lib/webif/editor.awk
+		-f $libdir/common.awk \
+		-f $libdir/editor.awk
 fi
 
 footer ?>
 <!--
Index: webif_0.3-8/www/cgi-bin/webif/system-upgrade.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/system-upgrade.sh
+++ webif_0.3-8/www/cgi-bin/webif/system-upgrade.sh
@@ -1,6 +1,7 @@
 #!/usr/bin/webif-page -p /bin/sh
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 
 header "System" "Upgrade" "@TR<<Firmware Upgrade>>"
 
 #####################################################################
Index: webif_0.3-8/www/cgi-bin/webif/vpn-openvpn.sh
===================================================================
--- webif_0.3-8.orig/www/cgi-bin/webif/vpn-openvpn.sh
+++ webif_0.3-8/www/cgi-bin/webif/vpn-openvpn.sh
@@ -2,9 +2,10 @@
 <?
 # add haserl args in double quotes it has very ugly
 # command line parsing code!
 
-. /usr/lib/webif/webif.sh
+. /etc/webif/webif-paths.sh
+. $libdir/webif.sh
 load_settings "openvpn"
 
 header "VPN" "OpenVPN" "@TR<<OpenVPN>>" ' onload="modechange()" ' "$SCRIPT_NAME"
 
openSUSE Build Service is sponsored by