source: branches/whiterussian/openwrt/package/webif/files/usr/lib/webif/apply.sh @ 2061

Last change on this file since 2061 was 2061, checked in by nbd, 11 years ago

small bugfixes

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.2 KB
Line 
1#!/bin/ash
2#
3# Default handlers for config files
4#
5HANDLERS_config='
6        wireless) reload_wireless;;
7        network) reload_network;;
8'
9HANDLERS_file='
10        hosts) rm -f /etc/hosts; mv $config /etc/hosts; killall -HUP dnsmasq ;;
11        ethers) rm -f /etc/ethers; mv $config /etc/ethers; killall -HUP dnsmasq ;;
12'
13
14reload_network() {
15        echo Reloading networking settings...
16        grep '^wan_' config-network >&- 2>&- && {
17                ifdown wan
18                ifup wan
19        }
20       
21        grep '^lan_' config-network >&- 2>&- && {
22                ifdown lan
23                ifup lan
24        }
25}
26
27reload_wireless() {
28        echo Reloading wireless settings...
29        killall nas >&- 2>&- && sleep 2
30        /sbin/wifi
31        [ -f /etc/init.d/S41wpa ] && /etc/init.d/S41wpa
32}
33
34cd /tmp/.webif
35
36# file-*                other config files
37for config in $(ls file-* 2>&-); do
38        name=${config#file-}
39        echo "Processing config file: $name"
40        eval 'case "$name" in
41                '"$HANDLERS_file"'
42        esac'
43done
44
45# config-*              simple config files
46[ -f /etc/nvram.overrides ] && ( # White Russian
47        cd /proc/self
48        cat /tmp/.webif/config-* 2>&- | tee fd/1 | xargs -n1 nvram set
49)
50echo "Committing NVRAM..."
51nvram commit
52for config in $(ls config-* 2>&-); do
53        name=${config#config-}
54        eval 'case "$name" in
55                '"$HANDLERS_config"'
56        esac'
57done
58sleep 2
59rm -f config-*
Note: See TracBrowser for help on using the repository browser.