From 1cf4d41cbaaaedc5ca35fc9620e44fbf43cf2013 Mon Sep 17 00:00:00 2001
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Mon, 13 Jan 2014 20:16:43 +0100
Subject: [PATCH] gluon-config-mode: use different document root

---
 .../files/etc/init.d/gluon-config-mode                 |  5 +++--
 .../files/lib/gluon/config-mode/www/cgi-bin/luci       |  5 +++++
 .../files/lib/gluon/config-mode/www/index.html         | 10 ++++++++++
 .../files/lib/gluon/config-mode/www/luci-static        |  1 +
 4 files changed, 19 insertions(+), 2 deletions(-)
 create mode 100755 package/gluon-config-mode/files/lib/gluon/config-mode/www/cgi-bin/luci
 create mode 100644 package/gluon-config-mode/files/lib/gluon/config-mode/www/index.html
 create mode 120000 package/gluon-config-mode/files/lib/gluon/config-mode/www/luci-static

diff --git a/package/gluon-config-mode/files/etc/init.d/gluon-config-mode b/package/gluon-config-mode/files/etc/init.d/gluon-config-mode
index 2ee6af935..2af5e9539 100755
--- a/package/gluon-config-mode/files/etc/init.d/gluon-config-mode
+++ b/package/gluon-config-mode/files/etc/init.d/gluon-config-mode
@@ -33,9 +33,10 @@ start() {
 		ip link set up dev $config_mode_iface
 
 		/usr/sbin/telnetd -l /lib/gluon/config-mode/ash-login
-
 		/etc/init.d/dropbear start
-		/etc/init.d/uhttpd start
+
+		/usr/sbin/uhttpd -h /lib/gluon/config-mode/www -x /cgi-bin -A 1 -R -p 0.0.0.0:80
+
 		/etc/init.d/led start
 
 		# correctly finish firstboot
diff --git a/package/gluon-config-mode/files/lib/gluon/config-mode/www/cgi-bin/luci b/package/gluon-config-mode/files/lib/gluon/config-mode/www/cgi-bin/luci
new file mode 100755
index 000000000..c5c984734
--- /dev/null
+++ b/package/gluon-config-mode/files/lib/gluon/config-mode/www/cgi-bin/luci
@@ -0,0 +1,5 @@
+#!/usr/bin/lua
+require "luci.cacheloader"
+require "luci.sgi.cgi"
+luci.dispatcher.indexcache = "/tmp/luci-indexcache"
+luci.sgi.cgi.run()
diff --git a/package/gluon-config-mode/files/lib/gluon/config-mode/www/index.html b/package/gluon-config-mode/files/lib/gluon/config-mode/www/index.html
new file mode 100644
index 000000000..0a7238b55
--- /dev/null
+++ b/package/gluon-config-mode/files/lib/gluon/config-mode/www/index.html
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="refresh" content="0; URL=/cgi-bin/luci" />
+</head>
+<body style="background-color: black">
+<a style="color: white; text-decoration: none" href="/cgi-bin/luci">LuCI - Lua Configuration Interface</a>
+</body>
+</html>
diff --git a/package/gluon-config-mode/files/lib/gluon/config-mode/www/luci-static b/package/gluon-config-mode/files/lib/gluon/config-mode/www/luci-static
new file mode 120000
index 000000000..aea80e059
--- /dev/null
+++ b/package/gluon-config-mode/files/lib/gluon/config-mode/www/luci-static
@@ -0,0 +1 @@
+/www/luci-static
\ No newline at end of file
-- 
GitLab