diff options
author | Paul Sokolovsky <pmiscml@gmail.com> | 2007-11-22 12:05:21 +0000 |
---|---|---|
committer | Paul Sokolovsky <pmiscml@gmail.com> | 2007-11-22 12:05:21 +0000 |
commit | 36387e28eb6cf1f1b2542ff5bbc4d185995c8076 (patch) | |
tree | 39b9eafba4d0fa34f6ba0bbec7e28be33f41dd6b /packages/initrdscripts/files/80-loopboot.sh | |
parent | c6085182fd76b38e1f451ab61414b0bcccd10726 (diff) |
initrdscripts: Introduce boot order support for universal initramfs modules.
Diffstat (limited to 'packages/initrdscripts/files/80-loopboot.sh')
-rw-r--r-- | packages/initrdscripts/files/80-loopboot.sh | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/packages/initrdscripts/files/80-loopboot.sh b/packages/initrdscripts/files/80-loopboot.sh new file mode 100644 index 0000000000..55a1948db8 --- /dev/null +++ b/packages/initrdscripts/files/80-loopboot.sh @@ -0,0 +1,54 @@ +#!/bin/sh + +if [ "$ROOT_DEVICE" = "/dev/loop" ]; then + loop_mount() { + loopdev=/dev/loop$loop_num + mountpt=/mnt/loop$loop_num + + [ -e $loopdev ] || mknod $loopdev b 7 $loop_num + + # if only one argument was specified, let it be path not dev + if [ -z "$path" ] && [ -n "$dev" ]; then + path="$dev" + dev="" + fi + [ -z "$offset" ] && offset=0 + + if [ -n "$dev" ]; then + hostpt=`expr "$dev" : '.*/\([^/]*\)'` + [ -z "$hostpt" ] && hostpt="$dev" + + echo "Mounting $dev on $hostpt" + mkdir $hostpt + mount $dev $hostpt + cd $hostpt + fi + + echo "Loopback setup of $path (offset $offset)" + losetup -o "$offset" "$loopdev" "$path" + + echo "Mounting $loopdev on $mountpt" + mkdir "$mountpt" + mount "$loopdev" "$mountpt" + cd "$mountpt" + BOOT_ROOT="$mountpt" + loop_num=`expr "$loop_num" + 1` + } + + modprobe vfat + modprobe loop + + loop_num=0 + + for arg in $CMDLINE; do + optarg=`expr "x$arg" : 'x[^=]*=\(.*\)'` + echo $arg xxx $optarg + case $arg in + looproot=*) + dev=`expr "$optarg" : '\([^:]*\).*'` + path=`expr "$optarg" : '[^:]*:\([^:]*\).*'` + offset=`expr "$optarg" : '[^:]*:[^:]*:\([^:]*\).*'` + loop_mount ;; + esac + done +fi |