diff --git a/builds/any/installer/installer.sh.in b/builds/any/installer/installer.sh.in index e2dbd86e..fc2a95fa 100644 --- a/builds/any/installer/installer.sh.in +++ b/builds/any/installer/installer.sh.in @@ -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 diff --git a/packages/base/all/vendor-config-onl/src/lib/install/lib.sh b/packages/base/all/vendor-config-onl/src/lib/install/lib.sh index 78a5033b..cce68557 100644 --- a/packages/base/all/vendor-config-onl/src/lib/install/lib.sh +++ b/packages/base/all/vendor-config-onl/src/lib/install/lib.sh @@ -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