mirror of
https://git.launchpad.net/livecd-rootfs
synced 2025-06-05 23:21:34 +00:00
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.
This commit is contained in:
parent
cb58e88614
commit
7ec8dd87ac
5
debian/changelog
vendored
5
debian/changelog
vendored
@ -13,6 +13,11 @@ livecd-rootfs (2.376) UNRELEASED; urgency=medium
|
|||||||
actually warranted in the normal case.
|
actually warranted in the normal case.
|
||||||
* If a subarch is specified for a cloud image build, don't build rootfs
|
* If a subarch is specified for a cloud image build, don't build rootfs
|
||||||
artifacts; these should come from the 'generic' build.
|
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
|
-- Łukasz 'sil2100' Zemczak <lukasz.zemczak@ubuntu.com> Thu, 04 Feb 2016 17:31:18 +0100
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
#!/bin/sh -ex
|
#!/bin/sh -ex
|
||||||
|
|
||||||
ARCH=$(dpkg --print-architecture)
|
|
||||||
|
|
||||||
case $ARCH in
|
case $ARCH in
|
||||||
i386|amd64)
|
i386|amd64)
|
||||||
dpkg-divert --quiet --add \
|
dpkg-divert --quiet --add \
|
||||||
|
@ -4,7 +4,7 @@ set -ex
|
|||||||
|
|
||||||
echo "I: Checking if we are amd64 and libc6:i386 should be installed"
|
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"
|
echo "I: Enabling i386 multiarch support on amd64"
|
||||||
dpkg --add-architecture i386
|
dpkg --add-architecture i386
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
case "$(dpkg --print-architecture)" in
|
case $ARCH in
|
||||||
arm*)
|
arm*)
|
||||||
mkdir -p /boot/uboot
|
mkdir -p /boot/uboot
|
||||||
cat > /etc/fw_env.config <<EOF
|
cat > /etc/fw_env.config <<EOF
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
#! /bin/sh -ex
|
#! /bin/sh -ex
|
||||||
|
|
||||||
ARCH=$(dpkg --print-architecture)
|
|
||||||
|
|
||||||
case $ARCH in
|
case $ARCH in
|
||||||
i386|amd64)
|
i386|amd64)
|
||||||
rm -f /usr/sbin/grub-install
|
rm -f /usr/sbin/grub-install
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
ARCH=$(dpkg --print-architecture)
|
|
||||||
|
|
||||||
dpkg-divert --quiet --add --divert /bin/sync.REAL --rename /bin/sync
|
dpkg-divert --quiet --add --divert /bin/sync.REAL --rename /bin/sync
|
||||||
cat > /bin/sync <<'EOF'
|
cat > /bin/sync <<'EOF'
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
#!/bin/bash -eux
|
#!/bin/bash -eux
|
||||||
architecture=$(chroot chroot dpkg --print-architecture)
|
case $ARCH in
|
||||||
if [ "$architecture" = "ppc64el" ]; then
|
ppc64el)
|
||||||
echo "ppc64el disk images are handled separately"
|
echo "ppc64el disk images are handled separately"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
. /build/config/functions
|
. /build/config/functions
|
||||||
|
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
#!/bin/bash -eux
|
#!/bin/bash -eux
|
||||||
|
|
||||||
architecture=$(chroot chroot dpkg --print-architecture)
|
case $ARCH in
|
||||||
case $architecture in
|
|
||||||
amd64|arm64)
|
amd64|arm64)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "We don't create EFI images for $architecture."
|
echo "We don't create EFI images for $ARCH."
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@ -17,7 +16,7 @@ apt-get -qqy install dosfstools gdisk
|
|||||||
create_partitions() {
|
create_partitions() {
|
||||||
disk_image="$1"
|
disk_image="$1"
|
||||||
sgdisk "${disk_image}" --zap-all
|
sgdisk "${disk_image}" --zap-all
|
||||||
case $architecture in
|
case $ARCH in
|
||||||
arm64)
|
arm64)
|
||||||
sgdisk "${disk_image}" \
|
sgdisk "${disk_image}" \
|
||||||
--new=15:0:204800 \
|
--new=15:0:204800 \
|
||||||
@ -62,7 +61,7 @@ install_grub() {
|
|||||||
efi_boot_dir="/boot/efi/EFI/BOOT"
|
efi_boot_dir="/boot/efi/EFI/BOOT"
|
||||||
chroot mountpoint mkdir -p "${efi_boot_dir}"
|
chroot mountpoint mkdir -p "${efi_boot_dir}"
|
||||||
|
|
||||||
case $architecture in
|
case $ARCH in
|
||||||
arm64)
|
arm64)
|
||||||
chroot mountpoint apt-get -qqy install --no-install-recommends grub-efi-arm64 grub-efi-arm64-bin
|
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"
|
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
|
chroot mountpoint cp /boot/efi/EFI/BOOT/grub.cfg /boot/efi/boot/grub
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $architecture = "amd64" ]; then
|
if [ "$ARCH" = "amd64" ]; then
|
||||||
# Install the BIOS/GPT bits. Since GPT boots from the ESP partition,
|
# 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
|
# it means that we just run this simple command and we're done
|
||||||
chroot mountpoint grub-install --target=i386-pc "${loop_device}"
|
chroot mountpoint grub-install --target=i386-pc "${loop_device}"
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#!/bin/bash -eux
|
#!/bin/bash -eux
|
||||||
architecture=$(chroot chroot dpkg --print-architecture)
|
if [ "$ARCH" != "ppc64el" ]; then
|
||||||
if [ "$architecture" != "ppc64el" ]; then
|
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -3,13 +3,11 @@
|
|||||||
#
|
#
|
||||||
# Generate VMDK files
|
# Generate VMDK files
|
||||||
|
|
||||||
architecture=$(chroot chroot dpkg --print-architecture)
|
|
||||||
|
|
||||||
extension="disk1.vmdk"
|
extension="disk1.vmdk"
|
||||||
|
|
||||||
case ${architecture} in
|
case $ARCH in
|
||||||
i386|amd64) ;;
|
i386|amd64) ;;
|
||||||
*) echo "VMDK images are not supported for ${architecture} yet.";
|
*) echo "VMDK images are not supported for $ARCH yet.";
|
||||||
exit 0;;
|
exit 0;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -9,18 +9,16 @@
|
|||||||
#
|
#
|
||||||
# For this step, we re-use the VMDK's made in 040-vmdk-image.binary
|
# For this step, we re-use the VMDK's made in 040-vmdk-image.binary
|
||||||
|
|
||||||
architecture=$(chroot chroot dpkg --print-architecture)
|
case $ARCH in
|
||||||
|
|
||||||
case ${architecture} in
|
|
||||||
amd64|i386) ;;
|
amd64|i386) ;;
|
||||||
*) echo "OVA images are not supported for ${architecture} yet.";
|
*) echo "OVA images are not supported for $ARCH yet.";
|
||||||
exit 0;;
|
exit 0;;
|
||||||
esac
|
esac
|
||||||
cur_d=${PWD}
|
cur_d=${PWD}
|
||||||
my_d=$(dirname $(readlink -f ${0}))
|
my_d=$(dirname $(readlink -f ${0}))
|
||||||
|
|
||||||
base_vmdk="livecd.ubuntu-cpc.disk1.vmdk"
|
base_vmdk="livecd.ubuntu-cpc.disk1.vmdk"
|
||||||
if [ $architecture = "amd64" ]; then
|
if [ "$ARCH" = "amd64" ]; then
|
||||||
base_vmdk="livecd.ubuntu-cpc.uefi.vmdk"
|
base_vmdk="livecd.ubuntu-cpc.uefi.vmdk"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -15,13 +15,16 @@
|
|||||||
cur_d=${PWD}
|
cur_d=${PWD}
|
||||||
my_d=$(dirname $(readlink -f ${0}))
|
my_d=$(dirname $(readlink -f ${0}))
|
||||||
|
|
||||||
architecture=$(chroot chroot dpkg --print-architecture)
|
|
||||||
base_vmdk="livecd.ubuntu-cpc.disk1.vmdk"
|
base_vmdk="livecd.ubuntu-cpc.disk1.vmdk"
|
||||||
|
|
||||||
if [[ ! "${architecture}" =~ (amd64|i386) ]]; then
|
case $ARCH in
|
||||||
echo "Vagrant images are not supported for ${architecture}"
|
amd64|i386) ;;
|
||||||
|
*)
|
||||||
|
echo "Vagrant images are not supported for $ARCH"
|
||||||
exit 0
|
exit 0
|
||||||
elif [ ! -e ${base_vmdk} ]; then
|
esac
|
||||||
|
|
||||||
|
if [ ! -e ${base_vmdk} ]; then
|
||||||
echo "Did not find VMDK to produce Vagrant images."
|
echo "Did not find VMDK to produce Vagrant images."
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
@ -18,8 +18,6 @@ _xchroot() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#### COMMON architecture independent functions
|
#### COMMON architecture independent functions
|
||||||
arch=$(_xchroot "${rootd}" dpkg --print-architecture)
|
|
||||||
|
|
||||||
add_serial_console() {
|
add_serial_console() {
|
||||||
condev=$1
|
condev=$1
|
||||||
idir="$rootd/etc/init"
|
idir="$rootd/etc/init"
|
||||||
@ -127,7 +125,7 @@ fi
|
|||||||
#### END COMMON ARCH FUNCTIONS
|
#### END COMMON ARCH FUNCTIONS
|
||||||
|
|
||||||
|
|
||||||
case $arch in
|
case $ARCH in
|
||||||
# ARM images are special
|
# ARM images are special
|
||||||
armhf|arm64)
|
armhf|arm64)
|
||||||
echo "Configuring ARM Serial Port"
|
echo "Configuring ARM Serial Port"
|
||||||
|
@ -8,7 +8,6 @@ echo "I: Moving kernel into device tarball"
|
|||||||
|
|
||||||
HERE="$(pwd)"
|
HERE="$(pwd)"
|
||||||
TMPDIR="$(mktemp -d)"
|
TMPDIR="$(mktemp -d)"
|
||||||
ARCH=$(dpkg --print-architecture)
|
|
||||||
mkdir -p $TMPDIR/system/
|
mkdir -p $TMPDIR/system/
|
||||||
mkdir -p $TMPDIR/assets/
|
mkdir -p $TMPDIR/assets/
|
||||||
|
|
||||||
|
@ -20,12 +20,10 @@ tmpdir="$(mktemp -d)"
|
|||||||
cleanup () { rm -rf "$tmpdir"; }
|
cleanup () { rm -rf "$tmpdir"; }
|
||||||
trap cleanup EXIT
|
trap cleanup EXIT
|
||||||
|
|
||||||
CLICKARCH=$(dpkg --print-architecture)
|
|
||||||
|
|
||||||
wget --no-verbose -O "$tmpdir/click_list" "$click_list"
|
wget --no-verbose -O "$tmpdir/click_list" "$click_list"
|
||||||
for package in $(cat "$tmpdir/click_list")
|
for package in $(cat "$tmpdir/click_list")
|
||||||
do
|
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"
|
echo "Setting up $package"
|
||||||
wget --no-verbose -O "$tmpdir/$package" "$click_uri/$package"
|
wget --no-verbose -O "$tmpdir/$package" "$click_uri/$package"
|
||||||
# FIXME: first attempt, a hard-coded list of the packages that go to
|
# FIXME: first attempt, a hard-coded list of the packages that go to
|
||||||
|
Loading…
x
Reference in New Issue
Block a user