mknewbuild has hardcoded loop device.

Issue #5 closed
Former user created an issue

The script to generate a new build "mknewbuild" uses hardcoded path to loop device (/dev/loop5). As this was not present on my machine (debian 7.1) I changed code to use losetup -f to get the next free loopback device, save this in a varible and use this throughout the script.

Heres the patch i generated with git diff ./mknewbuild ./mknewbuild.orig

diff --git a/mknewbuild b/mknewbuild
index 1d99254..03e2950 100755
--- a/mknewbuild
+++ b/mknewbuild
@@ -4,6 +4,7 @@
 INITRD=initrd
 ISOFILE=trinity-rescue-kit.3.4-build-$2.iso
 TRKTAG=TRK_3.4
+DEVLO=$(losetup -f)

 case "$1" in
        -b)
@@ -26,17 +27,17 @@ cd - >/dev/null
 #if [ $? != 0 ]; then exit 1; fi;
 mkdir -p tmp/mnt
 dd if=/dev/zero of=tmp/initrd bs=1024k count=64
-losetup /dev/loop5 tmp/initrd
-mke2fs -N 20480 /dev/loop5
-tune2fs -c 0 -i 0 /dev/loop5
-mount /dev/loop5 tmp/mnt
+losetup $DEVLO tmp/initrd
+mke2fs -N 20480 $DEVLO
+tune2fs -c 0 -i 0 $DEVLO
+mount $DEVLO tmp/mnt
 cd trkinitrd/
 tar c * | tar xC ../tmp/mnt
 sync
 sleep 1
 cd ..
 umount tmp/mnt
-losetup -d /dev/loop5
+losetup -d $DEVLO
 echo Compressing initrd to the max
 #gzip --best -c $INITRD > "$INITRD".trk
 gzip --best -c tmp/initrd  > "$INITRD".trk

Comments (2)

  1. Tom Kerremans repo owner

    Make a branch from the latest commit, apply your code and create a pull request. Looks good. (Sorry for the late reply)

  2. Log in to comment