diff options
author | Ilias Apalodimas <ilias.apalodimas@linaro.org> | 2019-08-08 09:06:40 +0300 |
---|---|---|
committer | Ilias Apalodimas <ilias.apalodimas@linaro.org> | 2019-08-08 09:06:40 +0300 |
commit | 6a489cc0e9d49073d8b524b28646cfdd83cd3185 (patch) | |
tree | 4919a006855f95924c115f9b4ee14aab592da5c7 /ledge-debian | |
parent | a29cc7e7a78892c04b75545d0280fd2bcf7ef4aa (diff) |
ledge: debian: easier way to find free loop devices
Use losetup --find to locate the first free loop device
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Change-Id: I14ede1514cedff072ed1e53c9d74c9bb1812aac6
Diffstat (limited to 'ledge-debian')
-rw-r--r-- | ledge-debian/builders-fai.sh | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/ledge-debian/builders-fai.sh b/ledge-debian/builders-fai.sh index 38f10a3d..d8a26b51 100644 --- a/ledge-debian/builders-fai.sh +++ b/ledge-debian/builders-fai.sh @@ -4,12 +4,12 @@ set -ex trap cleanup_exit INT TERM EXIT BUILDDIR='/tmp' -LOOPDEV='loop0' +LOOPDEV='/dev/loop0' cleanup_exit() { cd ${WORKSPACE} - sudo losetup -d /dev/"$LOOPDEV" || true + sudo losetup -d "$LOOPDEV" || true sudo umount -f "$BUILDDIR" || true } @@ -72,25 +72,20 @@ for rootfs in ${ROOTFS}; do exit 1 fi - # linux has 8 loop devices by default - for loop_no in $(seq 0 7); do - sudo losetup /dev/loop$loop_no - [ $? -ne 0 ] && LOOPDEV='loop'$loop_no && break - done - + LOOPDEV=$(losetup --find) # create rootfs # TODO add kernel from OE builds + EFI directory structure - sudo losetup -P /dev/"$LOOPDEV" "$BUILDDIR"/work.raw + sudo losetup -P "$LOOPDEV" "$BUILDDIR"/work.raw # rootfs is on the last partition. This might need to change depending on # our build procedure in the future device="$LOOPDEV"'p2' - sudo mount /dev/"$device" /mnt/ + sudo mount "$device" /mnt/ sudo tar caf out/rootfs-${image_name}.tar /mnt sudo chroot /mnt dpkg -l > out/${image_name}.packages sudo umount -f /mnt - sudo losetup -d /dev/"$LOOPDEV" + sudo losetup -d "$LOOPDEV" # cp "$BUILDDIR"/work.raw out/${image_name}.sd # Compress image(s) |