Page 1 of 1

Bash Script to make custom ISO image from Linux

Posted: Tue Oct 23, 2007 8:17 am
by djhook
Hi,

I run just Linux on my computer, and make a 'ubcd2iso.sh' shell script based on 'ubcd2iso.bat' file to make an ISO image after custom new diskette images on custom directory. This file can be used into 'tools/ubcd2iso' directory.

The shell script file is here:

Code: Select all

#!/bin/bash

# * Create a bootable UBCD ISO image
# *
# * Ultimate Boot CD (UBCD): http://www.ultimatebootcd.com/
# * syslinux: http://syslinux.zytor.com/

if [ -z "$1" -a -z "$2" ]; then
    echo
    echo 'ubcd2iso.sh: Create bootable UBCD ISO image'
    echo
    echo 'Usage:    ubcd2iso.sh (UBCD-path) (output-image)'
    echo
    echo "Example:  ubcd2iso.sh /tmp/ubcd /tmp/ubcd40.iso"
    echo "          (UBCD extracted in dir '/tmp/ubcd', ISO image written to '/tmp/ubcd40.iso')"
    echo
    echo "Required: Linux, mkisofs and UBCD extracted to local storage"
    echo
    exit 1
fi

echo "ubcd2iso.sh: Creating bootable UBCD ISO image ..."

[ ! -f "$1/isolinux/isolinux.bin" ] && echo "(ERROR) Missing file '$1/isolinux/isolinux.bin'" && exit 3

cd "$1"
mkisofs -N -J -joliet-long -D -V "UBCD40" -o "$2" -b "isolinux/isolinux.bin" -no-emul-boot -boot-load-size 4 -boot-info-table .

[ $? -gt 0 ] && echo "(ERROR) 'mkisofs' failed" && exit 4

echo "ubcd2iso.sh: Bootable UBCD ISO image has been created"
echo
exit 0
I hope this code are usefull to someone.

Thats all...

DJHook