From 1940283948acad2081249eaaa5ebb663998de9ad Mon Sep 17 00:00:00 2001 From: John Crispin Date: Thu, 25 Apr 2013 19:02:32 +0000 Subject: mount_root: prepare base-files Signed-off-by: John Crispin git-svn-id: svn://svn.openwrt.org/openwrt/trunk@36429 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/base-files/files/lib/preinit/05_mount_skip | 13 ----------- .../base-files/files/lib/preinit/10_check_for_mtd | 20 ----------------- .../files/lib/preinit/20_check_jffs2_ready | 19 ---------------- .../base-files/files/lib/preinit/40_mount_jffs2 | 26 ---------------------- .../files/lib/preinit/41_merge_overlay_hooks | 24 -------------------- .../files/lib/preinit/70_pivot_jffs2_root | 14 ------------ package/base-files/files/lib/preinit/80_mount_root | 11 ++++++++- .../base-files/files/lib/preinit/90_mount_no_jffs2 | 12 ---------- .../base-files/files/lib/preinit/90_restore_config | 17 -------------- .../files/lib/preinit/99_10_mount_no_mtd | 12 ---------- 10 files changed, 10 insertions(+), 158 deletions(-) delete mode 100644 package/base-files/files/lib/preinit/05_mount_skip delete mode 100644 package/base-files/files/lib/preinit/10_check_for_mtd delete mode 100644 package/base-files/files/lib/preinit/20_check_jffs2_ready delete mode 100644 package/base-files/files/lib/preinit/40_mount_jffs2 delete mode 100644 package/base-files/files/lib/preinit/41_merge_overlay_hooks delete mode 100644 package/base-files/files/lib/preinit/70_pivot_jffs2_root delete mode 100644 package/base-files/files/lib/preinit/90_mount_no_jffs2 delete mode 100644 package/base-files/files/lib/preinit/90_restore_config delete mode 100644 package/base-files/files/lib/preinit/99_10_mount_no_mtd (limited to 'package/base-files/files/lib/preinit') diff --git a/package/base-files/files/lib/preinit/05_mount_skip b/package/base-files/files/lib/preinit/05_mount_skip deleted file mode 100644 index c2b7ee79d6..0000000000 --- a/package/base-files/files/lib/preinit/05_mount_skip +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -# Copyright (C) 2006 OpenWrt.org -# Copyright (C) 2010 Vertical Communications - -check_skip() { - if [ "$pi_mount_skip_next" = "true" ]; then - return 0 - else - return 1 - fi -} - diff --git a/package/base-files/files/lib/preinit/10_check_for_mtd b/package/base-files/files/lib/preinit/10_check_for_mtd deleted file mode 100644 index 6a7bd307f8..0000000000 --- a/package/base-files/files/lib/preinit/10_check_for_mtd +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -# Copyright (C) 2006-2010 OpenWrt.org -# Copyright (C) 2010 Vertical Communications - -mount_no_mtd() { - mtd unlock rootfs - mount -o noatime,remount,rw /dev/root / -} - -check_for_mtd() { - check_skip || { - grep -qs rootfs_data /proc/mtd || { - mount_no_mtd && pi_mount_skip_next=true - } - } -} - -boot_hook_add preinit_mount_root check_for_mtd - diff --git a/package/base-files/files/lib/preinit/20_check_jffs2_ready b/package/base-files/files/lib/preinit/20_check_jffs2_ready deleted file mode 100644 index 3c5cf67e8d..0000000000 --- a/package/base-files/files/lib/preinit/20_check_jffs2_ready +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -# Copyright (C) 2006-2010 OpenWrt.org -# Copyright (C) 2010 Vertical Communications - -mount_no_jffs2() { - echo "jffs2 not ready yet; using ramdisk" - ramoverlay -} - -check_for_jffs2() { - check_skip || { - jffs2_ready || { - mount_no_jffs2 && pi_mount_skip_next=true - } - } -} - -boot_hook_add preinit_mount_root check_for_jffs2 - diff --git a/package/base-files/files/lib/preinit/40_mount_jffs2 b/package/base-files/files/lib/preinit/40_mount_jffs2 deleted file mode 100644 index ded785ed58..0000000000 --- a/package/base-files/files/lib/preinit/40_mount_jffs2 +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -# Copyright (C) 2006-2010 OpenWrt.org -# Copyright (C) 2010 Vertical Communications - -find_mount_jffs2() { - mkdir -p /tmp/overlay - mount -o noatime -t jffs2 "$(find_mtd_part rootfs_data)" /tmp/overlay - mtd -qq unlock rootfs_data -} - -jffs2_not_mounted() { - if [ "$pi_jffs2_mount_success" != "true" ]; then - return 0 - else - return 1 - fi -} - -do_mount_jffs2() { - check_skip || { - find_mount_jffs2 && pi_jffs2_mount_success=true - } -} - -boot_hook_add preinit_mount_root do_mount_jffs2 - diff --git a/package/base-files/files/lib/preinit/41_merge_overlay_hooks b/package/base-files/files/lib/preinit/41_merge_overlay_hooks deleted file mode 100644 index 4ca6877bea..0000000000 --- a/package/base-files/files/lib/preinit/41_merge_overlay_hooks +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright (C) 2010 OpenWrt.org - -merge_overlay_hooks() { - jffs2_not_mounted || [ ! -d /tmp/overlay/lib/preinit ] || { - echo "- merge overlay components -" - - mkdir -p /tmp/preinit-hook-merge - ln -sf /lib/preinit/* /tmp/overlay/lib/preinit/[0-9][0-9]_* /tmp/preinit-hook-merge/ - - boot_hook_splice_start - - local pipart - for pipart in /tmp/preinit-hook-merge/*; do - . $pipart - done - - boot_hook_splice_finish - - rm -rf /tmp/preinit-hook-merge - } -} - -boot_hook_add preinit_mount_root merge_overlay_hooks diff --git a/package/base-files/files/lib/preinit/70_pivot_jffs2_root b/package/base-files/files/lib/preinit/70_pivot_jffs2_root deleted file mode 100644 index b76f111ca3..0000000000 --- a/package/base-files/files/lib/preinit/70_pivot_jffs2_root +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -# Copyright (C) 2006-2010 OpenWrt.org -# Copyright (C) 2010 Vertical Communications - -rootfs_pivot() { - check_skip || jffs2_not_mounted || { - echo "switching to jffs2" - mount -o noatime,move /tmp/overlay /overlay 2>&- - fopivot /overlay /rom && pi_mount_skip_next=true - } -} - -boot_hook_add preinit_mount_root rootfs_pivot - diff --git a/package/base-files/files/lib/preinit/80_mount_root b/package/base-files/files/lib/preinit/80_mount_root index 9a99ee9109..0292d82d4a 100644 --- a/package/base-files/files/lib/preinit/80_mount_root +++ b/package/base-files/files/lib/preinit/80_mount_root @@ -3,7 +3,16 @@ # Copyright (C) 2010 Vertical Communications do_mount_root() { - boot_run_hook preinit_mount_root + mount_root + boot_run_hook preinit_mount_root + [ -f /sysupgrade.tgz ] && { + echo "- config restore -" + cd / + mv sysupgrade.tgz /tmp + tar xzf /tmp/sysupgrade.tgz + rm -f /tmp/sysupgrade.tgz + sync + } } [ "$INITRAMFS" = "1" ] || boot_hook_add preinit_main do_mount_root diff --git a/package/base-files/files/lib/preinit/90_mount_no_jffs2 b/package/base-files/files/lib/preinit/90_mount_no_jffs2 deleted file mode 100644 index d8ad4ae119..0000000000 --- a/package/base-files/files/lib/preinit/90_mount_no_jffs2 +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -# Copyright (C) 2006-2010 OpenWrt.org -# Copyright (C) 2010 Vertical Communications - -do_mount_no_jffs2() { - check_skip || { - mount_no_jffs2 && pi_mount_skip_next=true - } -} - -boot_hook_add preinit_mount_root do_mount_no_jffs2 - diff --git a/package/base-files/files/lib/preinit/90_restore_config b/package/base-files/files/lib/preinit/90_restore_config deleted file mode 100644 index 210bf61847..0000000000 --- a/package/base-files/files/lib/preinit/90_restore_config +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -# Copyright (C) 2006 OpenWrt.org -# Copyright (C) 2010 Vertical Communications - -restore_config() { - [ -f /sysupgrade.tgz ] && { - echo "- config restore -" - cd / - mv sysupgrade.tgz /tmp - tar xzf /tmp/sysupgrade.tgz - rm -f /tmp/sysupgrade.tgz - sync - } -} - -boot_hook_add preinit_main restore_config - diff --git a/package/base-files/files/lib/preinit/99_10_mount_no_mtd b/package/base-files/files/lib/preinit/99_10_mount_no_mtd deleted file mode 100644 index c4f38e415b..0000000000 --- a/package/base-files/files/lib/preinit/99_10_mount_no_mtd +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -# Copyright (C) 2006-2010 OpenWrt.org -# Copyright (C) 2010 Vertical Communications - -do_mount_no_mtd() { - check_skip || { - mount_no_mtd - } -} - -boot_hook_add preinit_mount_root do_mount_no_mtd - -- cgit v1.2.3