packages/utils/lilo/S11Pivot
groz 1a0c0e1922 Add lilo package for use in making bootable images for x86
git-svn-id: svn://svn.openwrt.org/openwrt/packages@4582 3c298f89-4303-0410-b956-a3cf2f4a3e73
2006-08-17 07:37:54 +00:00

28 lines
695 B
Bash
Executable File

#!/bin/sh
# Copyright (C) 2006 OpenWrt.org
#pivot function blatantly stolen from the firstboot stuff in the WRT54 arch files
pivot() { # <new_root> <old_root>
mount -o move /proc $1/proc && \
pivot_root $1 $1$2 && {
mount -o move $2/dev /dev
mount -o move $2/tmp /tmp
mount -o move $2/sys /sys
return 0
}
}
#just a little bit of time for the usb to settle down and get plugged in
#technically it probably should be done in hotplug, but, we need to handle
#the case of no key at all, and fall thru to ramdisk when it's selected
sleep 5
if [[ "$NOPIVOT" = "1" ]]; then
echo starting from a ramdisk
else
mount /dev/discs/disc0/disc /mnt
mkdir -p /mnt/old
pivot /mnt /old
fi