Remount onie-boot if necessary

This commit is contained in:
Carl D. Roth
2016-07-22 13:27:58 -07:00
parent 50f43798e9
commit ac6f246291
2 changed files with 67 additions and 4 deletions

View File

@@ -399,10 +399,26 @@ installer_mkchroot "${rootdir}"
mkdir -p "${rootdir}/mnt/installer"
mount -o ro,bind "${installer_dir}" "${rootdir}/mnt/installer"
# make the onie boot files available to the chroot
mkdir -p "${rootdir}/mnt/onie-boot"
if test -d "/mnt/onie-boot"; then
mount -o ro,bind "/mnt/onie-boot" "${rootdir}/mnt/onie-boot"
# make sure onie-boot is mounted
if test -d /mnt/onie-boot; then
if grep -q " /mnt/onie-boot " /proc/mounts; then
:
else
ONIE_BOOT_DEVICE=
visit_blkid blkid_find_onie
if test -b "$ONIE_BOOT_DEVICE"; then
installer_say "Mounting ONIE-BOOT ($ONIE_BOOT_DEVICE) as /mnt/onie-boot"
mount -o defaults,rw $ONIE_BOOT_DEVICE /mnt/onie-boot
else
installer_say "*** missing ONIE-BOOT device"
fi
fi
if grep -q " /mnt/onie-boot " /proc/mounts; then
# make the onie boot files available to the chroot
mkdir -p "${rootdir}/mnt/onie-boot"
mount -o ro,bind "/mnt/onie-boot" "${rootdir}/mnt/onie-boot"
fi
fi
# generate config for installer environment

View File

@@ -123,6 +123,53 @@ installer_mkchroot() {
fi
}
visit_blkid()
{
local fn rest
fn=$1; shift
rest="$@"
local ifs
ifs=IFS; IFS=$CR
for line in $(blkid); do
IFS=$ifs
local dev
dev=${line%%:*}
line=${line#*:}
local TYPE LABEL PARTLABEL UUID PARTUUID
while test "$line"; do
local key
key=${line%%=*}
line=${line#*=}
case "$line" in
'"'*)
line=${line#\"}
val=${line%%\"*}
line=${line#*\"}
line=${line## }
;;
*)
val=${line%% *}
line=${line#* }
;;
esac
eval "$key=\"$val\""
done
local sts
eval $fn \"$dev\" \"$LABEL\" \"$UUID\" \"$PARTLABEL\" \"$PARTUUID\" $rest
sts=$?
if test $sts -eq 2; then break; fi
if test $sts -ne 0; then return $sts; fi
done
IFS=$ifs
return 0
}
# Local variables
# mode: sh
# sh-basic-offset: 2