mirror of
https://git.launchpad.net/livecd-rootfs
synced 2025-07-06 22:41:30 +00:00
[ Steve Langasek ] * Refactor/reorder ubuntu-cpc support for consistency with other flavors, so that subarch overrides can be applied correctly. [ Ben Howard ] * ubuntu-cpc: - fixed loop setup due to change of kpartx output - only use grub-install logic for Intel architectures
60 lines
1.5 KiB
Bash
60 lines
1.5 KiB
Bash
#!/bin/bash -eux
|
|
architecture=$(chroot chroot dpkg --print-architecture)
|
|
if [ "$architecture" = "ppc64el" ]; then
|
|
echo "ppc64el disk images are handled separately"
|
|
exit 0
|
|
fi
|
|
|
|
. /build/config/functions
|
|
|
|
create_empty_partition() {
|
|
apt-get install -qqy parted
|
|
parted_prefix="parted $1 --script --"
|
|
|
|
${parted_prefix} mklabel msdos
|
|
${parted_prefix} mkpart primary 1 -1
|
|
${parted_prefix} set 1 B
|
|
${parted_prefix} print
|
|
${parted_prefix} align-check opt 1
|
|
}
|
|
|
|
disk_image=binary/boot/disk.ext4
|
|
|
|
create_empty_disk_image "${disk_image}"
|
|
create_empty_partition "${disk_image}"
|
|
mount_image "${disk_image}"
|
|
|
|
# Copy the chroot in to the disk
|
|
make_ext4_partition "${rootfs_dev_mapper}"
|
|
mkdir mountpoint
|
|
mount "${rootfs_dev_mapper}" mountpoint
|
|
cp -a chroot/* mountpoint/
|
|
umount mountpoint
|
|
rmdir mountpoint
|
|
|
|
case $architecture in
|
|
amd64|i386) should_install_grub=1;;
|
|
*) should_install_grub=0;;
|
|
esac
|
|
|
|
if [ "${should_install_grub}" -eq 1 ]; then
|
|
mkdir mountpoint
|
|
mount_partition "${rootfs_dev_mapper}" mountpoint
|
|
|
|
echo "(hd0) ${loop_device}" > mountpoint/tmp/device.map
|
|
chroot mountpoint grub-install ${loop_device}
|
|
chroot mountpoint grub-bios-setup \
|
|
--boot-image=i386-pc/boot.img \
|
|
--core-image=i386-pc/core.img \
|
|
--skip-fs-probe \
|
|
--device-map=/tmp/device.map \
|
|
${loop_device}
|
|
|
|
rm mountpoint/tmp/device.map
|
|
umount_partition mountpoint
|
|
rmdir mountpoint
|
|
fi
|
|
|
|
clean_loops
|
|
trap - EXIT
|