mirror of
https://github.com/Doodle3D/doodle3d-firmware.git
synced 2024-12-22 11:03:48 +01:00
post-install/post-remove are now reasonably complete.
This commit is contained in:
parent
9789fdc0c3
commit
ce11cd8c1d
16
Makefile
16
Makefile
@ -3,6 +3,16 @@
|
|||||||
##############################################
|
##############################################
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
|
#NOTE: this hack is required to get files included inside a define block, see this link:
|
||||||
|
#http://stackoverflow.com/questions/3524726/how-to-make-eval-shell-work-in-gnu-make
|
||||||
|
#The '¤' character must not appear in included scripts.
|
||||||
|
define newline
|
||||||
|
|
||||||
|
|
||||||
|
endef
|
||||||
|
IncludeWithNewlines = $(subst ¤,$(newline),$(shell cat $1 | tr '\n' '¤'))
|
||||||
|
|
||||||
|
|
||||||
# Name and release number of this package
|
# Name and release number of this package
|
||||||
PKG_NAME:=wifibox
|
PKG_NAME:=wifibox
|
||||||
PKG_VERSION:=0.1.0
|
PKG_VERSION:=0.1.0
|
||||||
@ -101,9 +111,11 @@ endif
|
|||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/wifibox/postinst
|
define Package/wifibox/postinst
|
||||||
#!/bin/sh
|
$(call IncludeWithNewlines,post-install.sh)
|
||||||
touch /.postinst-was-here
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
define Package/wifibox/postrm
|
||||||
|
$(call IncludeWithNewlines,post-remove.sh)
|
||||||
|
endef
|
||||||
|
|
||||||
$(eval $(call BuildPackage,wifibox))
|
$(eval $(call BuildPackage,wifibox))
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
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
|
|
@ -1,7 +1,37 @@
|
|||||||
########### NOTE: add an extra '$' in front of all existing ones when copying into Makefile (and remove this line...)
|
|
||||||
|
|
||||||
|
|
||||||
#!/bin/sh
|
#!/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
|
if [ ! -f /etc/banner.default ]; then
|
||||||
mv /etc/banner /etc/banner.default
|
mv /etc/banner /etc/banner.default
|
||||||
cat <<-'EOM' > /etc/banner
|
cat <<-'EOM' > /etc/banner
|
||||||
@ -15,6 +45,7 @@ if [ ! -f /etc/banner.default ]; then
|
|||||||
.
|
.
|
||||||
EOM
|
EOM
|
||||||
fi
|
fi
|
||||||
|
|
||||||
grep '^# DO NOT MODIFY.*wifibox package.$' /root/.profile >/dev/null 2>&1
|
grep '^# DO NOT MODIFY.*wifibox package.$' /root/.profile >/dev/null 2>&1
|
||||||
if [ $? -eq 1 ]; then
|
if [ $? -eq 1 ]; then
|
||||||
cat <<-EOM >> /root/.profile
|
cat <<-EOM >> /root/.profile
|
||||||
@ -25,10 +56,10 @@ if [ $? -eq 1 ]; then
|
|||||||
EOM
|
EOM
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@echo "Enabling wifi device..."
|
echo "Enabling wifi device..."
|
||||||
uci set wireless.@wifi-device[0].disabled=0; uci commit wireless; wifi
|
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
|
uci set network.wlan=interface; uci commit network; /etc/init.d/network reload
|
||||||
|
@ -1,7 +1,20 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
if [ -f /etc/banner.default ]; then
|
if [ -f /etc/banner.default ]; then
|
||||||
mv /etc/banner.default /etc/banner
|
mv /etc/banner.default /etc/banner
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
rmdir /usr/share/lua/autowifi/ext/www/cgi-bin
|
||||||
|
rm /usr/share/lua/autowifi/ext/www/admin
|
||||||
|
rmdir /usr/share/lua/autowifi/ext/www
|
||||||
|
rmdir /usr/share/lua/autowifi/admin
|
||||||
|
rmdir /usr/share/lua/autowifi/ext
|
||||||
|
rmdir /usr/share/lua/autowifi/misc
|
||||||
|
rmdir /usr/share/lua/autowifi
|
||||||
|
rmdir /usr/share/lua
|
||||||
|
rm /www/admin
|
||||||
|
rmdir /www/cgi-bin
|
||||||
|
|
||||||
echo "The wifibox banner has been removed. Changes to the root profile however, have"
|
echo "The wifibox banner has been removed. Changes to the root profile however, have"
|
||||||
echo "not been reverted, as haven't the wlan firewall zone and the radio0 device state."
|
echo "not been reverted, as haven't the wlan firewall zone and the radio0 device state."
|
||||||
echo "NOTE: config changes have not been implemented yet."
|
echo "NOTE: config changes have not been implemented yet."
|
3
src/TODO
3
src/TODO
@ -1,7 +1,4 @@
|
|||||||
# TODO
|
# TODO
|
||||||
- finish postinst and prerm/postrm scripts
|
|
||||||
- externalize postinst+prerm scripts by doing something like: 'POSTINST_SCRIPT:=$(shell cat postinst.sh)'?
|
|
||||||
see: http://stackoverflow.com/questions/1435861/computing-makefile-variable-on-assignment
|
|
||||||
- do things right and copy (not link) the init script to init.d
|
- do things right and copy (not link) the init script to init.d
|
||||||
(and enable it automatically, which links to it from rc.d with the proper start priority?)
|
(and enable it automatically, which links to it from rc.d with the proper start priority?)
|
||||||
as sudo does: '[ -n "$$IPKG_INSTROOT" ] || { /etc/init.d/sudo enable}'; and here: https://forum.openwrt.org/viewtopic.php?pid=85197#p85197
|
as sudo does: '[ -n "$$IPKG_INSTROOT" ] || { /etc/init.d/sudo enable}'; and here: https://forum.openwrt.org/viewtopic.php?pid=85197#p85197
|
||||||
|
Loading…
Reference in New Issue
Block a user