Changeset 388
- Timestamp:
- 10/19/07 16:55:10 (1 year ago)
- Files:
-
- firmware/trunk/kamikaze/package/webif/Makefile (modified) (3 diffs)
- firmware/trunk/kamikaze/package/webif/embed_rev.sh (modified) (2 diffs)
- firmware/trunk/kamikaze/package/webif/files/etc/init.d/openvpn (deleted)
- firmware/trunk/kamikaze/package/webif/files/usr/lib/webif/apply.sh (modified) (12 diffs)
- firmware/trunk/kamikaze/package/webif/files/usr/lib/webif/browser.awk (modified) (1 diff)
- firmware/trunk/kamikaze/package/webif/files/usr/lib/webif/common.awk (modified) (4 diffs)
- firmware/trunk/kamikaze/package/webif/files/usr/lib/webif/functions.sh (modified) (1 diff)
- firmware/trunk/kamikaze/package/webif/files/usr/lib/webif/timezones.csv (modified) (4 diffs)
- firmware/trunk/kamikaze/package/webif/files/usr/lib/webif/webif.sh (modified) (1 diff)
- firmware/trunk/kamikaze/package/webif/files/www/cgi-bin/webif/config.sh (modified) (3 diffs)
- firmware/trunk/kamikaze/package/webif/files/www/cgi-bin/webif/network-ddns.sh (modified) (3 diffs)
- firmware/trunk/kamikaze/package/webif/files/www/cgi-bin/webif/network-dhcp.sh (added)
- firmware/trunk/kamikaze/package/webif/files/www/cgi-bin/webif/network-dhcpiface.awx (deleted)
- firmware/trunk/kamikaze/package/webif/files/www/cgi-bin/webif/network-firewall.sh (modified) (5 diffs)
- firmware/trunk/kamikaze/package/webif/files/www/cgi-bin/webif/network-interfaces.sh (added)
- firmware/trunk/kamikaze/package/webif/files/www/cgi-bin/webif/network-wakeonlan.sh (modified) (1 diff)
- firmware/trunk/kamikaze/package/webif/files/www/cgi-bin/webif/network-wan-lan.sh (deleted)
- firmware/trunk/kamikaze/package/webif/files/www/cgi-bin/webif/network-wlan.sh (modified) (14 diffs)
- firmware/trunk/kamikaze/package/webif/files/www/cgi-bin/webif/network.sh (added)
- firmware/trunk/kamikaze/package/webif/files/www/cgi-bin/webif/status-iptables.sh (modified) (1 diff)
- firmware/trunk/kamikaze/package/webif/files/www/cgi-bin/webif/status-openvpn.sh (modified) (1 diff)
- firmware/trunk/kamikaze/package/webif/files/www/cgi-bin/webif/status-pptp.sh (modified) (1 diff)
- firmware/trunk/kamikaze/package/webif/files/www/cgi-bin/webif/system-ipkg.sh (modified) (1 diff)
- firmware/trunk/kamikaze/package/webif/files/www/cgi-bin/webif/system-settings.sh (modified) (1 diff)
- firmware/trunk/kamikaze/package/webif/files/www/themes/sedky1/webif.css (modified) (1 diff)
- firmware/trunk/kamikaze/package/webif/files/www/themes/xwrt-mini/webif.css (modified) (1 diff)
- firmware/trunk/kamikaze/package/webif/files/www/themes/xwrt/webif.css (modified) (1 diff)
- firmware/trunk/kamikaze/package/webif/files/www/themes/zephyr/webif.css (modified) (2 diffs)
- firmware/trunk/kamikaze/package/webif/ipkg/webif.postinst (modified) (1 diff)
- firmware/trunk/kamikaze/package/webif/storage/dnsmasq (deleted)
- firmware/trunk/kamikaze/package/webif/storage/network-dhcpiface.awx (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
firmware/trunk/kamikaze/package/webif/Makefile
r387 r388 3 3 PKG_NAME:=webif 4 4 PKG_VERSION:=0.3 5 PKG_RELEASE:= 65 PKG_RELEASE:=8 6 6 7 7 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) … … 17 17 DEPENDS:=+haserl 18 18 TITLE:=An HTTP administrative console for OpenWrt. 19 DESCRIPTION:=\20 This package contains Webif^2, a web based administration console for OpenWrt.21 19 VERSION:=$(PKG_VERSION)-$(PKG_RELEASE) 22 20 endef … … 174 172 rm -f $(1)/usr/lib/webif/fixed-functions.sh; \ 175 173 fi 176 ./embed_rev.sh $(1)/www/.version \ 177 $(1)/usr/lib/webif/webif.sh \ 178 $(1)/etc/init.d/* \ 179 $(1)/www/cgi-bin/webif/* 180 chmod 777 $(1)/CONTROL/*inst 181 ./embed_rev.sh $(1)/CONTROL/*inst 182 chmod 755 $(1)/CONTROL/*inst 174 ./embed_rev.sh $(1) 183 175 mkdir -p $(1)/usr/bin 184 176 $(INSTALL_BIN) $(PKG_BUILD_DIR)/webifmetabin $(1)/usr/bin/webifmetabin firmware/trunk/kamikaze/package/webif/embed_rev.sh
r354 r388 1 1 #!/bin/sh 2 2 # 3 # this script embeds the global revision number in document(s) given on command line 4 # document should have __SVN_REVISION__ where it wants the revision number 5 # to be placed. Wildcards okay. 3 # this script embeds the global revision number in document(s) given 4 # on command line 5 # document should have __SVN_REVISION__ where it wants the revision 6 # number to be placed. Wildcards okay. 6 7 # 7 8 if [ $# -lt 1 ]; then … … 10 11 fi 11 12 revision_number=$(svn info | grep Revision | cut -c11-) 12 tempfile=$(mktemp)13 13 echo " Revision number is $revision_number" 14 echo " Temporary file is $tempfile"15 14 until [ -z "$1" ] 16 15 do 17 for curfile in $ 1; do16 for curfile in $(grep -H "__SVN_REVISION__" -r "$1" | cut -d':' -f1 | sed '/\.svn\//d'); do 18 17 echo " Processing $curfile ..." 19 cp $curfile $tempfile 20 cat $tempfile | sed s/__SVN_REVISION__/$revision_number/ > $curfile 21 rm $tempfile 18 sed -i -e "s/__SVN_REVISION__/$revision_number/" "$curfile" 22 19 done 23 shift20 shift 24 21 done 25 22 firmware/trunk/kamikaze/package/webif/files/usr/lib/webif/apply.sh
r387 r388 19 19 timezone_cfg="$CONFIG_SECTION" 20 20 ;; 21 ntp_client )21 ntp_client|ntpclient) 22 22 config_get hostname $CONFIG_SECTION hostname 23 23 config_get port $CONFIG_SECTION port … … 25 25 26 26 [ "$DONE" = "1" ] && exit 0 27 ps x| grep 'bin/[n]tpclient' >&- || {27 ps | grep 'bin/[n]tpclient' >&- || { 28 28 route -n 2>&- | grep '^0.0.0.0' >&- && { 29 29 /usr/sbin/ntpclient -c ${count:-1} -s -h $hostname -p ${port:-123} 2>&- >&- && DONE=1 … … 65 65 # leave if some files not applied 66 66 rm -r "/tmp/.webif/edited-files" 2>&- 67 68 69 config_allclear() { 70 for var in $(set | grep "^CONFIG_" | sed -e 's/\(.*\)=.*$/\1/'); do 71 unset "$var" 72 done 73 } 74 75 reload_upnpd() { 76 config_load upnpd 77 config_get_bool test config enabled 0 78 if [ 1 -eq "$test" ]; then 79 echo '@TR<<Starting>> @TR<<upnpd>> ...' 80 [ -f /etc/init.d/miniupnpd ] && { 81 /etc/init.d/miniupnpd enable >&- 2>&- <&- 82 /etc/init.d/miniupnpd start >&- 2>&- <&- 83 } 84 [ -f /etc/init.d/upnpd ] && { 85 /etc/init.d/upnpd enable >&- 2>&- <&- 86 /etc/init.d/upnpd restart >&- 2>&- <&- 87 } 88 else 89 echo '@TR<<Stopping>> @TR<<upnpd>> ...' 90 [ -f /etc/init.d/miniupnpd ] && { 91 /etc/init.d/miniupnpd stop >&- 2>&- <&- 92 /etc/init.d/miniupnpd disable >&- 2>&- <&- 93 } 94 [ -f /etc/init.d/upnpd ] && { 95 /etc/init.d/upnpd stop >&- 2>&- <&- 96 /etc/init.d/upnpd disable >&- 2>&- <&- 97 } 98 fi 99 config_allclear 100 } 101 67 102 68 103 # file-* other config files … … 93 128 done 94 129 130 # clear all uci settings to free memory 95 131 # init_theme - initialize a new theme 96 132 init_theme() { 97 echo '@TR<<Initializing theme ...>>' 98 uci_load "webif" 99 newtheme="$CONFIG_theme_id" 133 echo '@TR<<Initializing theme ...>>' 134 config_get newtheme theme id 100 135 # if theme isn't present, then install it 101 136 ! exists "/www/themes/$newtheme/webif.css" && { … … 116 151 } 117 152 118 reload_upnpd() {119 config_load upnpd120 config_get_bool test config enabled 0121 if [ 1 -eq "$test" ]; then122 echo '@TR<<Starting>> @TR<<upnpd>> ...'123 [ -f /etc/init.d/miniupnpd ] && {124 /etc/init.d/miniupnpd enable >&- 2>&- <&-125 /etc/init.d/miniupnpd start >&- 2>&- <&-126 }127 [ -f /etc/init.d/upnpd ] && {128 /etc/init.d/upnpd enable >&- 2>&- <&-129 /etc/init.d/upnpd restart >&- 2>&- <&-130 }131 else132 echo '@TR<<Stopping>> @TR<<upnpd>> ...'133 [ -f /etc/init.d/miniupnpd ] && {134 /etc/init.d/miniupnpd stop >&- 2>&- <&-135 /etc/init.d/miniupnpd disable >&- 2>&- <&-136 }137 [ -f /etc/init.d/upnpd ] && {138 /etc/init.d/upnpd stop >&- 2>&- <&-139 /etc/init.d/upnpd disable >&- 2>&- <&-140 }141 fi142 config_clear config143 }144 145 153 # switch_language (old_lang) - switches language if changed 146 154 switch_language() { 147 155 oldlang="$1" 148 uci_load "webif" 149 newlang="$CONFIG_general_lang" 156 config_get newlang general lang 150 157 ! equal "$newlang" "$oldlang" && { 151 158 echo '@TR<<Applying>> @TR<<Installing language pack>> ...' … … 167 174 } 168 175 169 uci_load_originals() {170 local cfsection171 config_ load "$1"172 for cfsection in $CONFIG_SECTIONS; do173 config_rename "$cfsection" "orig_$cfsection"174 done175 CONFIG_orig_SECTION="$CONFIG_SECTIONS"176 } 177 178 uci_unset_originals() { 179 local cfsection180 local oldvar181 for cfsection in $CONFIG_orig_SECTION; do182 for oldvar in $(set | grep "^CONFIG_${cfsection}_" | sed -e 's/\(.*\)=.*$/\1/'); do183 unset "$oldvar"184 done185 done186 unset CONFIG_orig_SECTION 187 } 176 reload_qos() { 177 config_load qos 178 config_get_bool wan_enabled wan enabled 0 179 if [ 1 -eq "$wan_enabled" ]; then 180 echo '@TR<<Starting>> @TR<<qos>> ...' 181 [ -f /etc/init.d/qos ] && { 182 /etc/init.d/qos enable >&- 2>&- <&- 183 /etc/init.d/qos start >&- 2>&- <&- 184 } 185 else 186 echo '@TR<<Stopping>> @TR<<qos>> ...' 187 [ -f /etc/init.d/qos ] && { 188 /etc/init.d/qos stop >&- 2>&- <&- 189 /etc/init.d/qos disable >&- 2>&- <&- 190 } 191 fi 192 config_allclear 193 } 194 188 195 189 196 # config-* simple config files … … 202 209 # now apply any UCI config changes 203 210 # 211 process_packages="" 204 212 for ucifile in $(ls /tmp/.uci/* 2>&-); do 205 213 # do not process lock files 206 214 [ "${ucifile%.lock}" != "${ucifile}" ] && continue 207 # store original language before committing new one so we know if changed 208 equal "$ucifile" "/tmp/.uci/webif" && { 209 uci_load_originals "webif" 210 oldlang="$CONFIG_orig_general_lang" 211 uci_unset_originals "webif" 212 uci_load "webif" 213 } 215 214 216 package=${ucifile#/tmp/.uci/} 217 process_packages="$process_packages $package" 218 219 # get old/updated values for the package here 220 case "$ucifile" in 221 "/tmp/.uci/webif") 222 config_load "/etc/config/$package" 223 config_get apply_webif_oldlang general lang 224 ;; 225 esac 226 config_allclear 227 228 # commit settings 215 229 echo "@TR<<Committing>> $package ..." 216 230 uci_commit "$package" 217 case "$ucifile" in 218 "/tmp/.uci/qos") qos-start;; 219 "/tmp/.uci/webif") 220 switch_language "$oldlang" 231 done 232 233 [ -n "$process_packages" ] && echo "@TR<<Waiting for the commit to finish>>..." 234 LOCK=`which lock` || LOCK=: 235 for ucilock in $(ls /tmp/.uci/*.lock 2>&-); do 236 $LOCK -w "$ucilock" 237 rm "$ucilock" >&- 2>&- 238 done 239 240 # now process changes in UCI configs 241 for package in $process_packages; do 242 # process settings 243 case "$package" in 244 "qos") 245 reload_qos 246 ;; 247 "webif") 248 config_load webif 249 switch_language "$apply_webif_oldlang" 221 250 init_theme 222 251 /etc/init.d/webif start 223 ;; 224 "/tmp/.uci/upnpd") 252 config_allclear 253 ;; 254 "upnpd") 225 255 reload_upnpd 226 256 ;; 227 " /tmp/.uci/network")257 "network") 228 258 echo '@TR<<Reloading>> @TR<<network>> ...' 229 259 /etc/init.d/network restart … … 233 263 fi 234 264 ;; 235 "/tmp/.uci/ntp_client") 265 "ntp_client") 266 #this is for 7.07 and previous 236 267 killall ntpclient 237 268 config_load ntp_client& 238 269 ;; 239 "/tmp/.uci/dhcp") 270 "ntpclient") 271 killall ntpclient 272 config_load ntpclient& 273 ;; 274 "dhcp") 240 275 killall dnsmasq 241 276 [ -z "$(ps | grep "[d]nsmasq ")" ] && /etc/init.d/dnsmasq start 242 277 ;; 243 " /tmp/.uci/wireless")278 "wireless") 244 279 echo '@TR<<Reloading>> @TR<<wireless>> ...' 245 280 wifi ;; 246 " /tmp/.uci/syslog")281 "syslog") 247 282 echo '@TR<<Reloading>> @TR<<syslogd>> ...' 248 283 /etc/init.d/syslog restart >&- 2>&- ;; 249 " /tmp/.uci/openvpn")284 "openvpn") 250 285 echo '@TR<<Reloading>> @TR<<OpenVPN>> ...' 251 286 killall openvpn >&- 2>&- <&- 252 /etc/init.d/openvpn start ;; 253 "/tmp/.uci/system") 287 uci_load "openvpn" 288 if [ "$CONFIG_general_mode" = "client" ]; then 289 /etc/init.d/webifopenvpn enable 290 else 291 /etc/init.d/webifopenvpn disable 292 fi 293 /etc/init.d/webifopenvpn start ;; 294 "system") 254 295 config_load system ;; 255 " /tmp/.uci/snmp")296 "snmp") 256 297 echo '@TR<<Exporting>> @TR<<snmp settings>> ...' 257 298 [ -e "/sbin/save_snmp" ] && { … … 265 306 /etc/init.d/S??snmpd restart >&- 2>&- 266 307 ;; 267 " /tmp/.uci/l2tpns")308 "l2tpns") 268 309 echo '@TR<<Exporting>> @TR<<l2tpns server settings>> ...' 269 310 [ -e "/usr/lib/webif/l2tpns_apply.sh" ] && { … … 274 315 /etc/init.d/l2tpns restart >&- 2>&- 275 316 ;; 276 " /tmp/.uci/updatedd")317 "updatedd") 277 318 uci_load "updatedd" 278 319 if [ "$CONFIG_ddns_update" = "1" ]; then … … 284 325 /etc/init.d/ddns stop >&- 2>&- <&- 285 326 fi 327 config_allclear 286 328 ;; 287 " /tmp/.uci/timezone")329 "timezone") 288 330 echo '@TR<<Exporting>> @TR<<TZ setting>> ...' 289 331 [ ! -f /etc/rc.d/S??timezone ] && /etc/init.d/timezone enable >&- 2>&- <&- 290 332 /etc/init.d/timezone restart 291 333 ;; 292 " /tmp/.uci/webifssl")334 "webifssl") 293 335 config_load webifssl 294 336 config_get_bool test matrixtunnel enable 0 … … 306 348 } 307 349 fi 350 config_allclear 308 351 ;; 309 352 esac firmware/trunk/kamikaze/package/webif/files/usr/lib/webif/browser.awk
r354 r388 47 47 gsub(/^\/\//, "/", fullpath) 48 48 print "<td class=\"leftimage\"><a href=\"" url "?path=" fullpath "\"><img src=\"/images/dir.gif\" alt=\"@TR<<browser_Parent_Directory#Parent Directory>>\" /></a></td>" 49 print "<td><a href=\"" url "?path=" fullpath "\">@TR<<browser_Parent_Directory#Parent Directory>></a> "49 print "<td><a href=\"" url "?path=" fullpath "\">@TR<<browser_Parent_Directory#Parent Directory>></a></td>" 50 50 print "<td> </td>" 51 51 print "<td> </td>" firmware/trunk/kamikaze/package/webif/files/usr/lib/webif/common.awk
r387 r388 33 33 function config_get_bool(package, option, default, var) { 34 34 var = config_get(package, option); 35 if ((var == " enabled") || (var == "1") || (var == "on")) return 136 if ((var == " disabled") || (var == "0") || (var == "off")) return 035 if ((var == "1") || (var == "on") || (var == "true") || (var == "enabled")) return 1 36 if ((var == "0") || (var == "off") || (var == "false") || (var == "disabled")) return 0 37 37 return (default == "1" ? 1 : 0) 38 38 } … … 118 118 # parse all ##WEBIF... 119 119 n = 0 120 while (("grep '^##WEBIF:' /www/cgi-bin/webif/*.awx /www/cgi-bin/webif/*.sh 2>/dev/null | sed 's,^[^:]*\/,,; s/##WEBIF:name://; s/^\\([^:]*\\):\\(.*\\)/\\2:\\1/' | sort" | getline) == 1) {120 while (("grep '^##WEBIF:' "cgidir"/*.awx "cgidir"/*.sh 2>/dev/null | sed 's,^[^:]*\/,,; s/##WEBIF:name://; s/^\\([^:]*\\):\\(.*\\)/\\2:\\1/' | sort" | getline) == 1) { 121 121 if ((mainmenu[$1 SUBSEP "url"] == "") && ($4 != "")) mainmenu[$1 SUBSEP "url"] = rootdir "/" $4 122 122 if (mainmenu[$1 SUBSEP "pages"] !~ /:$2:/) { … … 133 133 } 134 134 # parse extra subcategories 135 while (("/bin/ash -c '. /www/cgi-bin/webif/graphs-subcategories.sh; subcategories_extra' | sed 's/##WEBIF:name://' | sort" | getline) == 1) {135 while (("/bin/ash -c '. "cgidir"/graphs-subcategories.sh; subcategories_extra' | sed 's/##WEBIF:name://' | sort" | getline) == 1) { 136 136 if ((mainmenu[$1 SUBSEP "url"] == "") && ($4 != "")) mainmenu[$1 SUBSEP "url"] = rootdir "/" $4 137 137 mainmenu[$1 SUBSEP "count"]++ … … 245 245 # parameters: 0 246 246 function status(hostname, uptime, loadavg, i) { 247 if (config_get("general", "use_short_status_frame") == "1") {248 return "<iframe src=\"/cgi-bin/webif/iframe.mini-info.sh\" width=\"200\" height=\"80\" scrolling=\"no\" frameborder=\"0\"></iframe>"249 }250 251 247 getline < "/proc/sys/kernel/hostname" 252 248 hostname=$0 firmware/trunk/kamikaze/package/webif/files/usr/lib/webif/functions.sh
r354 r388 175 175 pcnt=$((pcnt + 1)) 176 176 empty $(ipkg list_installed | grep "^$pkg ") && { 177 echo -n "<p>@TR<<features_require_package#Features on this page require the package>>: \"<b>$pkg</b>\". <a href=\"/cgi-bin/webif/ ipkg.sh?action=install&pkg=$pkg&prev=$SCRIPT_NAME\">@TR<<features_install#install now>></a>.</p>"177 echo -n "<p>@TR<<features_require_package#Features on this page require the package>>: \"<b>$pkg</b>\". <a href=\"/cgi-bin/webif/system-ipkg.sh?action=install&pkg=$pkg&prev=$SCRIPT_NAME\">@TR<<features_install#install now>></a>.</p>" 178 178 retval=1; 179 179 nothave=$((nothave + 1)) firmware/trunk/kamikaze/package/webif/files/usr/lib/webif/timezones.csv
r387 r388 1 1 #timezone group timezone cities timezone config string zoneinfo 2 #revision: 2007 f2 #revision: 2007h 3 3 # it is not exact for the "cities list" but it enables to remember 4 4 # the selection and to synchronize TZs with the standard zoneinfo 5 Australia Melbourne,Canberra,Sydney EST-10EST,M10. 5.0,M3.5.0/3 Australia/Melbourne6 Australia Perth WST-8 Australia/Perth Perth5 Australia Melbourne,Canberra,Sydney EST-10EST,M10.1.0,M4.1.0/3 Australia/Melbourne 6 Australia Perth WST-8 Australia/Perth 7 7 Australia Brisbane EST-10 Australia/Brisbane 8 Australia Adelaide CST-9:30CST,M10. 5.0,M3.5.0/3 Australia/Adelaide8 Australia Adelaide CST-9:30CST,M10.1.0,M4.1.0/3 Australia/Adelaide 9 9 Australia Darwin CST-9:30 Australia/Darwin 10 Australia Hobart EST-10EST,M10.1.0,M 3.5.0/3 Australia/Hobart10 Australia Hobart EST-10EST,M10.1.0,M4.1.0/3 Australia/Hobart 11 11 12 12 Europe Amsterdam,Netherlands CET-1CEST,M3.5.0,M10.5.0/3 Europe/Amsterdam … … 31 31 Europe Zurich,Switzerland CET-1CEST,M3.5.0,M10.5.0/3 Europe/Zurich 32 32 33 New Zealand Auckland, Wellington NZST-12NZDT,M 10.1.0,M3.3.0/3 Pacific/Auckland33 New Zealand Auckland, Wellington NZST-12NZDT,M9.5.0,M4.1.0/3 Pacific/Auckland 34 34 35 35 USA & Canada Hawaii Time HST10 Pacific/Honolulu … … 47 47 Asia (UTC+2) Amman EET-2EEST,M3.5.4/0,M10.5.5/1 Asia/Amman 48 48 Asia (UTC+2) Beirut EET-2EEST,M3.5.0/0,M10.5.0/0 Asia/Beirut 49 Asia (UTC+2) Damascus EET-2EEST, J91/0,J274/0 Asia/Damascus50 Asia (UTC+2) Gaza EET-2EEST,J91/0,M 10.3.5/0Asia/Gaza49 Asia (UTC+2) Damascus EET-2EEST,M3.5.5/0,J274/0 Asia/Damascus 50 Asia (UTC+2) Gaza EET-2EEST,J91/0,M9.2.4 Asia/Gaza 51 51 Asia (UTC+2) Jerusalem GMT-2 Asia/Jerusalem 52 52 Asia (UTC+2) Nicosia EET-2EEST,M3.5.0/3,M10.5.0/4 Asia/Nicosia … … 109 109 Asia (UTC+9) Yakutsk YAKT-9YAKST,M3.5.0,M10.5.0/3 Asia/Yakutsk 110 110 111 Central and South America Sao Paulo,Brazil BRT3BRST,M1 1.1.0/0,M2.5.0/0 America/Sao_Paulo111 Central and South America Sao Paulo,Brazil BRT3BRST,M10.2.0/0,M2.3.0/0 America/Sao_Paulo 112 112 Central and South America Argentina ART3 America/Argentina/Buenos_Aires 113 113 # no offense, just something in the center firmware/trunk/kamikaze/package/webif/files/usr/lib/webif/webif.sh
r387 r388 74 74 pcnt=$((pcnt + 1)) 75 75 empty $(ipkg list_installed | grep "^$pkg ") && { 76 echo -n "<p>@TR<<features_require_package#Features on this page require the package>>: \"<b>$pkg</b>\". <a href=\"/cgi-bin/webif/ ipkg.sh?action=install&pkg=$pkg&prev=$SCRIPT_NAME\">@TR<<features_install#install now>></a>.</p>"76 echo -n "<p>@TR<<features_require_package#Features on this page require the package>>: \"<b>$pkg</b>\". <a href=\"/cgi-bin/webif/system-ipkg.sh?action=install&pkg=$pkg&prev=$SCRIPT_NAME\">@TR<<features_install#install now>></a>.</p>" 77 77 retval=1; 78 78 nothave=$((nothave + 1)) firmware/trunk/kamikaze/package/webif/files/www/cgi-bin/webif/config.sh
r387 r388 9 9 esac 10 10 case "$FORM_mode" in 11 nochange) header "$FORM_cat" ."@TR<<No config change.|No configuration changes were made.>>";;11 nochange) header "$FORM_cat" "" "@TR<<No config change.|No configuration changes were made.>>";; 12 12 clear) 13 13 rm -r /tmp/.webif/* >&- 2>&- 14 rm /tmp/.uci/* >&- 2>&- 15 header "$FORM_cat" ."@TR<<Config discarded.|Your configuration changes have been discarded.>>"14 rm /tmp/.uci/* >&- 2>&- 15 header "$FORM_cat" "" "@TR<<Config discarded.|Your configuration changes have been discarded.>>" 16 16 CHANGES="" 17 17 echo "${FORM_prev:+<meta http-equiv=\"refresh\" content=\"2; URL=$FORM_prev\" />}" 18 18 ;; 19 19 review) 20 header "$FORM_cat" . "@TR<<Config changes:|Current configuration changes:>>"20 header "$FORM_cat" "" "@TR<<Config changes:|Current configuration changes:>>" 21 21 for configname in $(ls /tmp/.webif/config-* 2>&-); do 22 22 grep = $configname >&- 2>&- && { … … 25 25 echo '</pre><br />' 26 26 } 27 done 27 done 28 28 CONFIGFILES="" 29 29 for configname in $(ls /tmp/.webif/file-* 2>&-); do 30 30 exists "$configname" && { 31 configname=$(echo $configname | sed s/'\/tmp\/.webif\/'//g) 31 configname=$(echo $configname | sed s/'\/tmp\/.webif\/'//g) 32 32 CONFIGFILES="$CONFIGFILES ${configname#/tmp/.webif/file-}" 33 33 } 34 done 34 done 35 35 for configname in $(ls /tmp/.uci/* 2>&- | grep -v "\\.lock\$" 2>&-); do 36 36 echo -n "<h3>${configname#/tmp/.uci/}</h3><br /><pre>" … … 51 51 ;; 52 52 save) 53 header "$FORM_cat" ."@TR<<Updating config...|Updating your configuration...>>"53 header "$FORM_cat" "" "@TR<<Updating config...|Updating your configuration...>>" 54 54 CHANGES="" 55 55 echo "<pre>" firmware/trunk/kamikaze/package/webif/files/www/cgi-bin/webif/network-ddns.sh
r387 r388 21 21 22 22 header "Network" "DynDNS" "@TR<<DynDNS Settings>>" 'onload="modechange()"' "$SCRIPT_NAME" 23 24 uci_load "webif" 25 config_get revision general firmware_version 26 if [ "$revision" = "7.07" ]; then 27 username="user" 28 password="passwd" 29 else 30 username="username" 31 password="password" 32 fi 23 33 24 34 #define supported services … … 54 64 uci_load "updatedd" 55 65 config_get FORM_ddns_service cfg1 ddns_service 56 config_get FORM_ddns_user cfg1 ddns_ user57 config_get FORM_ddns_passwd cfg1 ddns_ passwd66 config_get FORM_ddns_user cfg1 ddns_$username 67 config_get FORM_ddns_passwd cfg1 ddns_$password 58 68 config_get FORM_ddns_host cfg1 ddns_host 59 69 config_get FORM_ddns_update cfg1 ddns_update … … 71 81 uci_set "updatedd" "cfg1" "ddns_update" "$FORM_ddns_update" 72 82 uci_set "updatedd" "cfg1" "ddns_service" "$FORM_ddns_service" 73 uci_set "updatedd" "cfg1" "ddns_ user" "$FORM_ddns_user"74 uci_set "updatedd" "cfg1" "ddns_ passwd" "$FORM_ddns_passwd"83 uci_set "updatedd" "cfg1" "ddns_$username" "$FORM_ddns_user" 84 uci_set "updatedd" "cfg1" "ddns_$password" "$FORM_ddns_passwd" 75 85 uci_set "updatedd" "cfg1" "ddns_host" "$FORM_ddns_host" 76 86 } firmware/trunk/kamikaze/package/webif/files/www/cgi-bin/webif/network-firewall.sh
r354 r388 39 39 } 40 40 41 config_load "network" 42 config_load "/var/state/network" 43 config_get default_lan_target lan ipaddr 44 default_lan_target="${default_lan_target:-192.168.1.1}" 45 41 46 empty "$FORM_up$FORM_down$FORM_save$FORM_delete$FORM_new" || { 42 47 empty "$FORM_up" || equal "$FORM_up" 1 || { … … 59 64 -v new="$FORM_new" \ 60 65 -v new_target="$FORM_new_target" \ 66 -v default_lan_target="$default_lan_target" \ 61 67 -f - "$FW_FILE" > "$FW_FILE_NEW" <<EOF 62 68 BEGIN { … … 120 126 END { 121 127 if (line_down != "") print line_down 122 if (new_target == "forward") new_target = new_target ":: 192.168.1.1"128 if (new_target == "forward") new_target = new_target "::" default_lan_target 123 129 if ((new != "") && (new_target != "")) print new_target 124 130 } … … 129 135 } 130 136 131 header "Network" "Firewall" "@TR<<Firewall Configuration>>" '' 132 133 ?> 134 <style> 137 header_inject_head=$(cat <<EOF 138 <style type="text/css"> 139 <!-- 135 140 td.edit_title { 136 141 font-weight: bold; … … 147 152 padding-bottom: auto; 148 153 } 154 --> 149 155 </style> 150 <? 156 157 EOF 158 ) 159 160 header "Network" "Firewall" "@TR<<Firewall Configuration>>" '' 151 161 152 162 awk \ firmware/trunk/kamikaze/package/webif/files/www/cgi-bin/webif/network-wakeonlan.sh
r354 r388 61 61 62 62 if [ -e /etc/ethers ]; then 63 cat $ETHERS_FILE | awk -F ' ''63 cat $ETHERS_FILE | awk ' 64 64 { 65 "grep -e "$2" /etc/hosts | sed \"s/^"$2"\w*//\"" | getline hostname; 66 print "<tr><td>" hostname "</td><td>" $2 "</td><td>" $1 "</td><td><button name=\"wake\" type=\"submit\" value=\"" $1 "\">Wake up</button></td></tr>"; 65 if ($1 ~ /^[[:xdigit:]]{2,2}:[[:xdigit:]]{2,2}:[[:xdigit:]]{2,2}:[[:xdigit:]]{2,2}:[[:xdigit:]]{2,2}:[[:xdigit:]]{2,2}/) { 66 "grep -e "$2" /etc/hosts | sed \"s/^"$2"\w*//\"" | getline hostname; 67 print "<tr><td>" hostname "</td><td>" $2 "</td><td>" $1 "</td><td><button name=\"wake\" type=\"submit\" value=\"" $1 "\">Wake up</button></td></tr>" 68 } 67 69 }' 68 70 fi firmware/trunk/kamikaze/package/webif/files/www/cgi-bin/webif/network-wlan.sh
r387 r388 304 304 config_get FORM_mode $vcfg mode 305 305 config_get FORM_ssid $vcfg ssid 306 config_get FORM_bssid $vcfg bssid 306 307 config_get FORM_encryption $vcfg encryption 307 308 config_get FORM_key $vcfg key … … 322 323 config_get_bool FORM_isolate $vcfg isolate 323 324 config_get_bool FORM_bgscan $vcfg bgscan 325 config_get_bool FORM_wds $vcfg wds 324 326 else 325 327 eval FORM_key="\$FORM_radius_key_$vcfg" … … 343 345 eval FORM_broadcast="\$FORM_broadcast_$vcfg" 344 346 eval FORM_ssid="\$FORM_ssid_$vcfg" 347 eval FORM_wds="\$FORM_wds_$vcfg" 348 eval FORM_bssid="\$FORM_bssid_$vcfg" 345 349 eval FORM_network="\$FORM_network_$vcfg" 346 350 eval FORM_txpower="\$FORM_txpower_$vcfg" 347 351 eval FORM_bgscan="\$FORM_bgscan_$vcfg" 348 eval FORM_isolate="\$FORM_isolate_$vcfg"349 352 eval FORM_frag="\$FORM_frag_$vcfg" 350 353 eval FORM_rts="\$FORM_rts_$vcfg" … … 362 365 $network_options" 363 366 append forms "$network" "$N" 367 368 if [ "$iftype" != "mac80211" ]; then 369 option_wds="option|wds|@TR<<WDS>>" 370 append forms "helpitem|WDS Connections" "$N" 371 append forms "helptext|Helptext WDS Connections#Enter the MAC address of the router on your network that should be wirelessly connected to. The other router must also support wds and have the mac address of this router entered." "$N" 372 fi 364 373 365 374 mode_fields="field|@TR<<WLAN Mode#Mode>> 366 375 select|mode_$vcfg|$FORM_mode 367 376 option|ap|@TR<<Access Point>> 368 option|wds|@TR<<WDS>>377 $option_wds 369 378 option|sta|@TR<<Client>> 370 379 option|adhoc|@TR<<Ad-Hoc>>" 371 380 append forms "$mode_fields" "$N" 372 append forms "helpitem|WDS Connections" "$N" 373 append forms "helptext|Helptext WDS Connections#Enter the MAC address of the router on your network that should be wirelessly connected to. The other router must also support wds and have the mac address of this router entered." "$N" 381 382 wds="field|@TR<<WDS>>|wds_form_$vcfg|hidden 383 radio|wds_$vcfg|$FORM_wds|1|@TR<<On>> 384 radio|wds_$vcfg|$FORM_wds|0|@TR<<Off>>" 385 append forms "$wds" "$N" 374 386 375 387 hidden="field|@TR<<ESSID Broadcast>>|broadcast_form_$vcfg|hidden … … 392 404 393 405 if [ "$iftype" = "atheros" ]; then 394 eval txpowers="\$CONFIG_wireless_${device}_txpower" 395 [ -z "$txpowers" ] && { 396 txpower="" 397 for athname in $(ls /proc/sys/net/ 2>/dev/null | grep "^ath"); do 398 [ "$(cat /proc/sys/net/${athname}/\%parent)" = "$device" ] && { 399 for power in $(iwlist $athname txpower 2>&1 | sed '/dBm/!d /Current/d; s/^[[:space:]]*//;' | cut -d ' ' -f 1); do 406 eval txpowers="\$CONFIG_wireless_${device}_txpower" 407 [ -z "$txpowers" ] && { 408 txpower="" 409 for athname in $(ls /proc/sys/net/ 2>/dev/null | grep "^ath"); do 410 [ "$(cat /proc/sys/net/${athname}/\%parent)" = "$device" ] && { 411 for power in $(iwlist $athname txpower 2>&1 | sed '/dBm/!d /Current/d; s/^[[:space:]]*//;' | cut -d ' ' -f 1); do 412 txpower="$txpower $power" 413 done 414  
