From 9b983fabc17e5e7ecd52cc47643b82298adaaf62 Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Fri, 13 Sep 2013 16:00:34 +0200 Subject: [PATCH] initrd.scripts: move getdvhoff to 00-livecd.sh (and make it "private") --- defaults/initrd.d/00-livecd.sh | 6 +++++- defaults/initrd.scripts | 5 ----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/defaults/initrd.d/00-livecd.sh b/defaults/initrd.d/00-livecd.sh index 2fd23e7..3cd616e 100755 --- a/defaults/initrd.d/00-livecd.sh +++ b/defaults/initrd.d/00-livecd.sh @@ -128,6 +128,10 @@ _livecd_mount_unpack_nfs() { fi } +_getdvhoff() { + echo $(( $(hexdump -n 4 -s $((316 + 12 * $2)) -e '"%i"' $1) * 512)) +} + _livecd_mount_sgimips() { # getdvhoff finds the starting offset (in bytes) of the squashfs # partition on the cdrom and returns this offset for losetup @@ -140,7 +144,7 @@ _livecd_mount_sgimips() { # the LiveCD rootfs good_msg "Locating the SGI LiveCD root partition" echo " " | \ - losetup -o $(getdvhoff "${NEW_ROOT}${REAL_ROOT}" 0) \ + losetup -o $(_getdvhoff "${NEW_ROOT}${REAL_ROOT}" 0) \ "${NEW_ROOT}${CDROOT_DEV}" \ "${NEW_ROOT}${REAL_ROOT}" test_success "losetup /dev/sr0 /dev/loop0" diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index 036be93..ac9ea1c 100755 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -15,11 +15,6 @@ . /etc/initrd.d/00-iscsi.sh . /etc/initrd.d/00-rootdev.sh - -getdvhoff() { - echo $(( $(hexdump -n 4 -s $((316 + 12 * $2)) -e '"%i"' $1) * 512)) -} - # If devtmpfs is mounted, try move it to the new root # If that fails, try to unmount all possible mounts of devtmpfs as # stuff breaks otherwise