Refactor the non-cd-booting code

we've already got code to copy the d-i images into a handy place for
users. Move it into a common function and reference that for all the
arches affected.
This commit is contained in:
Steve McIntyre 2017-05-03 10:51:13 +01:00
parent 8ab1d6933c
commit b6b7c3801a
5 changed files with 59 additions and 135 deletions

View File

@ -40,47 +40,9 @@ add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-J -joliet-long"
# Exit if this is not CD#1/DVD#1
if [ $NN != 1 ] ; then exit 0; fi
# Armel/armhf is currently not bootable directly from CD, and there's
# This arch is currently not bootable directly from CD, and there's
# not a lot we can do about that. But add the needed files in the
# right place so that users can find them, at least:
#
# kernel(s)
# initramfs
# DTBs
# etc...
#
# The best wasy to find all the files is to parse d-i's MANIFEST file
# and work from there.
mkdir -p $CDDIR/$INSTALLDIR
cd $CDDIR/$INSTALLDIR
if [ ! "$DI_WWW_HOME" ];then
if [ ! "$DI_DIR" ];then
DI_DIR="$MIRROR/dists/$DI_DIST/main/installer-$ARCH/current/images"
fi
cp "$DI_DIR/MANIFEST" MANIFEST
else
$WGET "$DI_WWW_HOME/MANIFEST" -O MANIFEST
fi
for image in $(awk '{print $1}' MANIFEST); do
if [ ! -e "$image" ]; then
dir=$(dirname $image)
mkdir -p $dir
if [ -n "$LOCAL" -a -f "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" ]; then
cp "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" "$image"
elif [ ! "$DI_WWW_HOME" ];then
if [ ! "$DI_DIR" ];then
DI_DIR="$MIRROR/dists/$DI_DIST/main/installer-$ARCH/current/images"
fi
cp -a "$DI_DIR/$image" "$image"
else
$WGET --no-parent -r -nH --cut-dirs=3 "$DI_WWW_HOME/$image"
fi
fi
done
# Clean up in case we had to use $WGET :-(
find . -name 'index.html*' -delete
# right place so that users can find them, at least
copy_arch_images
exit 0

View File

@ -26,46 +26,7 @@ if [ $N != 1 ]; then
exit 0
fi
# Mips is currently not bootable directly from CD, and there's
# This arch is currently not bootable directly from CD, and there's
# not a lot we can do about that. But add the needed files in the
# right place so that users can find them, at least:
#
# kernel(s)
# initramfs
# etc...
#
# The best wasy to find all the files is to parse d-i's MANIFEST file
# and work from there.
mkdir -p $CDDIR/$INSTALLDIR
cd $CDDIR/$INSTALLDIR
if [ ! "$DI_WWW_HOME" ];then
if [ ! "$DI_DIR" ];then
DI_DIR="$MIRROR/dists/$DI_DIST/main/installer-$ARCH/current/images"
fi
cp "$DI_DIR/MANIFEST" MANIFEST
else
$WGET "$DI_WWW_HOME/MANIFEST" -O MANIFEST
fi
for image in $(awk '{print $1}' MANIFEST); do
if [ ! -e "$image" ]; then
dir=$(dirname $image)
mkdir -p $dir
if [ -n "$LOCAL" -a -f "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" ]; then
cp "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" "$image"
elif [ ! "$DI_WWW_HOME" ];then
if [ ! "$DI_DIR" ];then
DI_DIR="$MIRROR/dists/$DI_DIST/main/installer-$ARCH/current/images"
fi
cp -a "$DI_DIR/$image" "$image"
else
$WGET --no-parent -r -nH --cut-dirs=3 "$DI_WWW_HOME/$image"
fi
fi
done
# Clean up in case we had to use $WGET :-(
find . -name 'index.html*' -delete
exit 0
# right place so that users can find them, at least
copy_arch_images

View File

@ -20,6 +20,7 @@ if [ "$DI_WWW_HOME" = "default" ];then
try_di_image_cache
fi
# Mips64el is currently not bootable in stretch, so bail out here
echo "Mips64el booting disabled, check Sledge"
exit 0
# This arch is currently not bootable directly from CD, and there's
# not a lot we can do about that. But add the needed files in the
# right place so that users can find them, at least
copy_arch_images

View File

@ -24,52 +24,7 @@ cd $CDROOT/..
add_mkisofs_opt $CDROOT/../$N.mkisofs_opts "-J -joliet-long"
# Mipsel is currently not bootable in stretch, so bail out here
echo "Mipsel booting disabled, check with Sledge or fjp"
exit 0
# Only disks 1 bootable
if [ $NN != 1 ]; then
exit 0
fi
DELODEB=$(find_pkg_file delo)
if [ -z "$DELODEB" ] ; then
echo "ERROR: the delo package is required." >&2
exit 1
fi
(dpkg --fsys-tarfile "$MIRROR/$DELODEB" | \
tar xf - -C . ./boot/delo.2nd)
mkdir -p $CDROOT/boot
mv boot/delo.2nd $CDROOT/boot/delo.2nd
if [ -n "$ARCHIVE_EXTRACTED_SOURCES" ]; then
echo $DELODEB >> $CDDIR/../$N.pkgs_extracted
find_pkg_file delo source >> $CDDIR/../$N.pkgs_extracted
fi
install -m 644 -D $BASEDIR/data/stretch/delo.conf "$CDROOT"/etc/delo.conf
if [ ! "$DI_WWW_HOME" ];then
if [ ! "$DI_DIR" ];then
DI_DIR="$MIRROR/dists/$DI_DIST/main/installer-$ARCH/current/images/decstation/cdrom/"
if [ ! -e $DI_DIR ] ; then
DI_DIR="$MIRROR/dists/$DI_DIST/main/installer-$ARCH/current/images/cdrom/"
fi
fi
else
DI_DIR="."
$WGET "$DI_WWW_HOME" -O di.dir
r3k=$(sed -n 's/.*a href="\(vmlinux-.*-r3k-kn02\)".*/\1/ip' di.dir)
r4k=$(sed -n 's/.*a href="\(vmlinux-.*-r4k-kn04\)".*/\1/ip' di.dir)
$WGET "$DI_WWW_HOME/$r3k" -O vmlinux-x-r3k-kn02
$WGET "$DI_WWW_HOME/$r4k" -O vmlinux-x-r4k-kn04
$WGET "$DI_WWW_HOME/initrd.gz"
fi
cp "$DI_DIR"/initrd.gz "$CDROOT/boot/initrd.gz"
cp "$DI_DIR"/vmlinux-*-r3k-kn02 "$CDROOT/boot/vmlinux-r3k-kn02"
cp "$DI_DIR"/vmlinux-*-r4k-kn04 "$CDROOT/boot/vmlinux-r4k-kn04"
add_mkisofs_opt $CDROOT/../$N.mkisofs_opts "-mipsel-boot boot/delo.2nd"
exit 0
# This arch is currently not bootable directly from CD, and there's
# not a lot we can do about that. But add the needed files in the
# right place so that users can find them, at least
copy_arch_images

View File

@ -104,6 +104,51 @@ try_di_image_cache() {
fi
}
# This arch is currently not bootable directly from CD, and there's
# not a lot we can do about that. But add the needed files in the
# right place so that users can find them, at least:
#
# kernel(s)
# initramfs
# DTBs
# etc...
#
# The best wasy to find all the files is to parse d-i's MANIFEST file
# and work from there.
copy_arch_images() {
mkdir -p $CDDIR/$INSTALLDIR
cd $CDDIR/$INSTALLDIR
if [ ! "$DI_WWW_HOME" ];then
if [ ! "$DI_DIR" ];then
DI_DIR="$MIRROR/dists/$DI_DIST/main/installer-$ARCH/current/images"
fi
cp "$DI_DIR/MANIFEST" MANIFEST
else
$WGET "$DI_WWW_HOME/MANIFEST" -O MANIFEST
fi
for image in $(awk '{print $1}' MANIFEST); do
if [ ! -e "$image" ]; then
dir=$(dirname $image)
mkdir -p $dir
if [ -n "$LOCAL" -a -f "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" ]; then
cp "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" "$image"
elif [ ! "$DI_WWW_HOME" ];then
if [ ! "$DI_DIR" ];then
DI_DIR="$MIRROR/dists/$DI_DIST/main/installer-$ARCH/current/images"
fi
cp -a "$DI_DIR/$image" "$image"
else
$WGET --no-parent -r -nH --cut-dirs=3 "$DI_WWW_HOME/$image"
fi
fi
done
# Clean up in case we had to use $WGET :-(
find . -name 'index.html*' -delete
}
# Grab the xorriso version and turn it into a number we can use
xorriso_version() {
$MKISOFS --version 2>&1 | awk '