Permalink
Browse files

gui_bootmanager: change integration into reboot.lua

  • Loading branch information...
PeterPawn committed Feb 4, 2019
1 parent 01342cc commit 6994b298757ddb309b8a093f8ac9e50d7fe2292e
Showing with 51 additions and 0 deletions.
  1. +24 −0 bootmanager/change_system_reboot_0708.sh
  2. +27 −0 bootmanager/patch_system_reboot_0708.patch
@@ -0,0 +1,24 @@
#! /bin/sh
[ -z "$1" ] && printf "Missing name of file as parameter, the file will be changed in place.\n" 1>&2 && exit 1
! [ -f "$1" ] && printf "File '%s' not found.\n" "$1" 1>&2 && exit 1
sed -e "
/^local function on_load()/i\\
local function data_bootmanager()\\
local values = {}\\
local pipe = io.popen(\"/usr/bin/gui_bootmanager get_values\")\\
local line\\
for line in pipe:lines() do\\
table.insert(values, { name = line:match(\"^([^=]-)=\"), value = line:match(\"^.-=(.*)\") } )\\
end\\
pipe:close()\\
return values\\
end
/^data.actions = data_actions()/a\\
data.bootmanager = data_bootmanager()
/^local savecookie/a\\
if box.post.linux_fs_start then\\
local linux_fs_start = string.gsub(box.post.linux_fs_start, \"'\", \"\")\\
local branding = box.post[linux_fs_start..\"_branding\"] ~= nil and string.gsub(box.post[linux_fs_start..\"_branding\"], \"'\", \"\") or \"\"\\
os.execute(\"/usr/bin/gui_bootmanager switch_to '\"..linux_fs_start..\"' '\"..branding..\"'\")\\
end
" -i "$1"
@@ -0,0 +1,27 @@
--- usr/www/$TARGET_BRANDING/system/reboot.lua
+++ usr/www/$TARGET_BRANDING/system/reboot.lua
@@ -66,2 +66,12 @@
--
+local function data_bootmanager()
+local values = {}
+local pipe = io.popen("/usr/bin/gui_bootmanager get_values")
+local line
+for line in pipe:lines() do
+table.insert(values, { name = line:match("^([^=]-)="), value = line:match("^.-=(.*)") } )
+end
+pipe:close()
+return values
+end
local function on_load()
@@ -71,2 +81,3 @@
data.actions = data_actions()
+data.bootmanager = data_bootmanager()
return data
@@ -75,2 +86,7 @@
local savecookie = {}
+if box.post.linux_fs_start then
+local linux_fs_start = string.gsub(box.post.linux_fs_start, "'", "")
+local branding = box.post[linux_fs_start.."_branding"] ~= nil and string.gsub(box.post[linux_fs_start.."_branding"], "'", "") or ""
+os.execute("/usr/bin/gui_bootmanager switch_to '"..linux_fs_start.."' '"..branding.."'")
+end
webuicookie.set_action_allowed_time()

0 comments on commit 6994b29

Please sign in to comment.