make_image: avoid code duplication and improve whitespace consistency
This commit is contained in:
parent
b094f77592
commit
78905cc873
|
@ -2,7 +2,6 @@
|
|||
#
|
||||
# Debian-cd helper script for making ISO / jigdo images
|
||||
#
|
||||
# Split out from the top-level Makefile SAM 2005/12/08
|
||||
|
||||
set -e
|
||||
|
||||
|
@ -19,11 +18,11 @@ JIGDO_CLEANUP=$9
|
|||
NUM_ARCHES=`echo $ARCHES | wc -w`
|
||||
|
||||
if [ "$CD"x = ""x ] ; then
|
||||
echo "Generating the $ARCHES iso/jigdo images ..."
|
||||
FILES=$DIR/*.volid
|
||||
echo "Generating the $ARCHES iso/jigdo images ..."
|
||||
FILES=$DIR/*.volid
|
||||
else
|
||||
echo "Generating $ARCHES iso/jigdo image number $CD ..."
|
||||
FILES=$DIR/$CD.volid
|
||||
echo "Generating $ARCHES iso/jigdo image number $CD ..."
|
||||
FILES=$DIR/$CD.volid
|
||||
fi
|
||||
|
||||
NUM_CDS=`ls -1 $FILES | wc -l`
|
||||
|
@ -45,51 +44,51 @@ last_minute_update () {
|
|||
|
||||
for file in $FILES
|
||||
do
|
||||
dir=${file%%.volid}
|
||||
n=${dir##$DIR/}
|
||||
dir=$DIR/CD$n
|
||||
dir=${file%%.volid}
|
||||
n=${dir##$DIR/}
|
||||
dir=$DIR/CD$n
|
||||
|
||||
cd $dir
|
||||
# Anything last-minute that can only be done now?
|
||||
last_minute_update
|
||||
|
||||
cd $dir/..
|
||||
cd $dir/..
|
||||
|
||||
opts=`cat $DIR/$n.mkisofs_opts` || true
|
||||
dirs=`cat $DIR/$n.mkisofs_dirs` || true
|
||||
volid=`cat $DIR/$n.volid`
|
||||
relname=`echo $DEBVERSION | sed -e 's/[. ]//g'`
|
||||
DISKINFO=`cat $DIR/$n.diskinfo`
|
||||
opts=`cat $DIR/$n.mkisofs_opts` || true
|
||||
dirs=`cat $DIR/$n.mkisofs_dirs` || true
|
||||
volid=`cat $DIR/$n.volid`
|
||||
relname=`echo $DEBVERSION | sed -e 's/[. ]//g'`
|
||||
DISKINFO=`cat $DIR/$n.diskinfo`
|
||||
|
||||
ARCHLIST=`echo "$ARCHES" | tr ' ' '-'`
|
||||
OUTFILE="${CDNAME:-debian}-$relname-$ARCHLIST-$DISKTYPE-$n"
|
||||
ARCHLIST=`echo "$ARCHES" | tr ' ' '-'`
|
||||
OUTFILE="${CDNAME:-debian}-$relname-$ARCHLIST-$DISKTYPE-$n"
|
||||
|
||||
# Clean up any old files
|
||||
rm -f $OUT/$OUTFILE.iso $OUT/$OUTFILE.jigdo $OUT/$OUTFILE.template
|
||||
# Clean up any old files
|
||||
rm -f $OUT/$OUTFILE.iso $OUT/$OUTFILE.jigdo $OUT/$OUTFILE.template
|
||||
|
||||
date
|
||||
date
|
||||
|
||||
# Work out whether we want ISO, jigdo or both
|
||||
if [ "$MAXISOS"x = ""x ] || [ "$MAXISOS" = "all" ] || [ "$MAXISOS" = "ALL" ] || [ "$n" -le "$MAXISOS" ] ; then
|
||||
if [ "$MAXISOS"x = ""x ] || [ "$MAXISOS" = "all" ] || \
|
||||
[ "$MAXISOS" = "ALL" ] || [ "$n" -le "$MAXISOS" ] ; then
|
||||
ISO_WANTED=1
|
||||
else
|
||||
ISO_WANTED=0
|
||||
fi
|
||||
if [ "$MAXJIGDOS"x = ""x ] || [ "$MAXJIGDOS" = "all" ] || [ "$MAXJIGDOS" = "ALL" ] || [ "$n" -le "$MAXJIGDOS" ] ; then
|
||||
if [ "$MAXJIGDOS"x = ""x ] || [ "$MAXJIGDOS" = "all" ] || \
|
||||
[ "$MAXJIGDOS" = "ALL" ] || [ "$n" -le "$MAXJIGDOS" ] ; then
|
||||
JIGDO_WANTED=1
|
||||
else
|
||||
JIGDO_WANTED=0
|
||||
fi
|
||||
|
||||
# Actually make the ISO/jigdo images. Long command lines
|
||||
# here... :-(
|
||||
# Actually make the ISO/jigdo images. Long command lines
|
||||
# here... :-(
|
||||
CMD=
|
||||
if [ $JIGDO_WANTED = 0 ] && [ $ISO_WANTED = 1 ] ; then
|
||||
|
||||
CMD="$MKISOFS $MKISOFS_OPTS -V '$volid' \
|
||||
-o $OUT/$OUTFILE.iso $opts $dirs CD$n"
|
||||
echo $CMD
|
||||
echo $CMD > CD$n/.disk/mkisofs
|
||||
eval "$CMD"
|
||||
|
||||
elif [ $JIGDO_WANTED = 1 ] && [ $ISO_WANTED = 1 ] ; then
|
||||
|
||||
|
@ -101,9 +100,6 @@ do
|
|||
-jigdo-exclude boot$n \
|
||||
-md5-list $DIR/md5-check \
|
||||
$JIGDO_OPTS $opts $dirs CD$n"
|
||||
echo $CMD
|
||||
echo $CMD > CD$n/.disk/mkisofs
|
||||
eval "$CMD"
|
||||
|
||||
elif [ $JIGDO_WANTED = 1 ] && [ $ISO_WANTED = 0 ] ; then
|
||||
|
||||
|
@ -115,20 +111,22 @@ do
|
|||
-jigdo-exclude boot$n \
|
||||
-md5-list $DIR/md5-check \
|
||||
$JIGDO_OPTS $opts $dirs CD$n"
|
||||
echo $CMD
|
||||
echo $CMD > CD$n/.disk/mkisofs
|
||||
eval "$CMD"
|
||||
|
||||
else
|
||||
echo "Neither jigdo nor iso wanted for CD$n"
|
||||
fi
|
||||
if [ "$CMD" ]; then
|
||||
echo $CMD
|
||||
echo $CMD > CD$n/.disk/mkisofs
|
||||
eval "$CMD"
|
||||
fi
|
||||
|
||||
# If we've made jigdo files, tweak them with extra info now
|
||||
if [ "$JIGDO_WANTED" = 1 ] ; then
|
||||
$JIGDO_CLEANUP $OUT/$OUTFILE.jigdo \
|
||||
$OUTFILE.iso $DIR/CD$n \
|
||||
"`echo "$JIGDOTEMPLATEURL" | sed -e 's|%ARCH%|$ARCH|g'`$OUTFILE.template" \
|
||||
"$DISKINFO" \
|
||||
$JIGDOFALLBACKURLS
|
||||
fi
|
||||
# If we've made jigdo files, tweak them with extra info now
|
||||
if [ "$JIGDO_WANTED" = 1 ] ; 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
|
||||
|
|
Loading…
Reference in New Issue