Refactor functions out of ubuntu-cpc and ubuntu-server hooks.

ubuntu/zesty
Mathieu Trudel-Lapierre 8 years ago
parent 292c5f300c
commit 46fd6c58f5

1
debian/changelog vendored

@ -1,6 +1,7 @@
livecd-rootfs (2.441) UNRELEASED; urgency=medium livecd-rootfs (2.441) UNRELEASED; urgency=medium
* Add ubuntu-server-live for a subiquity-based server image. * Add ubuntu-server-live for a subiquity-based server image.
* Refactor functions out of ubuntu-cpc and ubuntu-server hooks.
-- Mathieu Trudel-Lapierre <cyphermox@ubuntu.com> Thu, 23 Mar 2017 16:20:16 -0400 -- Mathieu Trudel-Lapierre <cyphermox@ubuntu.com> Thu, 23 Mar 2017 16:20:16 -0400

@ -1,7 +1,7 @@
# vi: ts=4 expandtab syntax=sh # vi: ts=4 expandtab syntax=sh
CLOUD_IMG_STR="# CLOUD_IMG: This file was created/modified by the Cloud Image build process" imagesize=${IMAGE_SIZE:-$((2252*1024**2))} # 2.2G (the current size we ship)
IMAGE_SIZE=$((2252*1024**2)) # 2.2G (the current size we ship) fs_label="${FS_LABEL:-rootfs}"
rootfs_dev_mapper= rootfs_dev_mapper=
loop_device= loop_device=
@ -28,13 +28,13 @@ clean_loops() {
create_empty_disk_image() { create_empty_disk_image() {
# Prepare an empty disk image # Prepare an empty disk image
dd if=/dev/zero of="$1" bs=1 count=0 seek="${IMAGE_SIZE}" dd if=/dev/zero of="$1" bs=1 count=0 seek="${imagesize}"
} }
make_ext4_partition() { make_ext4_partition() {
device="$1" device="$1"
label=${fs_label:+-L "${fs_label}"}
mkfs.ext4 -F -b 4096 -i 8192 -m 0 -L cloudimg-rootfs -E resize=536870912 "$device" mkfs.ext4 -F -b 4096 -i 8192 -m 0 ${label} -E resize=536870912 "$device"
} }
mount_image() { mount_image() {
@ -103,7 +103,7 @@ mount_disk_image() {
# such as updating grub and installing software # such as updating grub and installing software
cat > $mountpoint/usr/sbin/policy-rc.d << EOF cat > $mountpoint/usr/sbin/policy-rc.d << EOF
#!/bin/sh #!/bin/sh
# ${CLOUD_IMG_STR} # ${IMAGE_STR}
echo "All runlevel operations denied by policy" >&2 echo "All runlevel operations denied by policy" >&2
exit 101 exit 101
EOF EOF
@ -251,9 +251,9 @@ convert_to_qcow2() {
replace_grub_root_with_label() { replace_grub_root_with_label() {
# When update-grub is run, it will detect the disks in the build system. # When update-grub is run, it will detect the disks in the build system.
# Instead, we want grub to use the cloudimg-rootfs labelled disk # Instead, we want grub to use the right labelled disk
CHROOT_ROOT="$1" CHROOT_ROOT="$1"
sed -i -e "s,root=[^ ]\+,root=LABEL=cloudimg-rootfs," \ sed -i -e "s,root=[^ ]\+,root=LABEL=${fs_label}," \
"$CHROOT_ROOT/boot/grub/grub.cfg" "$CHROOT_ROOT/boot/grub/grub.cfg"
} }

@ -1,6 +1,9 @@
#!/bin/bash -ex #!/bin/bash -ex
. /build/config/functions IMAGE_STR="# CLOUD_IMG: This file was created/modified by the Cloud Image build process"
FS_LABEL="cloudimg-rootfs"
. auto/functions
BOOTPART_START= BOOTPART_START=
BOOTPART_END= BOOTPART_END=

@ -17,7 +17,7 @@ if [ -n "$SUBARCH" ]; then
exit 0 exit 0
fi fi
. /build/config/functions . auto/functions
mkdir binary/boot/squashfs.dir mkdir binary/boot/squashfs.dir
cp -a chroot/* binary/boot/squashfs.dir cp -a chroot/* binary/boot/squashfs.dir

@ -9,7 +9,10 @@ case $ARCH in
;; ;;
esac esac
. /build/config/functions IMAGE_STR="# CLOUD_IMG: This file was created/modified by the Cloud Image build process"
FS_LABEL="cloudimg-rootfs"
. auto/functions
apt-get -qqy install dosfstools gdisk apt-get -qqy install dosfstools gdisk

@ -7,7 +7,10 @@ case $ARCH in
;; ;;
esac esac
. /build/config/functions IMAGE_STR="# CLOUD_IMG: This file was created/modified by the Cloud Image build process"
FS_LABEL="cloudimg-rootfs"
. auto/functions
create_partitions() { create_partitions() {
disk_image="$1" disk_image="$1"

@ -21,7 +21,7 @@ esac
apt-get install -qqy qemu-utils apt-get install -qqy qemu-utils
. /build/config/functions . auto/functions
if [ -f binary/boot/disk-uefi.ext4 ]; then if [ -f binary/boot/disk-uefi.ext4 ]; then
convert_to_qcow2 binary/boot/disk-uefi.ext4 livecd.ubuntu-cpc.img convert_to_qcow2 binary/boot/disk-uefi.ext4 livecd.ubuntu-cpc.img

@ -18,7 +18,7 @@ case ${IMAGE_TARGETS:-} in
;; ;;
esac esac
. /build/config/functions . auto/functions
if [ -e binary/boot/disk-uefi.ext4 ]; then if [ -e binary/boot/disk-uefi.ext4 ]; then
create_vmdk binary/boot/disk-uefi.ext4 livecd.ubuntu-cpc.vmdk create_vmdk binary/boot/disk-uefi.ext4 livecd.ubuntu-cpc.vmdk

@ -44,7 +44,7 @@ case $ARCH in
exit 0;; exit 0;;
esac esac
. /build/config/functions . auto/functions
# Virtualbox is needed for making a small VMDK # Virtualbox is needed for making a small VMDK
apt-get -qqy install genisoimage qemu-utils apt-get -qqy install genisoimage qemu-utils

@ -9,7 +9,7 @@ if [ ! -d ${my_dir}/extra ]; then
fi fi
# Export the common functions to the extras # Export the common functions to the extras
. /build/config/functions . auto/functions
# Cleaner execution # Cleaner execution
/bin/run-parts --regex ".*\.binary" "${extra_d}" /bin/run-parts --regex ".*\.binary" "${extra_d}"

@ -1 +0,0 @@
../ubuntu-cpc/functions

@ -20,7 +20,7 @@ if [ -n "$SUBARCH" ]; then
exit 0 exit 0
fi fi
. /build/config/functions . auto/functions
mkdir binary/boot/squashfs.dir mkdir binary/boot/squashfs.dir
cp -a chroot/* binary/boot/squashfs.dir cp -a chroot/* binary/boot/squashfs.dir

@ -21,7 +21,7 @@ if [ -n "$SUBARCH" ]; then
exit 0 exit 0
fi fi
. /build/config/functions . auto/functions
SQUASH_ROOT=binary/boot/squashfs.dir SQUASH_ROOT=binary/boot/squashfs.dir
OVERLAY_ROOT=binary/boot/overlay.dir OVERLAY_ROOT=binary/boot/overlay.dir

Loading…
Cancel
Save