summaryrefslogtreecommitdiffstats
path: root/package/block-mount/files/60_pivot_usb_root
diff options
context:
space:
mode:
authorcshore <cshore@3c298f89-4303-0410-b956-a3cf2f4a3e73>2011-03-27 06:40:51 +0000
committercshore <cshore@3c298f89-4303-0410-b956-a3cf2f4a3e73>2011-03-27 06:40:51 +0000
commit3e7449974c1f5ceaa81d412bd843f8c16a53affa (patch)
treed29172975565825b660caeecebf697d1404fac1e /package/block-mount/files/60_pivot_usb_root
parentb42622d831fe2a46f4a70efd145e6ccfef8a0fea (diff)
[package] block-mount: Merged block-mount, block-extroot, and block-hotplug into a single binary package called block-mount.
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@26314 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/block-mount/files/60_pivot_usb_root')
-rw-r--r--package/block-mount/files/60_pivot_usb_root27
1 files changed, 27 insertions, 0 deletions
diff --git a/package/block-mount/files/60_pivot_usb_root b/package/block-mount/files/60_pivot_usb_root
new file mode 100644
index 000000000..b610a4ade
--- /dev/null
+++ b/package/block-mount/files/60_pivot_usb_root
@@ -0,0 +1,27 @@
+#!/bin/sh
+# Copyright (C) 2010 Vertical Communications
+
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+
+# Determine if we are requested to mount external root
+
+external_root_pivot() {
+ check_skip || [ "$pi_extroot_mount_success" != "true" ] || {
+ echo "switching to external rootfs"
+ if [ "$ER_OVERLAY_ROM" = "/overlay" ]; then
+ if [ "$ER_IS_SQUASHFS" = "true" ]; then
+ umount /tmp/overlay
+ fi
+ mount -o remount,ro / && fopivot /overlay /rom && pi_mount_skip_next=true
+ elif [ "$ER_OVERLAY_ROM" = "/rom" ]; then
+ if [ "$ER_IS_SQUASHFS" = "true" ]; then
+ umount /tmp/overlay
+ fi
+ mount -o remount,ro / && pivot_rom /rom /rom && pi_mount_skip_next=true
+ fi
+ }
+}
+
+boot_hook_add preinit_mount_root external_root_pivot
+