Source: live-build Severity: wishlist Tags: patch The attached patch generates a build UUID during build and adds it into the live filesystem and the image. This is used to couple an initrd with the image it was built from.
There is already some code for casper that does something similar. But this generates a new UUID for every initrd and then extracts the UUID from the initrd and copies it to the image. IMO this approach tries to solve the problem backwards as the initrd is generated from the filesystem and not the other way around. The filesystem is first and does not change it's identity after the build and so should get an UUID. The code for casper then needs several support scripts that ensure that the UUID and initrd don't get out of sync. IMO the approach to generate the UUID on build and to copy it to the initrd whenever it's build makes much more sense. With the current version of the patch the UUID is generated unconditionally. I'm open to have a command line option for this if you prefer. To fully work this also needs a small modification to the initramfs hook in live-boot. But without that, this patch does not do any harm. The patch to live-boot will be submitted as another whishlist bug there. Gaudenz -- System Information: Debian Release: jessie/sid APT prefers testing APT policy: (500, 'testing'), (100, 'unstable'), (1, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 3.16-2-amd64 (SMP w/4 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash
>From 923d2c3fdb904dde396f7ec195d39bfeec40c7e6 Mon Sep 17 00:00:00 2001 From: Gaudenz Steinlin <gaud...@debian.org> Date: Fri, 31 Oct 2014 09:02:28 +0100 Subject: [PATCH] Create build UUID This creates a build UUID and stores it inside the chroot in /etc/live/uuid.conf and in the binary image in .disk/live-uuid. Together with supporting code already present in live-boot this can be used to couple an image and it's initrd(s). To fully work this needs a small patch in the initramfs hook in live-boot. --- debian/control | 2 +- scripts/build/binary_disk | 4 ++++ scripts/build/chroot_hacks | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/debian/control b/debian/control index b921960..041ff4d 100644 --- a/debian/control +++ b/debian/control @@ -13,7 +13,7 @@ Package: live-build Architecture: all Depends: ${misc:Depends}, - debootstrap | cdebootstrap | cdebootstrap-static, + debootstrap | cdebootstrap | cdebootstrap-static, uuid-runtime Recommends: cpio, live-boot-doc, diff --git a/scripts/build/binary_disk b/scripts/build/binary_disk index 2184a3f..0457c3a 100755 --- a/scripts/build/binary_disk +++ b/scripts/build/binary_disk @@ -117,6 +117,10 @@ case "${LB_INITRAMFS}" in rm -rf binary/uuid done ;; + live-boot) + # copy over UUID from chroot + cp chroot/etc/live/uuid.conf binary/.disk/live-uuid + ;; esac case "${LB_DEBIAN_INSTALLER}" in diff --git a/scripts/build/chroot_hacks b/scripts/build/chroot_hacks index 88601c3..a61dd02 100755 --- a/scripts/build/chroot_hacks +++ b/scripts/build/chroot_hacks @@ -70,7 +70,8 @@ case "${LB_INITRAMFS}" in ;; live-boot) - #UPDATE_INITRAMFS_OPTIONS="LIVE_GENERATE_UUID=1" + # generate UUID and store it in the image + uuidgen -r > chroot/etc/live/uuid.conf ;; esac -- 2.1.1