| 1 | #!/bin/sh |
| 2 | # Copyright (C) 2010 Vertical Communications |
| 3 | |
| 4 | # This is free software, licensed under the GNU General Public License v2. |
| 5 | # See /LICENSE for more information. |
| 6 | |
| 7 | # Determine if we are requested to mount external root |
| 8 | |
| 9 | external_root_pivot() { |
| 10 | check_skip || [ "$pi_extroot_mount_success" != "true" ] || { |
| 11 | echo "switching to external rootfs" |
| 12 | if [ "$ER_OVERLAY_ROM" = "/overlay" ]; then |
| 13 | if [ "$ER_IS_SQUASHFS" = "true" ]; then |
| 14 | umount /tmp/overlay |
| 15 | fi |
| 16 | mount -o remount,ro / && fopivot /overlay /rom && pi_mount_skip_next=true |
| 17 | elif [ "$ER_OVERLAY_ROM" = "/rom" ]; then |
| 18 | if [ "$ER_IS_SQUASHFS" = "true" ]; then |
| 19 | umount /tmp/overlay |
| 20 | fi |
| 21 | mount -o remount,ro / && pivot_rom /rom /rom && pi_mount_skip_next=true |
| 22 | fi |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | boot_hook_add preinit_mount_root external_root_pivot |
| 27 | |
| 28 | |