Transform a multipart puppy image disk to a bootable ISO

For discussions about programming, and for programming questions and advice


Moderator: Forum moderators

Post Reply
retiredt00
Posts: 224
Joined: Fri Sep 04, 2020 12:11 pm
Has thanked: 11 times
Been thanked: 36 times

Transform a multipart puppy image disk to a bootable ISO

Post by retiredt00 »

I test new builds booting an ISO image in VM. However, lately ISOs are not provided.
So I patched up a little script to transform an IMG file to ISO and used the frequently changing vanilladpup 11 development builds as a test case.

To use expand the tarball (make sure img_to_iso.sh has execute permissions) in a place with at least 6GB free space, cd to the created folder and run ./img_to_iso.sh <version_nuber> where <version number> is the latest UEFI compressed image found in https://github.com/vanilla-dpup/unstabl ... 86_64-11.0
If all goes well you'll get an ISO with the same name after few minutes, depending on your connection speed.

Please DO NOT report any issues found in these builds in the vanilladpup11 thread unless you can reproduce them with an installation recommended/accepted by the developer.

Edit: removed -x option in script

Edit2: Removed attachment. see below

Last edited by retiredt00 on Thu Jul 18, 2024 8:54 am, edited 1 time in total.
retiredt00
Posts: 224
Joined: Fri Sep 04, 2020 12:11 pm
Has thanked: 11 times
Been thanked: 36 times

Re: Transform a multipart puppy image disk to a bootable ISO

Post by retiredt00 »

Dear puppy developers
I have a frustrating problem with this script.

Works very nice the first time, and every time with a fresh clean build after boot.
However the second time around if you keep the extracted image file, it fails.

In this second version attached here, I introduced some cleaning of the loops and the mount points and indeed at the end of the process losetup --all and cat /proc/mounts has no trace of the image or the mounted partitions
However, on the second attempt the process goes on the image is loop mounted the partitions are mounted on their target folders but the folders now are empty!
At the same time the image shows as loop mounted and the partitions (vfat and ext4) present on /proc/mounts

Is not clear to me why the partitions are empty the second time around
The entire process is run on Bookworm Pup64 10.0.7

Any suggestion would be helpful
Thank you

Edit: Found the mistake. Removed attachment and script. see bellow

Last edited by rockedge on Wed Jul 17, 2024 6:26 pm, edited 1 time in total.
Reason: fixed a typo from rum to run
retiredt00
Posts: 224
Joined: Fri Sep 04, 2020 12:11 pm
Has thanked: 11 times
Been thanked: 36 times

Re: Transform a multipart puppy image disk to a bootable ISO

Post by retiredt00 »

Found it!
In retrospect was a very silly mistake.
(I was emptying the partitions... :cry: )
Anyway here is v3 where you can build and rebuild the image to iso.
v1 and v2 above are removed, though do work fine if you use them (the first time with a newly downloaded image).
BTW are all the downloads of the previous versions done by bots?

Attachments
make_dpup11_iso_v3.tar.gz
(50.64 KiB) Downloaded 58 times
User avatar
wiak
Posts: 4245
Joined: Tue Dec 03, 2019 6:10 am
Location: Packing - big job
Has thanked: 70 times
Been thanked: 1258 times
Contact:

Re: Transform a multipart puppy image disk to a bootable ISO

Post by wiak »

Sounds usefully like the sort of utility @Clarity wants on some occasions.

https://www.tinylinux.info/
DOWNLOAD wd_multi for hundreds of 'distros' at your fingertips: viewtopic.php?p=99154#p99154
Αξίζει να μεταφραστεί;

retiredt00
Posts: 224
Joined: Fri Sep 04, 2020 12:11 pm
Has thanked: 11 times
Been thanked: 36 times

Re: Transform a multipart puppy image disk to a bootable ISO

Post by retiredt00 »

Well I have something else that I made that I found looking to solve my loop mount "issue" that may be be of more general used

Copy this little script, name it u_mount_img.sh, put it in your PATH and set it app as a default action for this kind of multipartition img files.
It will mount and unmount a multipart image by just clicking on it.

Code: Select all

#!/bin/sh

[ ! $1 ] && echo "Please provide a multi-part image file to mount or unmount" && exit 0
# Make sure we are root incase is not a puppy
[ "`whoami`" != "root" ] && exec sudo -A ${0} ${@}

# adapted from  https://superuser.com/questions/211338/how-to-mount-a-multi-partition-disk-image-in-linux
los() (
  img="$1"
  dev="$(losetup --show -f -P "$img")"
  echo "$dev"
  for part in "$dev"?*; do
    if [ "$part" = "${dev}p*" ]; then
      part="${dev}"
    fi
    dst="/mnt/$(basename "$part")"
    echo "$dst"
    mkdir -p "$dst"
    mount "$part" "$dst"
    rox "$dst"
  done
)

losd() (
  dev="$LOOP"
  for part in "$dev"?*; do
    if [ "$part" = "${dev}p*" ]; then
      part="${dev}"
    fi
    dst="/mnt/$(basename "$part")"
    umount "$dst"
  done
  losetup -d "$dev"
)

if [ ! "$(losetup --all | grep "$1")" ]; then
	los "$1"
else
	LOOP=$(losetup --all | grep "$1" | cut -f1 -d:)
	losd "$LOOP"
fi
	

Or/and if you like you can amend filemnt as the patch bellow indicates, so it can handle images instead of complaining

Code: Select all

--- a/sbin/filemnt	
+++ b/sbin/filemnt
@@ -106,6 +106,7 @@
       sfs|lzm|xzm|sb|squashfs) Type='squashfs' ;;
       iso) Type='iso'  ;;
       wim) Type='wim'  ;;
+      img) u_mount_img.sh ${imgFile}
     esac
   fi
   if [ "$Type" = "" ] ; then
User avatar
wiak
Posts: 4245
Joined: Tue Dec 03, 2019 6:10 am
Location: Packing - big job
Has thanked: 70 times
Been thanked: 1258 times
Contact:

Re: Transform a multipart puppy image disk to a bootable ISO

Post by wiak »

I think some editions of filemnt did mount img files, or were supposed to, or at least I think I saw some code in there relating to that at some point (and commented out so maybe wasn't working correctly), but not sure. Anyway, good to see that included for sure.

https://www.tinylinux.info/
DOWNLOAD wd_multi for hundreds of 'distros' at your fingertips: viewtopic.php?p=99154#p99154
Αξίζει να μεταφραστεί;

Clarity
Posts: 4060
Joined: Fri Jul 24, 2020 10:59 pm
Has thanked: 1704 times
Been thanked: 552 times

Re: Transform a multipart puppy image disk to a bootable ISO

Post by Clarity »

@retiredt00, Great utility(s) :thumbup:

Please: Recommend these tiny utility and update be submitted to WoofCE. Both the 'mount' and the 'ISO maker' have relevance in Puppyland overall.

Thanks again for this creativity as you survey the forum landscape, @retiredt00

Post Reply

Return to “Programming”