post-install/post-remove are now reasonably complete.

This commit is contained in:
Wouter R
2013-05-14 15:09:56 +02:00
parent 9789fdc0c3
commit ce11cd8c1d
5 changed files with 64 additions and 41 deletions
+37 -6
View File
@@ -1,7 +1,37 @@
########### NOTE: add an extra '$' in front of all existing ones when copying into Makefile (and remove this line...)
#!/bin/sh
addFirewallNet() {
cfgChanged=0; zoneNum=-1; i=0
while true; do
name=`uci get firewall.@zone[$i].name 2>&1`
exists=`echo "$name" | grep "Entry not found" >/dev/null 2>&1; echo $?`
if [ $exists -eq 0 ]; then break; fi
if [ $name = "lan" ]; then zoneNum=$i; fi
i=`expr $i + 1`
done
if [ $zoneNum -gt -1 ]; then
network=`uci get firewall.@zone[$zoneNum].network 2>&1`
hasWlan=`echo $network | grep "wlan" >/dev/null 2>&1; echo $?`
if [ $hasWlan -eq 1 ]; then
uci set firewall.@zone[$zoneNum].network="lan wlan"
uci commit firewall
/etc/init.d/dnsmasq reload
cfgChanged=1
fi
fi
if [ $cfgChanged -eq 1 ]; then
echo "Added network 'wlan' to zone lan."
else
echo "Firewall configuration not changed."
fi
}
if [ ! -f /etc/banner.default ]; then
mv /etc/banner /etc/banner.default
cat <<-'EOM' > /etc/banner
@@ -15,6 +45,7 @@ if [ ! -f /etc/banner.default ]; then
.
EOM
fi
grep '^# DO NOT MODIFY.*wifibox package.$' /root/.profile >/dev/null 2>&1
if [ $? -eq 1 ]; then
cat <<-EOM >> /root/.profile
@@ -25,10 +56,10 @@ if [ $? -eq 1 ]; then
EOM
fi
@echo "Enabling wifi device..."
echo "Enabling wifi device..."
uci set wireless.@wifi-device[0].disabled=0; uci commit wireless; wifi
./add-fw-net.sh
addFirewallNet
@echo "Adding network interface 'wlan'..."
echo "Adding network interface 'wlan'..."
uci set network.wlan=interface; uci commit network; /etc/init.d/network reload