summaryrefslogtreecommitdiff
path: root/scripts/build/lb_binary_usb
diff options
context:
space:
mode:
authorCody A.W. Somerville <cody.somerville@canonical.com>2011-07-20 08:46:11 +0200
committerDaniel Baumann <daniel@debian.org>2011-07-20 08:46:11 +0200
commit31445ed7be72f77804cce0f71f03c802c04cc7bc (patch)
tree86c88ddb775289565ea60235280a92223cb9e8b3 /scripts/build/lb_binary_usb
parentfb2bc99fd5f02cf87061159184640505bc428c5a (diff)
downloadvyos-live-build-31445ed7be72f77804cce0f71f03c802c04cc7bc.tar.gz
vyos-live-build-31445ed7be72f77804cce0f71f03c802c04cc7bc.zip
Fixing corruption of usb binary images caused by trying to modify flags in partition table when image is mounted with offset.
Diffstat (limited to 'scripts/build/lb_binary_usb')
-rwxr-xr-xscripts/build/lb_binary_usb24
1 files changed, 18 insertions, 6 deletions
diff --git a/scripts/build/lb_binary_usb b/scripts/build/lb_binary_usb
index 0b07cfea5..e6c29ea7f 100755
--- a/scripts/build/lb_binary_usb
+++ b/scripts/build/lb_binary_usb
@@ -190,16 +190,10 @@ esac
case "${LB_BUILD_WITH_CHROOT}" in
true)
Chroot chroot "mkfs.${MKFS} ${MKFS_OPTIONS} ${FREELO}"
-
- Chroot chroot "parted -s ${FREELO} set 1 boot on" || true
- Chroot chroot "parted -s ${FREELO} set 1 lba off" || true
;;
false)
mkfs.${MKFS} ${MKFS_OPTIONS} ${FREELO}
-
- parted -s ${FREELO} set 1 boot on || true
- parted -s ${FREELO} set 1 lba off || true
;;
esac
@@ -265,6 +259,24 @@ ${LB_LOSETUP} -d ${FREELO}
echo "!!! The above error/warning messages can be ignored !!!"
+FREELO="$(${LB_LOSETUP} -f)"
+Losetup "${FREELO}" chroot/binary.img 0
+
+case "${LB_BUILD_WITH_CHROOT}" in
+ true)
+ Chroot chroot "parted -s ${FREELO} set 1 boot on" || true
+ Chroot chroot "parted -s ${FREELO} set 1 lba off" || true
+ ;;
+
+ false)
+ parted -s "${FREELO}" set 1 boot on || true
+ parted -s "${FREELO}" set 1 lba off || true
+ ;;
+esac
+
+sleep 1
+${LB_LOSETUP} -d ${FREELO}
+
if [ -n "${MAKEDEV}" ]
then
rm -rf chroot/dev