debian-cd-clone/tools/make_image

130 lines
3.4 KiB
Bash
Executable File

#!/bin/sh
#
# Debian-cd helper script for making ISO / jigdo images
#
# Split out from the top-level Makefile SAM 2005/12/08
set -e
DIR=$1
ARCH=$2
OUT=$3
DOJIGDO=$4
DEBVERSION=$5
MIRROR=$6
MKISOFS=$7
MKISOFS_OPTS=$8
JIGDO_OPTS=$9
shift
JIGDO_CLEANUP=$9
if [ "$CD"x = ""x ] ; then
echo "Generating the $ARCH iso/jigdo images ..."
FILES=$DIR/*.volid
else
echo "Generating $ARCH iso/jigdo image number $CD ..."
FILES=$DIR/$CD.volid
fi
for file in $FILES
do
dir=${file%%.volid}
n=${dir##$DIR/}
num=$n
dir=$DIR/CD$n
cd $dir/..
opts=`cat $DIR/$n.mkisofs_opts`
dirs=`cat $DIR/$n.mkisofs_dirs` || true
volid=`cat $DIR/$n.volid`
relname=`echo $DEBVERSION | sed -e 's/[. ]//g'`
DISKINFO=`cat $DIR/$n.diskinfo`
if [ $ARCH = "source" ] ; then
OUTFILE="${CDNAME:-debian}-$relname-$ARCH-$DISKTYPE-$n"
else
OUTFILE="${CDNAME:-debian}-$relname-$ARCH-$DISKTYPE-binary-$n"
fi
# Clean up any old files
rm -f $OUT/$OUTFILE.iso $OUT/$OUTFILE.jigdo $OUT/$OUTFILE.template
date
# Actually make the ISO/jigdo images. Long command lines
# here... :-(
case $DOJIGDO in
0) # No jigdo files, just straight ISO
echo $MKISOFS $MKISOFS_OPTS -V \'"$volid"\' -o $OUT/$OUTFILE.iso $opts $dirs CD$n
echo $MKISOFS $MKISOFS_OPTS -V \'"$volid"\' -o $OUT/$OUTFILE.iso $opts $dirs CD$n > CD$n/.disk/mkisofs
$MKISOFS $MKISOFS_OPTS -V "$volid" -o $OUT/$OUTFILE.iso $opts $dirs CD$n
;;
1) # jigdo files _and_ ISO
echo $MKISOFS $MKISOFS_OPTS -V \'"$volid"\' \
-o $OUT/$OUTFILE.iso \
-jigdo-jigdo $OUT/$OUTFILE.jigdo \
-jigdo-template $OUT/$OUTFILE.template \
-jigdo-map Debian=$MIRROR/ \
-jigdo-exclude boot$n \
-md5-list $DIR/md5-check \
$JIGDO_OPTS $opts $dirs CD$n
echo $MKISOFS $MKISOFS_OPTS -V \'"$volid"\' \
-o $OUT/$OUTFILE.iso \
-jigdo-jigdo $OUT/$OUTFILE.jigdo \
-jigdo-template $OUT/$OUTFILE.template \
-jigdo-map Debian=$MIRROR/ \
-jigdo-exclude boot$n \
-md5-list $DIR/md5-check \
$JIGDO_OPTS $opts $dirs CD$n > CD$n/.disk/mkisofs
$MKISOFS $MKISOFS_OPTS -V "$volid" \
-o $OUT/$OUTFILE.iso \
-jigdo-jigdo $OUT/$OUTFILE.jigdo \
-jigdo-template $OUT/$OUTFILE.template \
-jigdo-map Debian=$MIRROR/ \
-jigdo-exclude boot$n \
-md5-list $DIR/md5-check \
$JIGDO_OPTS $opts $dirs CD$n
;;
2) # jigdo only, no ISO
echo $MKISOFS $MKISOFS_OPTS -V \'"$volid"\' \
-o /dev/null \
-jigdo-jigdo $OUT/$OUTFILE.jigdo \
-jigdo-template $OUT/$OUTFILE.template \
-jigdo-map Debian=$MIRROR/ \
-jigdo-exclude boot$n \
-md5-list $DIR/md5-check \
$JIGDO_OPTS $opts $dirs CD$n
echo $MKISOFS $MKISOFS_OPTS -V \'"$volid"\' \
-o /dev/null \
-jigdo-jigdo $OUT/$OUTFILE.jigdo \
-jigdo-template $OUT/$OUTFILE.template \
-jigdo-map Debian=$MIRROR/ \
-jigdo-exclude boot$n \
-md5-list $DIR/md5-check \
$JIGDO_OPTS $opts $dirs CD$n > CD$n/.disk/mkisofs
$MKISOFS $MKISOFS_OPTS -V "$volid" \
-o /dev/null \
-jigdo-jigdo $OUT/$OUTFILE.jigdo \
-jigdo-template $OUT/$OUTFILE.template \
-jigdo-map Debian=$MIRROR/ \
-jigdo-exclude boot$n \
-md5-list $DIR/md5-check \
$JIGDO_OPTS $opts $dirs CD$n
;;
esac
# If we've made jigdo files, tweak them with extra info now
if [ "$DOJIGDO" != "0" ] ; then
$JIGDO_CLEANUP $OUT/$OUTFILE.jigdo \
$OUTFILE.iso $DIR/CD$n \
"`echo "$JIGDOTEMPLATEURL" | sed -e 's|%ARCH%|$ARCH|g'`$OUTFILE.template" \
"$DISKINFO" \
$JIGDOFALLBACKURLS
fi
done