0
0
mirror of https://github.com/Doodle3D/doodle3d-firmware.git synced 2024-12-22 02:53:49 +01:00

Finish post-install/pre-remove package scripts (not yet used/included by Makefile).

This commit is contained in:
Wouter R 2013-05-14 11:34:55 +02:00
parent 21e5ddb51b
commit 9789fdc0c3
4 changed files with 59 additions and 25 deletions

30
add-fw-net.sh Executable file
View File

@ -0,0 +1,30 @@
#!/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

23
post-install.sh Normal file → Executable file
View File

@ -1,24 +1,20 @@
########### NOTE: add an extra '$' in front of all existing ones when copying into Makefile (and remove this line...)
#!/bin/sh
##############
# MAIN CODE #
############
if [ ! -f /etc/banner.default ]; then
mv /etc/banner /etc/banner.default
cat <<-'EOM' > /etc/banner
........D o o d l e 3 D
.......________ _____ _____ v $(PACKAGE_VERSION)
....../ / / |__ / __/ / - /___ __
...../ / / /--// _|-// - | . /- /
..../________/__//__/__//____/___/_-_\
...../ / / /--// _|-// --| . /v /
..../________/__//__/__//____/___/_^_\\
...
..A cad in a box.
.
EOM
fi
grep '^# DO NOT MODIFY.*wifibox package.$' /root/.profile >/dev/null 2>&1
if [ $? -eq 1 ]; then
cat <<-EOM >> /root/.profile
@ -29,5 +25,10 @@ if [ $? -eq 1 ]; then
EOM
fi
#3. make sure the radio0 interface is enabled in /etc/config/wireless (preferably through uci)
#4. make sure the wlan net is in the lan zone in /etc/config/dnsmasq (and make sure wlan net exists?)
@echo "Enabling wifi device..."
uci set wireless.@wifi-device[0].disabled=0; uci commit wireless; wifi
./add-fw-net.sh
@echo "Adding network interface 'wlan'..."
uci set network.wlan=interface; uci commit network; /etc/init.d/network reload

13
pre-remove.sh Normal file → Executable file
View File

@ -1,8 +1,7 @@
#!/bin/sh
#if [ -f /etc/banner.default ]; then
# mv /etc/banner.default /etc/banner
#fi
# emit message stating that /root/.profile is not changed back and
# neither are wlan zone and radio0 enabled state
if [ -f /etc/banner.default ]; then
mv /etc/banner.default /etc/banner
fi
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 "NOTE: config changes have not been implemented yet."

View File

@ -1,15 +1,19 @@
# TODO
- finish postinst and prerm/postrm scripts
- preliminary test with postinst does not seem to work (i.e. touch a file in the device root does not result in a file being there)
- 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
(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
- add more config options to package; candidates:
reconf.WWW_RENAME_NAME, wifihelper.{AP_ADDRESS, AP_NETMASK, (NET)}
about bridging this to lua: have some Makefile stage create a ini/lua file with k/v's and have lua read out that file?
- write a shellscript to automate tasks like swapping out /www and packaging modified code for git merging
- 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?)
- add dependency on either wr703n or mr3020 (and probably comment it out to avoid being to conservative...)
- add/link general OpenWrt build instructions for OSX to installation page on wiki.
- see if updating works when a new version is 'released' (probably needs a real feed)
- add config option to compile sources using luac?
- add/link general OpenWrt build instructions for OSX to installation page on wiki.
- remove usr/share/lua/autowifi and subdirectories (if empty) in postrm
# TODO for autowifi.js
@ -43,12 +47,12 @@ Check http://geon.github.io/Programming/2012/04/25/ascii-art-signatures-in-the-w
....D o o d l e 3 D
...________ _____ _____ v 1.0.1
../ / / |__ / __/ / - /___ __
./ ' ' /--// _|-// - | . /- /
/________/__//__/__//____/___/_-_\
./ ' ' /--// _|-// --| . /v /
/________/__//__/__//____/___/_^_\
# Shelled bugs/annoyances
# Shelled bugs/annoyances (all except the lua errors have been filed)
+ scripts are only allowed to be created in src folder? (nothing else shown, root greys out 'Finish')
+ text inside heredoc is highlighted
+ only one space allowed at start of line...makes it impossible to draw ascii art