Created
March 19, 2015 16:02
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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