diff --git a/.project b/.project index 85a135d..7c6d11c 100644 --- a/.project +++ b/.project @@ -13,5 +13,6 @@ org.eclipse.koneki.ldt.nature + net.sourceforge.shelled.core.nature diff --git a/Config.in b/Config.in index 602f4b1..8867b8f 100644 --- a/Config.in +++ b/Config.in @@ -7,6 +7,31 @@ bool "Enable development aids" default n help - Enable development features (currently a script to copy and zip all relevant code for updating the git repository). + Enable development features (currently a script to copy and zip all relevant + code for updating the git repository, and two shell aliases for convenience, + see /root/.profile). + + config WIFIBOX_AP_SSID + depends on PACKAGE_wifibox + string "AP mode SSID" + default "d3d-ap" + help + The SSID the device will use when switching into access point mode. + Note: the Lua scripts do not actually use this yet. + + config WIFIBOX_INIT_PRIORITY + depends on PACKAGE_wifibox + int "Init-script priority" + default "18" + help + The priority given to the auto-wifi init-script. + + config WIFIBOX_WIRELESS_DEVICE + depends on PACKAGE_wifibox + string "Physical wireless device name" + default "radio0" + help + The wireless device name used in the UCI wireless configuration ('radio0' + on the supported TP-Link devices with a recent OpenWRT version). #endmenu diff --git a/Makefile b/Makefile index 336fbaf..81939d9 100644 --- a/Makefile +++ b/Makefile @@ -100,5 +100,10 @@ endif $(LN) -s /usr/share/lua/autowifi/ext/autowifi_init $(1)/etc/rc.d/S18autowifi_init endef +define Package/wifibox/postinst + #!/bin/sh + touch /.postinst-was-here +endef + $(eval $(call BuildPackage,wifibox)) diff --git a/post-install.sh b/post-install.sh new file mode 100644 index 0000000..958a009 --- /dev/null +++ b/post-install.sh @@ -0,0 +1,33 @@ +#!/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) + ....../ / / |__ / __/ / - /___ __ + ...../ / / /--// _|-// - | . /- / + ..../________/__//__/__//____/___/_-_\ + ... + ..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 + + # DO NOT MODIFY - this block of lines has been added by the wifibox package. + alias wfcfr='/usr/share/lua/autowifi/ext/wfcf' + alias encore='ulimit -c unlimited' +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?) diff --git a/pre-remove.sh b/pre-remove.sh new file mode 100644 index 0000000..9364cf3 --- /dev/null +++ b/pre-remove.sh @@ -0,0 +1,8 @@ +#!/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 diff --git a/src/TODO b/src/TODO index e23b0ff..5078261 100644 --- a/src/TODO +++ b/src/TODO @@ -1,6 +1,56 @@ -- write a shellscript to automate tasks like swapping out /www and packaging modified code for git merging +# 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) +- 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) + + +# TODO for autowifi.js +- escape text where necessary (e.g. in getKnown, '' is currently interpreted as html...) +- why is $.trim() required in string comparison? do we need to strip newlines in the parse functions? +- add hidden field in html to remember encryption (so we know whether or not a passphrase should be entered) +- instead of showing alerts on missing ssid/phrase in connect, disable the button until contraints have been satisfied + (this is also cleaner in case no networks are present) +- use json for communication? + + +# Logos + +Check http://geon.github.io/Programming/2012/04/25/ascii-art-signatures-in-the-wild/ for inspiration + + + D o o d l e 3 D + -------- ____ .--- v 1.0.1 +| | | | __ | __|.--.| ._| .---..-.-. +| | | ||--|| _| |--|| . || . |\ / +|________||__||__| |__||____||___|/_._\ + + + D o o d l e 3 D + -------- ____ .---- v 1.0.1 +| | | |--.| __|-.| ._|---.-.-. +| | | |--|| _|--|| . | . |_ _/ +|________|__||__||__||____|___|_._\ + + +....D o o d l e 3 D +...________ _____ _____ v 1.0.1 +../ / / |__ / __/ / - /___ __ +./ ' ' /--// _|-// - | . /- / +/________/__//__/__//____/___/_-_\ + + + +# Shelled bugs/annoyances ++ 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 + plus: I think it breaks my spaces/tabs occasionally but that could have been something else +- errors after creating new script file (mentioning lua...maybe a conflict?) diff --git a/src/ext/autowifi.js b/src/ext/autowifi.js index 9ad0937..c04f072 100644 --- a/src/ext/autowifi.js +++ b/src/ext/autowifi.js @@ -1,17 +1,3 @@ -/* - * TODO - * - finish network creation - * - finish auto operation - * - call auto op from init script - * - in AP mode, route all addresses to the autowifi page - * - escape text where necessary (e.g. in getKnown, '' is currently interpreted as html...) - * - why is $.trim() required in string comparison? do we need to strip newlines in the parse functions? - * - add hidden field to remember encryption (so we know whether or not a passphrase should be entered) - * - instead of showing alerts on missing ssid/phrase in connect, disable the button until contraints have been satisfied - * (this is also cleaner in case no networks are present) - * - use json for communication - */ - animSpeed = 200; cgiPath = "asdasd/cgi-bin/wfcf";