Skip to content

Instantly share code, notes, and snippets.

@nextrevision
Created March 19, 2015 16:02
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nextrevision/0d55e317341186a21d23 to your computer and use it in GitHub Desktop.
Save nextrevision/0d55e317341186a21d23 to your computer and use it in GitHub Desktop.
Uses isoinfo to extract all contents of an ISO to the given output directory
#!/bin/bash
# Description:
# Extracts all contents of an ISO to the given output directory
# Requires:
# Packages: genisoimage
ISO=$1
OUTDIR=${2:-"./out"}
usage() {
echo "$0 <iso> [outdir:./out]"
}
[ -z $ISO ] && { usage; exit 1; }
[ -r $ISO ] || { echo "Cannot read ISO ${ISO}"; exit 1; }
[ -d $OUTDIR ] || mkdir -p $OUTDIR
isoinfo -f -R -i $ISO | while read line; do
d=$(dirname $line)
od=${OUTDIR}${d}
[ -f $od ] && rm -f $od
[ -d $od ] || mkdir -p $od
isoinfo -R -i $ISO -x $line > ${OUTDIR}${line}
done
echo "Extracted to ${ISO} to ${OUTDIR}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment