Rewrote host environment targets to work out of the box
authorSteven Barth <steven@midlink.org>
Thu, 24 Jul 2008 13:55:11 +0000 (13:55 +0000)
committerSteven Barth <steven@midlink.org>
Thu, 24 Jul 2008 13:55:11 +0000 (13:55 +0000)
25 files changed:
Makefile
build/config.mk
build/hostenv.sh [new file with mode: 0755]
contrib/luadoc/Makefile [new file with mode: 0644]
contrib/luaposix/Makefile
contrib/luasocket/.gitignore [new file with mode: 0644]
contrib/luasocket/Makefile [new file with mode: 0644]
contrib/package/Makefile [new file with mode: 0644]
contrib/uci/.gitignore [new file with mode: 0644]
contrib/uci/Makefile [new file with mode: 0644]
contrib/uci/hostfiles/bin/uci [new file with mode: 0755]
contrib/uci/hostfiles/bin/uci-defaults [new file with mode: 0755]
contrib/uci/hostfiles/etc/config/ddns [new file with mode: 0644]
contrib/uci/hostfiles/etc/config/dhcp [new file with mode: 0644]
contrib/uci/hostfiles/etc/config/dropbear [new file with mode: 0644]
contrib/uci/hostfiles/etc/config/fstab [new file with mode: 0644]
contrib/uci/hostfiles/etc/config/httpd [new file with mode: 0644]
contrib/uci/hostfiles/etc/config/network [new file with mode: 0644]
contrib/uci/hostfiles/etc/config/ntpclient [new file with mode: 0644]
contrib/uci/hostfiles/etc/config/qos [new file with mode: 0644]
contrib/uci/hostfiles/etc/config/system [new file with mode: 0644]
contrib/uci/hostfiles/etc/config/upnpd [new file with mode: 0644]
contrib/uci/hostfiles/etc/config/wireless [new file with mode: 0644]
libs/httpd/host/runluci
libs/sgi-webuci/root/usr/lib/boa/luci.lua

index 8ac0ac664ad48c63df18044b081e194d068b9b43..12c1d89e0966e19e51480b1d2f15a92db16b528d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,6 @@
 include build/config.mk
 
-MODULES = applications/* libs/* modules/* themes/* i18n/* contrib/luaposix
-LUA_TARGET = source
+MODULES = applications/* libs/* modules/* themes/* i18n/* contrib/*
 
 OS:=$(shell uname)
 export OS
@@ -10,7 +9,7 @@ export OS
 
 all: build
 
-build: luabuild gccbuild
+build: gccbuild luabuild
 
 gccbuild:
        for i in $(MODULES); do make -C$$i compile; done        
@@ -31,26 +30,46 @@ luahost: luabuild hostcopy
 hostcopy: 
        mkdir -p host
        for i in $(MODULES); do cp -a $$i/dist/* host/ -R 2>/dev/null || true; done
+       for i in $(MODULES); do cp -a $$i/hostfiles/* host/ -R 2>/dev/null || true; done
        rm -f host/luci
        ln -s .$(LUCI_MODULEDIR) host/luci
 
-runboa: host
-       export LUA_PATH="`pwd`/host$(LUCI_MODULEDIR);;"
-       export LUA_CPATH="`pwd`/host$(LUCI_LIBRARYDIR);;"
-       libs/sgi-webuci/host/buildconfig.sh `pwd`/host  > host/etc/boa/boa.conf
-       ./host/usr/bin/boa -c ./host/etc/boa -d
+hostenv: host ucidefaults
+
+ucidefaults:
+       build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) "$(realpath host)/bin/uci-defaults --exclude luci-community-*"
+
+runboa: hostenv
+       libs/sgi-webuci/host/buildconfig.sh $(realpath host) > host/etc/boa/boa.conf
+       build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) "$(realpath host/usr/bin/boa) -c $(realpath host/etc/boa) -d"
+
+runhttpd: hostenv
+       build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) "$(realpath libs/httpd/host/runluci) $(realpath host) $(HTDOCS)"
 
 runluci: luahost
-       export LUA_PATH="`pwd`/host$(LUCI_MODULEDIR);;"
-       export LUA_CPATH="`pwd`/host$(LUCI_LIBRARYDIR);;"
-       libs/httpd/host/runluci host$(HTDOCS)
+       build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) "$(realpath libs/httpd/host/runluci) $(realpath host) $(HTDOCS)"
+
+runlua: hostenv
+       build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) lua
+
+runshell: hostenv
+       build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) $$SHELL
 
 hostclean: clean
        rm -rf host
 
 run:
-       #       make run is deprecated                  #
-       #       Please use:                             #
-       #                                               #
-       #       make runluci to use LuCI HTTPD          #
-       #       make runboa  to use Boa / Webuci        #
+       #       make run is deprecated                          #
+       #       Please use:                                     #
+       #                                                       #
+       #       To run LuCI WebUI using LuCI HTTPD              #
+       #       make runhttpd                                   #
+       #                                                       #
+       #       To run LuCI WebUI using Boa/Webuci              #
+       #       make runboa                                     #
+       #                                                       #
+       #       To start a shell in the LuCI environment        #
+       #       make runshell                                   #
+       #                                                       #
+       #       To run Lua CLI in the LuCI environment          #
+       #       make runlua                                     #
index 3cf13201f516cebc8b95653ef85ee0d4c58d3f71..5a8f22f89964b2bba303240b33cc15b9985a669e 100644 (file)
@@ -1,5 +1,6 @@
 LUAC = luac
 LUAC_OPTIONS = -s
+LUA_TARGET = source
 
 LUA_MODULEDIR = /usr/lib/lua
 LUA_LIBRARYDIR = /usr/lib/lua
diff --git a/build/hostenv.sh b/build/hostenv.sh
new file mode 100755 (executable)
index 0000000..ee906b0
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+export LD_LIBRARY_PATH="$1/usr/lib:$LD_LIBRARY_PATH"
+export PATH="$1/bin:$1/usr/bin:$PATH"
+export LUA_PATH="$1/$2/?.lua;$1/$2/?/init.lua;;"
+export LUA_CPATH="$1/$3/?.so;;"
+$4
diff --git a/contrib/luadoc/Makefile b/contrib/luadoc/Makefile
new file mode 100644 (file)
index 0000000..81a96f6
--- /dev/null
@@ -0,0 +1,2 @@
+include ../../build/config.mk
+include ../../build/module.mk
\ No newline at end of file
index e9433bf5873fd5f7d848a6c5b5d22509d140c8bc..1d7744ee733ddbb15f7a7d9781dead17e1f4d49a 100644 (file)
@@ -10,6 +10,8 @@ LUAPOSIX_PATCHDIR = patches
 
 all: compile
 
+include ../../build/module.mk
+
 $(LUAPOSIX_FILE):
        wget -O $@ $(LUAPOSIX_URL) || rm -f $@
 
diff --git a/contrib/luasocket/.gitignore b/contrib/luasocket/.gitignore
new file mode 100644 (file)
index 0000000..1a4bd6d
--- /dev/null
@@ -0,0 +1 @@
+luasocket-*
diff --git a/contrib/luasocket/Makefile b/contrib/luasocket/Makefile
new file mode 100644 (file)
index 0000000..2e187e2
--- /dev/null
@@ -0,0 +1,32 @@
+include ../../build/config.mk
+include ../../build/gccconfig.mk
+
+LUASOCKET_VERSION = 2.0.2
+LUASOCKET_SITE = http://luaforge.net/frs/download.php/2664/
+LUASOCKET_DIR = luasocket-$(LUASOCKET_VERSION)
+LUASOCKET_FILE = $(LUASOCKET_DIR).tar.gz
+LUASOCKET_URL = $(LUASOCKET_SITE)/$(LUASOCKET_FILE)
+INSTALL_MODULEDIR = dist$(LUA_MODULEDIR)
+INSTALL_LIBRARYDIR = dist$(LUA_LIBRARYDIR)
+
+all: compile
+
+include ../../build/module.mk
+
+$(LUASOCKET_FILE):
+       wget -O $@ $(LUASOCKET_URL) || rm -f $@
+
+$(LUASOCKET_DIR)/.prepared: $(LUASOCKET_FILE)
+       rm -rf $(LUASOCKET_DIR)
+       tar xvfz $(LUASOCKET_FILE)
+       touch $@
+
+compile: $(LUASOCKET_DIR)/.prepared
+       $(MAKE) -C $(LUASOCKET_DIR) CC=$(CC) CFLAGS="$(CFLAGS) $(LUA_CFLAGS) $(FPIC)" LDFLAGS="$(LDFLAGS) $(LUA_SHLIBS) $(SHLIB_FLAGS)" OS="$(OS)"
+       mkdir -p $(INSTALL_LIBRARYDIR) $(INSTALL_MODULEDIR)
+       $(MAKE) -C $(LUASOCKET_DIR) install INSTALL_TOP_SHARE=../../$(INSTALL_MODULEDIR) INSTALL_TOP_LIB=../../$(INSTALL_LIBRARYDIR)
+
+compile-all: compile
+
+clean:
+       rm -rf $(LUASOCKET_DIR) $(LUASOCKET_FILE)
diff --git a/contrib/package/Makefile b/contrib/package/Makefile
new file mode 100644 (file)
index 0000000..f7fac77
--- /dev/null
@@ -0,0 +1,2 @@
+include ../../build/config.mk
+include ../../build/module.mk
diff --git a/contrib/uci/.gitignore b/contrib/uci/.gitignore
new file mode 100644 (file)
index 0000000..9de6f95
--- /dev/null
@@ -0,0 +1 @@
+uci-*
diff --git a/contrib/uci/Makefile b/contrib/uci/Makefile
new file mode 100644 (file)
index 0000000..d3f8403
--- /dev/null
@@ -0,0 +1,33 @@
+include ../../build/config.mk
+include ../../build/gccconfig.mk
+
+UCI_VERSION = 0.4.4
+UCI_SITE = http://mirror2.openwrt.org/sources
+UCI_DIR = uci-$(UCI_VERSION)
+UCI_FILE = $(UCI_DIR).tar.gz
+UCI_URL = $(UCI_SITE)/$(UCI_FILE)
+
+all: compile
+
+include ../../build/module.mk
+
+$(UCI_FILE):
+       wget -O $@ $(UCI_URL) || rm -f $@
+
+$(UCI_DIR)/.prepared: $(UCI_FILE)
+       rm -rf $(UCI_DIR)
+       tar xvfz $(UCI_FILE)
+       touch $@
+
+compile: $(UCI_DIR)/.prepared
+       $(MAKE) -C $(UCI_DIR) CC=$(CC) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" OS="$(OS)"
+       mkdir -p dist/usr/lib dist/usr/bin
+       $(MAKE) -C $(UCI_DIR) install DESTDIR=../dist prefix=/usr
+       $(MAKE) -C $(UCI_DIR)/lua CC=$(CC) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" OS="$(OS)"
+       $(MAKE) -C $(UCI_DIR)/lua install DESTDIR=../../dist luadir=$(LUA_LIBRARYDIR)
+
+
+compile-all: compile
+
+clean:
+       rm -rf $(UCI_DIR) $(UCI_FILE)
diff --git a/contrib/uci/hostfiles/bin/uci b/contrib/uci/hostfiles/bin/uci
new file mode 100755 (executable)
index 0000000..f6104c6
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+$(dirname $0)/../usr/bin/uci -c $(dirname $0)/../etc/config "$@"
diff --git a/contrib/uci/hostfiles/bin/uci-defaults b/contrib/uci/hostfiles/bin/uci-defaults
new file mode 100755 (executable)
index 0000000..3b58d7b
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+for i in $(find $(dirname $0)/../etc/uci-defaults -type f -not -name "$2")
+do 
+       [ -f $i ] && { 
+               bash $i; rm $i
+       }
+done
diff --git a/contrib/uci/hostfiles/etc/config/ddns b/contrib/uci/hostfiles/etc/config/ddns
new file mode 100644 (file)
index 0000000..7c3f3c1
--- /dev/null
@@ -0,0 +1,85 @@
+#################################################################
+# In order to enable dynamic dns you need at least one section,
+# and in that seciton the "enabled" option must be set to one
+# 
+# Each section represents an update to a different service
+#
+# You specify your domain name, your username and your password
+# with the optins "domain", "username" and "password" respectively
+#
+# Next you need to specify the name of the service you are 
+# connecting to "eg. dyndns.org".  The format of the update
+# urls for several different dynamic dns services is specified
+# in the /usr/lib/ddns/services file.  This list is hardly complete
+# as there are many, many different dynamic dns services.  If your
+# service is on the list you can merely specify it with the 
+# "service_name" option.  Otherwise you will need to determine
+# the format of the url to update with.  You can either add an
+# entry to the /usr/lib/ddns/services file or specify this with
+# the "update_url" option.
+#
+# We also need to specify the source of the ip address to associate with
+# your domain.  The "ip_source" option can be "network", "interface"
+# or "web", with "network" as the default.  
+#
+# If "ip_source" is "network" you specify a network section in your 
+# /etc/network config file (e.g. "wan", which is the default) with
+# the "ip_network" option.  If you specify "wan", you will update
+# with whatever the ip for your wan is.
+# 
+# If "ip_source" is "interface" you specify a hardware interface 
+# (e.g. "eth1") and whatever the current ip of this interface is
+# will be associated with the domain when an update is performed.
+#
+# The last possibility is that "ip_source" is "web", which means
+# that in order to obtain our ip address we will connect to a 
+# website, and the first valid ip address listed on that page
+# will be assumed to be ours.  If you are behind another firewall
+# this is the best option since none of the local networks or 
+# interfaces will have the external ip.  The website to connect
+# to is specified by the "ip_url" option.  You may specify multiple
+# urls in the option, separated by whitespace.
+#
+# Finally we need to specify how often to check whether we need
+# to check whether the ip address has changed (and if so update
+# it) and how often we need to force an update ( many services
+# will expire your domain if you don't connect and do an update
+# every so often).  Use the "check_interval" to specify how
+# often to check whether an update is necessary, and the 
+# "force_interval" option to specify how often to force an
+# update.  Specify the units for these values with the "check_unit"
+# and the "force_unit" options.  Units can be "days", "hours",
+# "minutes" or "seconds".  The default force_unit is hours and the
+# default check_unit is seconds.  The default check_interval is
+# 600 seconds, or ten minutes.  The default force_interval is 
+# 72 hours or 3 days.
+#
+#
+#########################################################
+
+config service "myddns"
+       option enabled          "0"
+
+       option service_name     "dyndns.org"
+       option domain           "mypersonaldomain.dyndns.org"
+       option username         "myusername"
+       option password         "mypassword"
+
+       option ip_source        "network" 
+       option ip_network       "wan"
+       
+
+       option force_interval   "72"
+       option force_unit       "hours"
+       option check_interval   "10"
+       option check_unit       "minutes"
+
+       #option ip_source       "interface"
+       #option ip_interface    "eth0.1"
+
+       #option ip_source       "web"
+       #option ip_url          "http://www.whatismyip.com/automation/n09230945.asp"
+
+       #option update_url      "http://[USERNAME]:[PASSWORD]@members.dyndns.org/nic/update?hostname=[DOMAIN]&myip=[IP]"
+
+
diff --git a/contrib/uci/hostfiles/etc/config/dhcp b/contrib/uci/hostfiles/etc/config/dhcp
new file mode 100644 (file)
index 0000000..4904b02
--- /dev/null
@@ -0,0 +1,23 @@
+config dnsmasq
+       option domainneeded     1
+       option boguspriv        1
+       option filterwin2k      '0'  #enable for dial on demand
+       option localise_queries 1
+       option local    '/lan/'
+       option domain   'lan'
+       option expandhosts      1
+       option nonegcache       0
+       option authoritative    1
+       option readethers       1
+       option leasefile        '/tmp/dhcp.leases'
+       option resolvfile       '/tmp/resolv.conf.auto'
+
+config dhcp
+       option interface        lan
+       option start    100
+       option limit    150
+       option leasetime        12h
+
+config dhcp
+       option interface        wan
+       option ignore   1
diff --git a/contrib/uci/hostfiles/etc/config/dropbear b/contrib/uci/hostfiles/etc/config/dropbear
new file mode 100644 (file)
index 0000000..e660ac7
--- /dev/null
@@ -0,0 +1,3 @@
+config dropbear
+       option PasswordAuth 'on'
+       option Port         '22'
diff --git a/contrib/uci/hostfiles/etc/config/fstab b/contrib/uci/hostfiles/etc/config/fstab
new file mode 100644 (file)
index 0000000..eccf0ce
--- /dev/null
@@ -0,0 +1,10 @@
+config mount
+       option target   /home
+       option device   /dev/sda1
+       option fstype   ext3
+       option options  rw,sync
+       option enabled  0
+
+config swap
+       option device   /dev/sda2
+       option enabled  0
diff --git a/contrib/uci/hostfiles/etc/config/httpd b/contrib/uci/hostfiles/etc/config/httpd
new file mode 100644 (file)
index 0000000..2f8020f
--- /dev/null
@@ -0,0 +1,5 @@
+
+config 'httpd'
+       option 'port' '80'
+       option 'home' '/www'
+
diff --git a/contrib/uci/hostfiles/etc/config/network b/contrib/uci/hostfiles/etc/config/network
new file mode 100644 (file)
index 0000000..1caf3e7
--- /dev/null
@@ -0,0 +1,27 @@
+#### VLAN configuration 
+config switch eth0
+       option vlan0    "0 1 2 3 5*"
+       option vlan1    "4 5"
+
+
+#### Loopback configuration
+config interface loopback
+       option ifname   "lo"
+       option proto    static
+       option ipaddr   127.0.0.1
+       option netmask  255.0.0.0
+
+
+#### LAN configuration
+config interface lan
+       option type     bridge
+       option ifname   "eth0.0"
+       option proto    static
+       option ipaddr   192.168.1.1
+       option netmask  255.255.255.0
+
+
+#### WAN configuration
+config interface       wan
+       option ifname   "eth0.1"
+       option proto    dhcp
diff --git a/contrib/uci/hostfiles/etc/config/ntpclient b/contrib/uci/hostfiles/etc/config/ntpclient
new file mode 100644 (file)
index 0000000..1695113
--- /dev/null
@@ -0,0 +1,22 @@
+config ntpclient
+       option hostname '0.openwrt.pool.ntp.org'
+       option port     '123'
+       option count    '0'
+
+config ntpclient
+       option hostname '1.openwrt.pool.ntp.org'
+       option port     '123'
+       option count    '0'
+
+config ntpclient
+       option hostname '2.openwrt.pool.ntp.org'
+       option port     '123'
+       option count    '0'
+
+config ntpclient
+       option hostname '3.openwrt.pool.ntp.org'
+       option port     '123'
+       option count    '0'
+
+config ntpdrift
+       option freq     '0'
diff --git a/contrib/uci/hostfiles/etc/config/qos b/contrib/uci/hostfiles/etc/config/qos
new file mode 100644 (file)
index 0000000..51959b5
--- /dev/null
@@ -0,0 +1,89 @@
+# QoS configuration for OpenWrt
+
+# INTERFACES:
+config interface wan
+       option classgroup  "Default"
+       option enabled      1
+       option overhead     1
+       option upload       128
+       option download     1024
+
+# RULES:
+config classify
+       option target       "Bulk"
+       option ipp2p        "all"
+config classify
+       option target       "Bulk"
+       option layer7       "edonkey"
+config classify
+       option target       "Bulk"
+       option layer7       "bittorrent"
+config classify
+       option target       "Priority"
+       option ports        "22,53"
+config classify
+       option target       "Normal"
+       option proto        "tcp"
+       option ports        "20,21,25,80,110,443,993,995"
+config classify
+       option target       "Express"
+       option ports        "5190"
+config default
+       option target       "Express"
+       option proto        "udp"
+       option pktsize      "-500"
+config reclassify
+       option target       "Priority"
+       option proto        "icmp"
+config default
+       option target       "Bulk"
+       option portrange    "1024-65535"
+config reclassify
+       option target       "Priority"
+       option proto        "tcp"
+       option pktsize      "-128"
+       option mark         "!Bulk"
+       option tcpflags     "SYN"
+config reclassify
+       option target       "Priority"
+       option proto        "tcp"
+       option pktsize      "-128"
+       option mark             "!Bulk"
+       option tcpflags     "ACK"
+
+
+# Don't change the stuff below unless you
+# really know what it means :)
+
+config classgroup "Default"
+       option classes      "Priority Express Normal Bulk"
+       option default      "Normal"
+
+
+config class "Priority"
+       option packetsize  400
+       option maxsize     400
+       option avgrate     10
+       option priority    20
+config class "Priority_down"
+       option packetsize  1000
+       option avgrate     10
+
+
+config class "Express"
+       option packetsize  1000
+       option maxsize     800
+       option avgrate     50
+       option priority    10
+
+config class "Normal"
+       option packetsize  1500
+       option packetdelay 100
+       option avgrate     10
+       option priority    5
+config class "Normal_down"
+       option avgrate     20
+
+config class "Bulk"
+       option avgrate     1
+       option packetdelay 200
diff --git a/contrib/uci/hostfiles/etc/config/system b/contrib/uci/hostfiles/etc/config/system
new file mode 100644 (file)
index 0000000..b0726b7
--- /dev/null
@@ -0,0 +1,3 @@
+config system
+       option hostname OpenWrt
+       option timezone UTC
diff --git a/contrib/uci/hostfiles/etc/config/upnpd b/contrib/uci/hostfiles/etc/config/upnpd
new file mode 100644 (file)
index 0000000..75dcb9a
--- /dev/null
@@ -0,0 +1,4 @@
+config upnpd config
+       option log_output       0
+       option download         1024
+       option upload           512
diff --git a/contrib/uci/hostfiles/etc/config/wireless b/contrib/uci/hostfiles/etc/config/wireless
new file mode 100644 (file)
index 0000000..4895797
--- /dev/null
@@ -0,0 +1,13 @@
+config wifi-device  wifi0
+       option type     atheros
+       option channel  auto
+
+       # REMOVE THIS LINE TO ENABLE WIFI:
+       option disabled 1
+
+config wifi-iface
+       option device   wifi0
+       option network  lan
+       option mode     ap
+       option ssid     OpenWrt
+       option encryption none
index 1d5812679e8a4c05e19c6c29d0645054124a6d5f..6f6cdde3df033687f9793f28d8bac6071d3ba954 100755 (executable)
@@ -4,19 +4,25 @@ require("luci.httpd.server")
 require("luci.httpd.handler.file")
 require("luci.httpd.handler.luci")
 
-DOCROOT = arg[1]
+SYSROOT = arg[1]
+DOCROOT = SYSROOT .. arg[2]
 PORT = 8080
 
 collectgarbage("setpause", 150)
 
 serversocket = luci.httpd.Socket("0.0.0.0", PORT)
 
-
 server  = luci.httpd.server.Server()
 vhost   = luci.httpd.server.VHost()
 
 server:set_default_vhost(vhost)
 
+if pcall(require, "uci") and pcall(require, "luci.model.uci") then
+       luci.model.uci.confdir_default = SYSROOT .. luci.model.uci.confdir_default
+       luci.model.uci.savedir_state   = SYSROOT .. luci.model.uci.savedir_state
+       luci.model.uci.set_confdir(luci.model.uci.confdir_default)
+end
+
 
 filehandler = luci.httpd.handler.file.Simple(DOCROOT)
 vhost:set_default_handler(filehandler)
index 5c9531a2e6c0e072df39da2514139f2de1b82442..d0f4323c348b01bd8ef3c4d8115c30f8e2d92a08 100644 (file)
@@ -20,12 +20,13 @@ function init(path)
 
        require("luci.dispatcher")
        require("luci.sgi.webuci")
-       require("uci")
+       require("luci.model.uci")
 
        if (root ~= '/') then
                -- Entering dummy mode
-               uci.set_savedir(root..'/tmp/.uci')
-               uci.set_confdir(root..'/etc/config')
+               luci.model.uci.confdir_default = root .. '/etc/config'
+               luci.model.uci.savedir_state   = root .. '/var/state'
+               uci.set_confdir(luci.model.uci.confdir_default)
                
                luci.sys.hostname = function() return "" end
                luci.sys.loadavg  = function() return 0,0,0,0,0 end
@@ -35,12 +36,11 @@ function init(path)
                
                luci.sys.net.arptable           = function() return {} end
                luci.sys.net.devices            = function() return {} end
-               luci.sys.net.routes                     = function() return {} end
+               luci.sys.net.routes             = function() return {} end
                luci.sys.wifi.getiwconfig       = function() return {} end
                luci.sys.wifi.iwscan            = function() return {} end
                
                luci.sys.user.checkpasswd   = function() return true end
-               luci.http.basic_auth = function() return true end
        end
 end