Fix post-install script for 'Y' inlusion in openwrt images; fix small bug in request.lua.

This commit is contained in:
Wouter R 2013-08-01 16:29:17 +02:00
parent eddb7f7d0d
commit b971be33d1
3 changed files with 24 additions and 16 deletions

View File

@ -34,11 +34,11 @@ addFirewallNet() {
### Replace the banner with a custom one ### Replace the banner with a custom one
if [ ! -f /etc/banner.default ]; then if [ ! -f $IPKG_INSTROOT/etc/banner.default ]; then
mv /etc/banner /etc/banner.default mv $IPKG_INSTROOT/etc/banner $IPKG_INSTROOT/etc/banner.default
cat <<-'EOM' > /etc/banner cat <<-'EOM' > $IPKG_INSTROOT/etc/banner
........D o o d l e 3 D ........D o o d l e 3 D
.......________ _____ _____ v $(PACKAGE_VERSION) .......________ _____ _____ v \$(PACKAGE_VERSION)
....../ / / |__ / __/ / - /___ __ ....../ / / |__ / __/ / - /___ __
...../ / / /--// _|-// --| . /v / ...../ / / /--// _|-// --| . /v /
..../________/__//__/__//____/___/_^_\ ..../________/__//__/__//____/___/_^_\
@ -48,14 +48,11 @@ if [ ! -f /etc/banner.default ]; then
EOM EOM
fi fi
### Add some convenience functionality to root's profile ### Add some convenience aliases to root's profile
ROOT_PROFILE=/root/.profile mkdir $IPKG_INSTROOT/root
if [ ! -f $ROOT_PROFILE ]; then grep '^# DO NOT MODIFY.*wifibox package.$' $IPKG_INSTROOT/root/.profile >/dev/null 2>&1
touch $ROOT_PROFILE if [ $? -gt 0 ]; then
fi cat <<-EOM >> $IPKG_INSTROOT/root/.profile
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. # DO NOT MODIFY - this block of lines has been added by the wifibox package.
alias d3dapi='/usr/share/lua/wifibox/script/d3dapi' alias d3dapi='/usr/share/lua/wifibox/script/d3dapi'
@ -76,10 +73,20 @@ if [ -z "$IPKG_INSTROOT" ]; then
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
/etc/init.d/wifibox enable /etc/init.d/wifibox enable
else else
ADDR_LINE=`cat $IPKG_INSTROOT/etc/config/network | grep ipaddr` # Create a script to setup the system as wifibox, it will be deleted after it has been run, except if it returns > 0
echo "WARNING: WiFiBox network configuration can only be prepared when installing on real device" cat <<-EOM >> $IPKG_INSTROOT/etc/uci-defaults/setup-wifibox.sh
echo "network config address line:" uci set system.@system[0].hostname=wifibox
uci set network.lan.ipaddr=192.168.5.1
echo -e "beta\nbeta" | passwd root
uci set wireless.@wifi-device[0].disabled=0
# TODO: add firewall net
uci set network.wlan=interface
EOM
echo "WARNING: WiFiBox network configuration can only be fully prepared when installing on real device"
fi fi
exit 0 exit 0

View File

@ -213,6 +213,7 @@ function M.print_POST(request, response)
response:addData('msg', msg) response:addData('msg', msg)
return return
else else
--NOTE: this does not report the number of lines, but only the block which has just been added
response:addData('gcode_append',argGcode:len()) response:addData('gcode_append',argGcode:len())
end end

View File

@ -200,7 +200,7 @@ function M.new(postData, debugEnabled)
-- Perform module/function resolution -- Perform module/function resolution
local rData = resolveApiFunction(self:getRequestedApiModule(), self:getRequestedApiFunction(), self.requestMethod) local rData = resolveApiFunction(self:getRequestedApiModule(), self:getRequestedApiFunction(), self.requestMethod)
local modFuncInfo = self:getRequestedApiModule() or "<>" .. "/" .. self:getRequestedApiFunction() or "<>" local modFuncInfo = (self:getRequestedApiModule() or "<>") .. "/" .. (self:getRequestedApiFunction() or "<>")
if rData.func ~= nil then --function (possibly the global one) could be resolved if rData.func ~= nil then --function (possibly the global one) could be resolved
self.resolvedApiFunction = rData.func self.resolvedApiFunction = rData.func