changeset 182:0e2536a0af73

reset to default TEMP workaround
author ray@terran.dlink.ua
date Thu, 07 Jul 2011 17:52:18 +0300
parents 64c745b681a3
children 0b8aef9f486e
files profiles/dlink.ua.web/files/etc/www/devd.lua
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/profiles/dlink.ua.web/files/etc/www/devd.lua	Wed Jul 06 12:31:54 2011 +0300
+++ b/profiles/dlink.ua.web/files/etc/www/devd.lua	Thu Jul 07 17:52:18 2011 +0300
@@ -93,8 +93,15 @@
 		    time = tonumber(m.period);
 		    -- if hold time between 10 and 15 sec, call httpd to reset to default
 		    -- XXX better to send event to httpd, then httpd will decide what to do
+		    -- XXX2 but if httpd have wrong config, then he can't start
 		    if 10 < time and time < 15 then
-			call_server(config, "restore=config");
+			-- XXX: always do restore config here, because wrong config break httpd yet
+			-- if call_server(config, "restore=config") == false then
+			    -- If we can't get success from httpd, then we restore default manualy
+			    os.execute("mv /tmp/etc/www/config.xml /tmp/etc/www/config.xml.bak");
+			    os.execute("/etc/save_etc");
+			    os.execute("reboot");
+			-- end
 			os.execute("echo \"devd.lua: User request Reset to Default\" > /dev/console");
 		    end
 		elseif m.type == "PIN_HIGH" then