diff --git a/debian/changelog b/debian/changelog index ca8b0ddd..1e9bf317 100644 --- a/debian/changelog +++ b/debian/changelog @@ -13,6 +13,11 @@ livecd-rootfs (2.376) UNRELEASED; urgency=medium actually warranted in the normal case. * If a subarch is specified for a cloud image build, don't build rootfs artifacts; these should come from the 'generic' build. + * Fix architecture handling in hooks. We know we're always being invoked + from a launchpad-buildd-like setup, which passes ARCH and SUBARCH in the + environment, because auto/config and auto/build both rely on this. So + don't scatter dpkg --print-architecture calls throughout, especially + when many of these are not cross-build-aware. -- Ɓukasz 'sil2100' Zemczak Thu, 04 Feb 2016 17:31:18 +0100 diff --git a/live-build/ubuntu-core/hooks/01-divert-grub-install.chroot_early b/live-build/ubuntu-core/hooks/01-divert-grub-install.chroot_early index d6fbd500..5e7f0519 100755 --- a/live-build/ubuntu-core/hooks/01-divert-grub-install.chroot_early +++ b/live-build/ubuntu-core/hooks/01-divert-grub-install.chroot_early @@ -1,7 +1,5 @@ #!/bin/sh -ex -ARCH=$(dpkg --print-architecture) - case $ARCH in i386|amd64) dpkg-divert --quiet --add \ diff --git a/live-build/ubuntu-core/hooks/12-add-foreign-libc6.chroot b/live-build/ubuntu-core/hooks/12-add-foreign-libc6.chroot index 5f86911d..81200ec5 100644 --- a/live-build/ubuntu-core/hooks/12-add-foreign-libc6.chroot +++ b/live-build/ubuntu-core/hooks/12-add-foreign-libc6.chroot @@ -4,7 +4,7 @@ set -ex echo "I: Checking if we are amd64 and libc6:i386 should be installed" -if [ "$(dpkg --print-architecture)" = "amd64" ]; then +if [ "$ARCH" = "amd64" ]; then echo "I: Enabling i386 multiarch support on amd64" dpkg --add-architecture i386 diff --git a/live-build/ubuntu-core/hooks/16-ensure-uboot.chroot b/live-build/ubuntu-core/hooks/16-ensure-uboot.chroot index 4a9a5c91..ae412fd2 100644 --- a/live-build/ubuntu-core/hooks/16-ensure-uboot.chroot +++ b/live-build/ubuntu-core/hooks/16-ensure-uboot.chroot @@ -2,7 +2,7 @@ set -e -case "$(dpkg --print-architecture)" in +case $ARCH in arm*) mkdir -p /boot/uboot cat > /etc/fw_env.config < /bin/sync <<'EOF' #! /bin/sh diff --git a/live-build/ubuntu-cpc/hooks/032-disk-image.binary b/live-build/ubuntu-cpc/hooks/032-disk-image.binary index fe6f1c71..95324ec6 100755 --- a/live-build/ubuntu-cpc/hooks/032-disk-image.binary +++ b/live-build/ubuntu-cpc/hooks/032-disk-image.binary @@ -1,9 +1,10 @@ #!/bin/bash -eux -architecture=$(chroot chroot dpkg --print-architecture) -if [ "$architecture" = "ppc64el" ]; then - echo "ppc64el disk images are handled separately" - exit 0 -fi +case $ARCH in + ppc64el) + echo "ppc64el disk images are handled separately" + exit 0 + ;; +esac . /build/config/functions diff --git a/live-build/ubuntu-cpc/hooks/033-disk-image-uefi.binary b/live-build/ubuntu-cpc/hooks/033-disk-image-uefi.binary index 88530c6e..c84b4bab 100755 --- a/live-build/ubuntu-cpc/hooks/033-disk-image-uefi.binary +++ b/live-build/ubuntu-cpc/hooks/033-disk-image-uefi.binary @@ -1,11 +1,10 @@ #!/bin/bash -eux -architecture=$(chroot chroot dpkg --print-architecture) -case $architecture in +case $ARCH in amd64|arm64) ;; *) - echo "We don't create EFI images for $architecture." + echo "We don't create EFI images for $ARCH." exit 0 ;; esac @@ -17,7 +16,7 @@ apt-get -qqy install dosfstools gdisk create_partitions() { disk_image="$1" sgdisk "${disk_image}" --zap-all - case $architecture in + case $ARCH in arm64) sgdisk "${disk_image}" \ --new=15:0:204800 \ @@ -62,7 +61,7 @@ install_grub() { efi_boot_dir="/boot/efi/EFI/BOOT" chroot mountpoint mkdir -p "${efi_boot_dir}" - case $architecture in + case $ARCH in arm64) chroot mountpoint apt-get -qqy install --no-install-recommends grub-efi-arm64 grub-efi-arm64-bin grub_modules="part_gpt fat gzio ext2 normal chain boot configfile linux search_fs_uuid search_label terminal serial video video_fb efi_gop" @@ -101,7 +100,7 @@ EOF chroot mountpoint cp /boot/efi/EFI/BOOT/grub.cfg /boot/efi/boot/grub fi - if [ $architecture = "amd64" ]; then + if [ "$ARCH" = "amd64" ]; then # Install the BIOS/GPT bits. Since GPT boots from the ESP partition, # it means that we just run this simple command and we're done chroot mountpoint grub-install --target=i386-pc "${loop_device}" diff --git a/live-build/ubuntu-cpc/hooks/034-disk-image-ppc64el.binary b/live-build/ubuntu-cpc/hooks/034-disk-image-ppc64el.binary index 107dfd3d..e5d56664 100755 --- a/live-build/ubuntu-cpc/hooks/034-disk-image-ppc64el.binary +++ b/live-build/ubuntu-cpc/hooks/034-disk-image-ppc64el.binary @@ -1,6 +1,5 @@ #!/bin/bash -eux -architecture=$(chroot chroot dpkg --print-architecture) -if [ "$architecture" != "ppc64el" ]; then +if [ "$ARCH" != "ppc64el" ]; then exit 0 fi diff --git a/live-build/ubuntu-cpc/hooks/040-vmdk-image.binary b/live-build/ubuntu-cpc/hooks/040-vmdk-image.binary index 7345bf4e..80e4142c 100755 --- a/live-build/ubuntu-cpc/hooks/040-vmdk-image.binary +++ b/live-build/ubuntu-cpc/hooks/040-vmdk-image.binary @@ -3,13 +3,11 @@ # # Generate VMDK files -architecture=$(chroot chroot dpkg --print-architecture) - extension="disk1.vmdk" -case ${architecture} in +case $ARCH in i386|amd64) ;; - *) echo "VMDK images are not supported for ${architecture} yet."; + *) echo "VMDK images are not supported for $ARCH yet."; exit 0;; esac diff --git a/live-build/ubuntu-cpc/hooks/041-vmdk-ova-image.binary b/live-build/ubuntu-cpc/hooks/041-vmdk-ova-image.binary index 4123a501..c48ca75b 100755 --- a/live-build/ubuntu-cpc/hooks/041-vmdk-ova-image.binary +++ b/live-build/ubuntu-cpc/hooks/041-vmdk-ova-image.binary @@ -9,18 +9,16 @@ # # For this step, we re-use the VMDK's made in 040-vmdk-image.binary -architecture=$(chroot chroot dpkg --print-architecture) - -case ${architecture} in +case $ARCH in amd64|i386) ;; - *) echo "OVA images are not supported for ${architecture} yet."; + *) echo "OVA images are not supported for $ARCH yet."; exit 0;; esac cur_d=${PWD} my_d=$(dirname $(readlink -f ${0})) base_vmdk="livecd.ubuntu-cpc.disk1.vmdk" -if [ $architecture = "amd64" ]; then +if [ "$ARCH" = "amd64" ]; then base_vmdk="livecd.ubuntu-cpc.uefi.vmdk" fi diff --git a/live-build/ubuntu-cpc/hooks/042-vagrant.binary b/live-build/ubuntu-cpc/hooks/042-vagrant.binary index 22d359e7..6bf40dc3 100755 --- a/live-build/ubuntu-cpc/hooks/042-vagrant.binary +++ b/live-build/ubuntu-cpc/hooks/042-vagrant.binary @@ -15,13 +15,16 @@ cur_d=${PWD} my_d=$(dirname $(readlink -f ${0})) -architecture=$(chroot chroot dpkg --print-architecture) base_vmdk="livecd.ubuntu-cpc.disk1.vmdk" -if [[ ! "${architecture}" =~ (amd64|i386) ]]; then - echo "Vagrant images are not supported for ${architecture}" - exit 0 -elif [ ! -e ${base_vmdk} ]; then +case $ARCH in + amd64|i386) ;; + *) + echo "Vagrant images are not supported for $ARCH" + exit 0 +esac + +if [ ! -e ${base_vmdk} ]; then echo "Did not find VMDK to produce Vagrant images." exit 0 fi diff --git a/live-build/ubuntu-cpc/hooks/999-cpc-fixes.chroot b/live-build/ubuntu-cpc/hooks/999-cpc-fixes.chroot index 63ed7d5b..a83ae2ea 100755 --- a/live-build/ubuntu-cpc/hooks/999-cpc-fixes.chroot +++ b/live-build/ubuntu-cpc/hooks/999-cpc-fixes.chroot @@ -18,8 +18,6 @@ _xchroot() { } #### COMMON architecture independent functions -arch=$(_xchroot "${rootd}" dpkg --print-architecture) - add_serial_console() { condev=$1 idir="$rootd/etc/init" @@ -127,7 +125,7 @@ fi #### END COMMON ARCH FUNCTIONS -case $arch in +case $ARCH in # ARM images are special armhf|arm64) echo "Configuring ARM Serial Port" diff --git a/live-build/ubuntu-desktop-next/hooks/500-move-kernel-to-device-tar.binary b/live-build/ubuntu-desktop-next/hooks/500-move-kernel-to-device-tar.binary index 9afe61db..33e70ab4 100644 --- a/live-build/ubuntu-desktop-next/hooks/500-move-kernel-to-device-tar.binary +++ b/live-build/ubuntu-desktop-next/hooks/500-move-kernel-to-device-tar.binary @@ -8,7 +8,6 @@ echo "I: Moving kernel into device tarball" HERE="$(pwd)" TMPDIR="$(mktemp -d)" -ARCH=$(dpkg --print-architecture) mkdir -p $TMPDIR/system/ mkdir -p $TMPDIR/assets/ diff --git a/live-build/ubuntu-touch/hooks/60-install-click.chroot b/live-build/ubuntu-touch/hooks/60-install-click.chroot index a8b3b692..c636b801 100755 --- a/live-build/ubuntu-touch/hooks/60-install-click.chroot +++ b/live-build/ubuntu-touch/hooks/60-install-click.chroot @@ -20,12 +20,10 @@ tmpdir="$(mktemp -d)" cleanup () { rm -rf "$tmpdir"; } trap cleanup EXIT -CLICKARCH=$(dpkg --print-architecture) - wget --no-verbose -O "$tmpdir/click_list" "$click_list" for package in $(cat "$tmpdir/click_list") do - if echo $package | egrep -q "_$CLICKARCH.click|_all.click|_unknown.click|_multi.click"; then + if echo $package | egrep -q "_$ARCH.click|_all.click|_unknown.click|_multi.click"; then echo "Setting up $package" wget --no-verbose -O "$tmpdir/$package" "$click_uri/$package" # FIXME: first attempt, a hard-coded list of the packages that go to