From ad473e4fa39c98e26be31ebe85bfff821f2c3b1c Mon Sep 17 00:00:00 2001 From: Ycarus Date: Mon, 16 Apr 2018 20:58:18 +0200 Subject: [PATCH] Should fix upgrade from LuCI for x86_64 --- .../files/lib/preinit/80_mount_root | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 root/package/base-files/files/lib/preinit/80_mount_root diff --git a/root/package/base-files/files/lib/preinit/80_mount_root b/root/package/base-files/files/lib/preinit/80_mount_root new file mode 100644 index 00000000..9c3f86ec --- /dev/null +++ b/root/package/base-files/files/lib/preinit/80_mount_root @@ -0,0 +1,21 @@ +#!/bin/sh +# Copyright (C) 2006 OpenWrt.org +# Copyright (C) 2010 Vertical Communications +# Copyright (C) 2018 Ycarus (Yannick Chabanois) + +do_mount_root() { + mount_root + boot_run_hook preinit_mount_root + [ -e /dev/sda1 ] && mount /dev/sda1 /boot + [ -f /boot/sysupgrade.tgz ] && { + mv /boot/sysupgrade.tgz / + } + [ -e /dev/sda1 ] && umount /boot + [ -f /sysupgrade.tgz ] && { + echo "- config restore -" + cd / + tar xzf sysupgrade.tgz + } +} + +[ "$INITRAMFS" = "1" ] || boot_hook_add preinit_main do_mount_root