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.
ubuntu/yakkety
Steve Langasek 9 years ago
parent cb58e88614
commit 7ec8dd87ac

5
debian/changelog vendored

@ -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 <lukasz.zemczak@ubuntu.com> Thu, 04 Feb 2016 17:31:18 +0100

@ -1,7 +1,5 @@
#!/bin/sh -ex
ARCH=$(dpkg --print-architecture)
case $ARCH in
i386|amd64)
dpkg-divert --quiet --add \

@ -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

@ -2,7 +2,7 @@
set -e
case "$(dpkg --print-architecture)" in
case $ARCH in
arm*)
mkdir -p /boot/uboot
cat > /etc/fw_env.config <<EOF

@ -1,7 +1,5 @@
#! /bin/sh -ex
ARCH=$(dpkg --print-architecture)
case $ARCH in
i386|amd64)
rm -f /usr/sbin/grub-install

@ -1,8 +1,6 @@
#!/bin/sh
set -e
ARCH=$(dpkg --print-architecture)
dpkg-divert --quiet --add --divert /bin/sync.REAL --rename /bin/sync
cat > /bin/sync <<'EOF'
#! /bin/sh

@ -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

@ -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}"

@ -1,6 +1,5 @@
#!/bin/bash -eux
architecture=$(chroot chroot dpkg --print-architecture)
if [ "$architecture" != "ppc64el" ]; then
if [ "$ARCH" != "ppc64el" ]; then
exit 0
fi

@ -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

@ -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

@ -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

@ -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"

@ -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/

@ -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

Loading…
Cancel
Save