From 23eb877a3fefa50fc7206042805071f297c8d83f Mon Sep 17 00:00:00 2001 From: YourFritz Date: Sat, 18 Aug 2018 14:33:01 +0200 Subject: [PATCH] gui_bootmanager: add a 'sed' based patch method with less dependencies --- bootmanager/change_system_reboot_lua.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 bootmanager/change_system_reboot_lua.sh diff --git a/bootmanager/change_system_reboot_lua.sh b/bootmanager/change_system_reboot_lua.sh new file mode 100644 index 00000000..b18dba01 --- /dev/null +++ b/bootmanager/change_system_reboot_lua.sh @@ -0,0 +1,20 @@ +#! /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 savecookie/a\\ +if box.post.linux_fs_start then\\ +local linux_fs_start = string.gsub(box.post.linux_fs_start, \"'\", \"\")\\ +local branding = string.gsub(box.post[linux_fs_start..\"_branding\"], \"'\", \"\")\\ +os.execute(\"/usr/bin/gui_bootmanager switch_to '\"..linux_fs_start..\"' '\"..branding..\"'\")\\ +end +/^
\\ +\\ + +" -i "$1"