From b5367474cba180d7b2555e4e30421a7340f63264 Mon Sep 17 00:00:00 2001 From: blogic 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 --- .../base-files/files.old/lib/preinit/05_mount_skip | 13 +++++++++++ .../files.old/lib/preinit/10_check_for_mtd | 20 +++++++++++++++++ .../files.old/lib/preinit/20_check_jffs2_ready | 19 ++++++++++++++++ .../files.old/lib/preinit/40_mount_jffs2 | 26 ++++++++++++++++++++++ .../files.old/lib/preinit/41_merge_overlay_hooks | 24 ++++++++++++++++++++ .../files.old/lib/preinit/70_pivot_jffs2_root | 14 ++++++++++++ .../files.old/lib/preinit/90_mount_no_jffs2 | 12 ++++++++++ .../files.old/lib/preinit/90_restore_config | 17 ++++++++++++++ .../files.old/lib/preinit/99_10_mount_no_mtd | 12 ++++++++++ 9 files changed, 157 insertions(+) create mode 100644 package/base-files/files.old/lib/preinit/05_mount_skip create mode 100644 package/base-files/files.old/lib/preinit/10_check_for_mtd create mode 100644 package/base-files/files.old/lib/preinit/20_check_jffs2_ready create mode 100644 package/base-files/files.old/lib/preinit/40_mount_jffs2 create mode 100644 package/base-files/files.old/lib/preinit/41_merge_overlay_hooks create mode 100644 package/base-files/files.old/lib/preinit/70_pivot_jffs2_root create mode 100644 package/base-files/files.old/lib/preinit/90_mount_no_jffs2 create mode 100644 package/base-files/files.old/lib/preinit/90_restore_config create mode 100644 package/base-files/files.old/lib/preinit/99_10_mount_no_mtd (limited to 'package/base-files/files.old/lib/preinit') diff --git a/package/base-files/files.old/lib/preinit/05_mount_skip b/package/base-files/files.old/lib/preinit/05_mount_skip new file mode 100644 index 000000000..c2b7ee79d --- /dev/null +++ b/package/base-files/files.old/lib/preinit/05_mount_skip @@ -0,0 +1,13 @@ +#!/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.old/lib/preinit/10_check_for_mtd b/package/base-files/files.old/lib/preinit/10_check_for_mtd new file mode 100644 index 000000000..6a7bd307f --- /dev/null +++ b/package/base-files/files.old/lib/preinit/10_check_for_mtd @@ -0,0 +1,20 @@ +#!/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.old/lib/preinit/20_check_jffs2_ready b/package/base-files/files.old/lib/preinit/20_check_jffs2_ready new file mode 100644 index 000000000..3c5cf67e8 --- /dev/null +++ b/package/base-files/files.old/lib/preinit/20_check_jffs2_ready @@ -0,0 +1,19 @@ +#!/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.old/lib/preinit/40_mount_jffs2 b/package/base-files/files.old/lib/preinit/40_mount_jffs2 new file mode 100644 index 000000000..ded785ed5 --- /dev/null +++ b/package/base-files/files.old/lib/preinit/40_mount_jffs2 @@ -0,0 +1,26 @@ +#!/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.old/lib/preinit/41_merge_overlay_hooks b/package/base-files/files.old/lib/preinit/41_merge_overlay_hooks new file mode 100644 index 000000000..4ca6877be --- /dev/null +++ b/package/base-files/files.old/lib/preinit/41_merge_overlay_hooks @@ -0,0 +1,24 @@ +#!/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.old/lib/preinit/70_pivot_jffs2_root b/package/base-files/files.old/lib/preinit/70_pivot_jffs2_root new file mode 100644 index 000000000..b76f111ca --- /dev/null +++ b/package/base-files/files.old/lib/preinit/70_pivot_jffs2_root @@ -0,0 +1,14 @@ +#!/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.old/lib/preinit/90_mount_no_jffs2 b/package/base-files/files.old/lib/preinit/90_mount_no_jffs2 new file mode 100644 index 000000000..d8ad4ae11 --- /dev/null +++ b/package/base-files/files.old/lib/preinit/90_mount_no_jffs2 @@ -0,0 +1,12 @@ +#!/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.old/lib/preinit/90_restore_config b/package/base-files/files.old/lib/preinit/90_restore_config new file mode 100644 index 000000000..210bf6184 --- /dev/null +++ b/package/base-files/files.old/lib/preinit/90_restore_config @@ -0,0 +1,17 @@ +#!/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.old/lib/preinit/99_10_mount_no_mtd b/package/base-files/files.old/lib/preinit/99_10_mount_no_mtd new file mode 100644 index 000000000..c4f38e415 --- /dev/null +++ b/package/base-files/files.old/lib/preinit/99_10_mount_no_mtd @@ -0,0 +1,12 @@ +#!/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