Skip to content

Commit

Permalink
Merge pull request #431 from richard-scott/detect-first-unused-loop-d…
Browse files Browse the repository at this point in the history
…evice

Find the first unused loop device.
  • Loading branch information
diederikdehaas authored Mar 19, 2017
2 parents 2ebba8f + 6a340e3 commit 2b15d89
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions buildroot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,13 @@ if [ "$losetup_lt_2_22" = "true" ] ; then

else

losetup -D

losetup -P /dev/loop0 $IMG
mkfs.vfat /dev/loop0p1
mount /dev/loop0p1 /mnt
losetup --find --partscan $IMG
LOOP_DEV="$(losetup --associated $IMG | cut -f1 -d':')"
mkfs.vfat ${LOOP_DEV}p1
mount ${LOOP_DEV}p1 /mnt
cp -r bootfs/* /mnt/
umount /mnt
losetup -D || true
losetup --detach ${LOOP_DEV}

fi

Expand Down

0 comments on commit 2b15d89

Please sign in to comment.