livecd-rootfs/live-build/ubuntu-cpc/hooks/034-disk-image-ppc64el.binary
Dimitri John Ledkov 8cc7060c24 Import patches-unapplied version 2.408.20 to ubuntu/xenial-proposed
Imported using git-ubuntu import.

Changelog parent: d59199fe59fa2649ca5dccd2bc03df6de64d7274

New changelog entries:
  * Now that grub-related diversions have been factored out in 2.466
    instead of having bogus root=stuff arg generated in grub.cfg, it is
    actually empty. Therefore update the sed command to make the arg in
    the root= token optional. This should resolve non-booting livecd cpc
    images.
  [ Nishanth Aravamudan ]
  * live-build/ubuntu-cpc/hooks/061-open-iscsi.chroot: generate iSCSI
    Initiator Name at first iscsid run for cloud images to ensure it is
    unique (LP: #1444992).
  [ Steve Langasek ]
  * Improve teardown_mountpoint to recursively find all submounts and
    unmount them, instead of working from a hard-coded list.  This makes
    the code resilient against other submounts being added later, including
    downstream.  LP: #1721279.
  * Also nuke the sleep / udevadm settle calls in the process, which should
    never be required and slow down the builds.
  * Fix a reference to an undefined variable in a script that's set -u.
  * Use /bin/sh, not /bin/bash, for autopkgtest.
  * debian/tests/default-bootstraps: minor adjustments to shell syntax,
    syncing with artful where this originated.
  [ Steve Langasek, Balint Reczey ]
  * Introduce a new project-independent 'minimized' subproject
    (LP: #1721261):
    - omit ubuntu-minimal in favor of using only the minbase package set.
    - boot directly by partuuid, avoiding the use of an initramfs.
    - Bump needed live-build version which can build images without initrd
    - drop man pages and most of the documentation from minimized images
      (/usr/share/doc/*/copyright and changelog.Debian.gz files are still
      kept)
    - Add unminimize script for reverting minimization on a running system
    - Mention unminimize script in motd
    - Run autopkgtest for SUBPROJECT=minimized
    - If we're using SUBPROJECT=minimized, and tzdata is not installed,
      remove files that have been left behind.  This is a workaround for a
      bug that should be fixed in tzdata.
  * Factor out grub-related diversions and use them consistently, so we
    don't end up with wrong os-probe output in our grub.cfg.
  [ Balint Reczey ]
  * Mount using --make-rslave to ensure safe unmounts for rbind mounts
  * When SUBPROJECT environment variable is not set assume it to be ""
2017-10-19 23:03:14 +00:00

80 lines
1.7 KiB
Bash
Executable File

#!/bin/bash -eux
case $ARCH in
ppc64el|powerpc)
;;
*)
exit 0
;;
esac
. config/functions
create_partitions() {
disk_image="$1"
apt-get install -qqy gdisk
sgdisk "${disk_image}" \
--zap-all
sgdisk "${disk_image}" \
--new=2::+8M \
--new=1:
sgdisk "${disk_image}" -t 2:4100
sgdisk "${disk_image}" \
--print
}
install_grub() {
mkdir mountpoint
mount_partition "${rootfs_dev_mapper}" mountpoint
chroot mountpoint apt-get -qqy update
chroot mountpoint apt-get -qqy install grub2
chroot mountpoint apt-get -qqy remove --purge grub-legacy-ec2
# set the kernel commandline to use hvc0
mkdir -p mountpoint/etc/default/grub.d
cat << EOF > mountpoint/etc/default/grub.d/50-cloudimg-settings.cfg
${CLOUD_IMG_STR}
# Set the recordfail timeout
GRUB_RECORDFAIL_TIMEOUT=0
# Do not wait on grub prompt
GRUB_TIMEOUT=0
# Set the default commandline
GRUB_CMDLINE_LINUX_DEFAULT="console=hvc0 earlyprintk"
EOF
prep_partition="/dev/mapper${loop_device///dev/}p2"
chroot mountpoint grub-install "${prep_partition}" \
--no-nvram \
--boot-directory=/boot \
--target=powerpc-ieee1275
divert_grub mountpoint
chroot mountpoint update-grub
replace_grub_root_with_label mountpoint
undivert_grub mountpoint
umount_partition mountpoint
rmdir mountpoint
}
disk_image=binary/boot/disk.ext4
create_empty_disk_image "${disk_image}"
create_partitions "${disk_image}"
mount_image "${disk_image}" 1
# 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
install_grub
clean_loops
trap - EXIT