You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
livecd-rootfs/live-build/ubuntu-mini-iso/hooks/01-mini-iso.binary

85 lines
2.2 KiB

#!/bin/sh
set -eu
case $ARCH in
amd64)
;;
*)
exit 0
;;
esac
. config/binary
KERNEL=chroot/boot/vmlinuz
INITRD=chroot/boot/initrd.img
mkdir -p "chroot/etc/initramfs-tools/conf.d"
cat > chroot/etc/initramfs-tools/conf.d/casperize.conf <<EOF
export CASPER_GENERATE_UUID=1
EOF
chroot chroot update-initramfs -u
git clone https://git.launchpad.net/~ubuntu-cdimage/debian-cd/+git/ubuntu debian-cd
export BASEDIR=$(readlink -f debian-cd) DIST=$SUITE
cat > apt.conf <<EOF
Dir "$(pwd)/chroot";
EOF
case $ARCH in
amd64)
mkdir -p "ubuntu-mini-iso/amd64/tree/casper"
cp "$KERNEL" ubuntu-mini-iso/amd64/tree/casper/filesystem.kernel-generic
cp "$INITRD" ubuntu-mini-iso/amd64/tree/casper/filesystem.initrd-generic
APT_CONFIG_amd64=$(pwd)/apt.conf $BASEDIR/tools/boot/$SUITE/boot-amd64 1 $(readlink -f ubuntu-mini-iso/amd64/tree)
# Overwrite the grub.cfg that debian-cd generates by default
cat > ubuntu-mini-iso/amd64/tree/boot/grub/grub.cfg <<EOF
menuentry "Choose an Ubuntu version to install" {
set gfxpayload=keep
linux /casper/vmlinuz iso-chooser-menu ip=dhcp ---
initrd /casper/initrd
}
EOF
rm -f ubuntu-mini-iso/amd64/tree/boot/grub/loopback.cfg ubuntu-mini-iso/amd64/tree/boot/memtest*.bin
;;
esac
mkdir -p ubuntu-mini-iso/$ARCH/tree/.disk
touch ubuntu-mini-iso/$ARCH/tree/.disk/base_installable
tmpdir=$(mktemp -d)
unmkinitramfs $INITRD $tmpdir
if [ -e "$tmpdir/main/conf/uuid.conf" ]; then
uuid_conf="$tmpdir/main/conf/uuid.conf"
elif [ -e "$tmpdir/conf/uuid.conf" ]; then
uuid_conf="$tmpdir/conf/uuid.conf"
else
echo "uuid.conf not found"
exit 1
fi
cp "$uuid_conf" ubuntu-mini-iso/$ARCH/tree/.disk/casper-uuid-generic
rm -fr $tmpdir
cat > ubuntu-mini-iso/$ARCH/tree/.disk/cd_type <<EOF
full_cd/single
EOF
version=$(distro-info --fullname --series=$LB_DISTRIBUTION \
| sed s'/^Ubuntu/ubuntu-mini-iso/')
cat > ubuntu-mini-iso/$ARCH/tree/.disk/info <<EOF
$version - $ARCH ($BUILDSTAMP)
EOF
dest="${PWD}/livecd.${PROJECT}.iso"
cd ubuntu-mini-iso/$ARCH
xorriso -as mkisofs $(cat 1.mkisofs_opts) tree -o $dest
cd ../..
rm -rf ubuntu-mini-iso