mirror of
https://git.launchpad.net/livecd-rootfs
synced 2025-05-11 02:41:33 +00:00
ubuntu-cpc: Refactor for consistency & fix grub-install logic
[ Steve Langasek ] * Refactor/reorder ubuntu-cpc support for consistency with other flavors, so that subarch overrides can be applied correctly. [ Ben Howard ] * ubuntu-cpc: - fixed loop setup due to change of kpartx output - only use grub-install logic for Intel architectures
This commit is contained in:
parent
3bab687119
commit
9cf7b2278f
13
debian/changelog
vendored
13
debian/changelog
vendored
@ -1,3 +1,16 @@
|
|||||||
|
livecd-rootfs (2.209.10) trusty; urgency=medium
|
||||||
|
|
||||||
|
[ Steve Langasek ]
|
||||||
|
* Refactor/reorder ubuntu-cpc support for consistency with other flavors,
|
||||||
|
so that subarch overrides can be applied correctly.
|
||||||
|
|
||||||
|
[ Ben Howard ]
|
||||||
|
* ubuntu-cpc:
|
||||||
|
- fixed loop setup due to change of kpartx output
|
||||||
|
- only use grub-install logic for Intel architectures
|
||||||
|
|
||||||
|
-- Robert C Jennings <robert.jennings@canonical.com> Tue, 23 May 2017 21:01:47 -0500
|
||||||
|
|
||||||
livecd-rootfs (2.209.9) trusty; urgency=medium
|
livecd-rootfs (2.209.9) trusty; urgency=medium
|
||||||
|
|
||||||
[Daniel Watkins]
|
[Daniel Watkins]
|
||||||
|
@ -388,6 +388,31 @@ case $PROJECT in
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
ubuntu-cpc)
|
ubuntu-cpc)
|
||||||
|
add_task install minimal standard cloud-image
|
||||||
|
add_package install ubuntu-minimal
|
||||||
|
|
||||||
|
BINARY_REMOVE_LINUX=false
|
||||||
|
OPTS="${OPTS:+$OPTS }--initramfs=none"
|
||||||
|
KERNEL_FLAVOURS=virtual
|
||||||
|
case $ARCH in
|
||||||
|
armhf)
|
||||||
|
KERNEL_FLAVOURS=generic-lpae
|
||||||
|
add_package install flash-kernel
|
||||||
|
add_task install server
|
||||||
|
;;
|
||||||
|
arm64)
|
||||||
|
KERNEL_FLAVOURS=generic
|
||||||
|
add_package install flash-kernel
|
||||||
|
add_task install server
|
||||||
|
;;
|
||||||
|
ppc64el)
|
||||||
|
add_task install server
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
OPTS="${OPTS:+$OPTS }--system=normal"
|
||||||
|
OPTS="${OPTS:+$OPTS }--hdd-label=cloudimg-rootfs"
|
||||||
|
OPTS="${OPTS:+$OPTS }--ext-resize-blocks=536870912 --ext-block-size=4096"
|
||||||
|
OPTS="${OPTS:+$OPTS }--ext-fudge-factor=15"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
@ -467,33 +492,6 @@ case $PROJECT in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ "$PROJECT" = "ubuntu-cpc" ]; then
|
|
||||||
BINARY_REMOVE_LINUX=false
|
|
||||||
OPTS="${OPTS:+$OPTS }--initramfs=none"
|
|
||||||
KERNEL_FLAVOURS=virtual
|
|
||||||
case $ARCH in
|
|
||||||
armhf)
|
|
||||||
KERNEL_FLAVOURS=generic-lpae
|
|
||||||
add_package install flash-kernel
|
|
||||||
add_task install server
|
|
||||||
;;
|
|
||||||
arm64)
|
|
||||||
KERNEL_FLAVOURS=generic
|
|
||||||
add_package install flash-kernel
|
|
||||||
add_task install server
|
|
||||||
;;
|
|
||||||
ppc64el)
|
|
||||||
add_task install server
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
OPTS="${OPTS:+$OPTS }--system=normal"
|
|
||||||
OPTS="${OPTS:+$OPTS }--hdd-label=cloudimg-rootfs"
|
|
||||||
OPTS="${OPTS:+$OPTS }--ext-resize-blocks=536870912 --ext-block-size=4096"
|
|
||||||
OPTS="${OPTS:+$OPTS }--ext-fudge-factor=15"
|
|
||||||
add_task install minimal standard cloud-image
|
|
||||||
add_package install landscape-client ubuntu-minimal
|
|
||||||
fi
|
|
||||||
|
|
||||||
add_chroot_hook update-apt-file-cache
|
add_chroot_hook update-apt-file-cache
|
||||||
add_chroot_hook update-apt-xapian-index
|
add_chroot_hook update-apt-xapian-index
|
||||||
add_chroot_hook update-mlocate-database
|
add_chroot_hook update-mlocate-database
|
||||||
|
@ -11,15 +11,16 @@ backing_img=
|
|||||||
apt-get -qqy install dosfstools gdisk
|
apt-get -qqy install dosfstools gdisk
|
||||||
|
|
||||||
clean_loops() {
|
clean_loops() {
|
||||||
|
|
||||||
|
if [ -n "${backing_img}" ]; then
|
||||||
|
kpartx -v -d "${backing_img}"
|
||||||
|
unset backing_img
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z "${rootfs_dev_mapper}" ]; then
|
if [ -z "${rootfs_dev_mapper}" ]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${backing_img}" ]; then
|
|
||||||
kpartx -v -d "${backing_img}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
unset backing_img
|
|
||||||
unset loop_device
|
unset loop_device
|
||||||
unset loop_raw
|
unset loop_raw
|
||||||
unset rootfs_dev_mapper
|
unset rootfs_dev_mapper
|
||||||
@ -40,11 +41,27 @@ mount_image() {
|
|||||||
apt-get install -qqy kpartx
|
apt-get install -qqy kpartx
|
||||||
trap clean_loops EXIT
|
trap clean_loops EXIT
|
||||||
backing_img="$1"
|
backing_img="$1"
|
||||||
loop_raw="$(kpartx -s -v -a "$1" )"
|
kpartx_mapping="$(kpartx -s -v -a ${backing_img})"
|
||||||
loop_device="$(echo -e "${loop_raw}" | head -n1 | awk '{print($(NF-1))}')"
|
|
||||||
rootfs_dev_mapper="/dev/mapper${loop_device///dev/}p1"
|
# Find the loop device
|
||||||
[ ! -b "${rootfs_dev_mapper}" ] &&
|
loop_p1="$(echo -e ${kpartx_mapping} | head -n1 | awk '{print$3}')"
|
||||||
echo "${rootfs_dev_mapper} is not a block device" && exit 1
|
loop_device="/dev/loop$(echo ${loop_p1} | cut -b5)"
|
||||||
|
if [ ! -b ${loop_device} ]; then
|
||||||
|
echo "unable to find loop device for ${backing_img}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Find the rootfs location
|
||||||
|
rootfs_dev_mapper="/dev/mapper/${loop_p1}"
|
||||||
|
if [ ! -b "${rootfs_dev_mapper}" ]; then
|
||||||
|
echo "${rootfs_dev_mapper} is not a block device";
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Add some information to the debug logs
|
||||||
|
echo "Mounted disk image ${backing_img} to ${rootfs_dev_mapper}"
|
||||||
|
blkid ${rootfs_dev_mapper}
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,24 +32,23 @@ cp -a chroot/* mountpoint/
|
|||||||
umount mountpoint
|
umount mountpoint
|
||||||
rmdir mountpoint
|
rmdir mountpoint
|
||||||
|
|
||||||
should_install_grub() {
|
case $architecture in
|
||||||
case $architecture in
|
amd64|i386) should_install_grub=1;;
|
||||||
armhf|arm64)
|
*) should_install_grub=0;;
|
||||||
return 1
|
esac
|
||||||
;;
|
|
||||||
*)
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
if should_install_grub; then
|
if [ "${should_install_grub}" -eq 1 ]; then
|
||||||
mkdir mountpoint
|
mkdir mountpoint
|
||||||
mount_partition "${rootfs_dev_mapper}" mountpoint
|
mount_partition "${rootfs_dev_mapper}" mountpoint
|
||||||
|
|
||||||
echo "(hd0) ${loop_device}" > mountpoint/tmp/device.map
|
echo "(hd0) ${loop_device}" > mountpoint/tmp/device.map
|
||||||
chroot mountpoint grub-install ${loop_device}
|
chroot mountpoint grub-install ${loop_device}
|
||||||
chroot mountpoint grub-bios-setup --boot-image=i386-pc/boot.img --core-image=i386-pc/core.img --skip-fs-probe --device-map=/tmp/device.map ${loop_device}
|
chroot mountpoint grub-bios-setup \
|
||||||
|
--boot-image=i386-pc/boot.img \
|
||||||
|
--core-image=i386-pc/core.img \
|
||||||
|
--skip-fs-probe \
|
||||||
|
--device-map=/tmp/device.map \
|
||||||
|
${loop_device}
|
||||||
|
|
||||||
rm mountpoint/tmp/device.map
|
rm mountpoint/tmp/device.map
|
||||||
umount_partition mountpoint
|
umount_partition mountpoint
|
||||||
|
Loading…
x
Reference in New Issue
Block a user