an attempt to be able to run from a git checkout

This commit is contained in:
michael.hudson@canonical.com 2026-02-23 08:44:49 +13:00
parent 04e2aea648
commit 7620f798f4
No known key found for this signature in database
GPG Key ID: 80E627A0AB757E23
7 changed files with 38 additions and 32 deletions

View File

@ -375,7 +375,7 @@ EOF
(cd chroot && find usr/share/doc -maxdepth 1 -type d | xargs du -s | sort -nr) (cd chroot && find usr/share/doc -maxdepth 1 -type d | xargs du -s | sort -nr)
echo END docdirs echo END docdirs
/usr/share/livecd-rootfs/minimize-manual chroot ${LIVECD_ROOTFS_ROOT}/minimize-manual chroot
clean_debian_chroot clean_debian_chroot
fi fi

View File

@ -1,6 +1,8 @@
#!/bin/bash #!/bin/bash
set -e set -e
LIVECD_ROOTFS_ROOT=${LIVECD_ROOTFS_ROOT:-/usr/share/livecd-rootfs}
case $ARCH:$SUBARCH in case $ARCH:$SUBARCH in
amd64:|amd64:generic|amd64:intel-iot|\ amd64:|amd64:generic|amd64:intel-iot|\
arm64:|arm64:generic|arm64:raspi|arm64:snapdragon|arm64:nvidia|\ arm64:|arm64:generic|arm64:raspi|arm64:snapdragon|arm64:nvidia|\
@ -47,12 +49,12 @@ if [ -z "$MIRROR" ]; then
fi fi
mkdir -p config mkdir -p config
cp -af /usr/share/livecd-rootfs/live-build/functions config/functions cp -af ${LIVECD_ROOTFS_ROOT}/live-build/functions config/functions
cp -af /usr/share/livecd-rootfs/live-build/lb_*_layered config/ cp -af ${LIVECD_ROOTFS_ROOT}/live-build/lb_*_layered config/
cp -af /usr/share/livecd-rootfs/live-build/snap-seed-parse.py config/snap-seed-parse cp -af ${LIVECD_ROOTFS_ROOT}/live-build/snap-seed-parse.py config/snap-seed-parse
cp -af /usr/share/livecd-rootfs/live-build/snap-seed-missing-providers.py config/snap-seed-missing-providers cp -af ${LIVECD_ROOTFS_ROOT}/live-build/snap-seed-missing-providers.py config/snap-seed-missing-providers
cp -af /usr/share/livecd-rootfs/live-build/expand-task config/expand-task cp -af ${LIVECD_ROOTFS_ROOT}/live-build/expand-task config/expand-task
cp -af /usr/share/livecd-rootfs/live-build/squashfs-exclude-files config/ cp -af ${LIVECD_ROOTFS_ROOT}/live-build/squashfs-exclude-files config/
mkdir -p config/package-lists mkdir -p config/package-lists
@ -816,7 +818,7 @@ do_layered_desktop_image() {
DEFAULT_KERNEL="linux-$KERNEL_FLAVOURS" DEFAULT_KERNEL="linux-$KERNEL_FLAVOURS"
if [ "$LOCALE_SUPPORT" != none ]; then if [ "$LOCALE_SUPPORT" != none ]; then
/usr/share/livecd-rootfs/checkout-translations-branch \ ${LIVECD_ROOTFS_ROOT}/checkout-translations-branch \
https://git.launchpad.net/subiquity po \ https://git.launchpad.net/subiquity po \
config/catalog-translations config/catalog-translations
fi fi
@ -1136,7 +1138,7 @@ case $PROJECT in
NO_SQUASHFS_PASSES=ubuntu-server-minimal.ubuntu-server.installer.$flavor.netboot NO_SQUASHFS_PASSES=ubuntu-server-minimal.ubuntu-server.installer.$flavor.netboot
DEFAULT_KERNEL="$kernel_metapkg" DEFAULT_KERNEL="$kernel_metapkg"
/usr/share/livecd-rootfs/checkout-translations-branch \ ${LIVECD_ROOTFS_ROOT}/checkout-translations-branch \
https://git.launchpad.net/subiquity po config/catalog-translations https://git.launchpad.net/subiquity po config/catalog-translations
;; ;;
*) *)
@ -1154,7 +1156,7 @@ case $PROJECT in
# created in ubuntu-core-installer/hooks/05-prepare-image.binary, which # created in ubuntu-core-installer/hooks/05-prepare-image.binary, which
# subiquity knows how to install. # subiquity knows how to install.
if [ ${SUBPROJECT} == "desktop" ]; then if [ ${SUBPROJECT} == "desktop" ]; then
cp /usr/share/livecd-rootfs/live-build/${PROJECT}/ubuntu-core-desktop-24-amd64.model-assertion config/ cp ${LIVECD_ROOTFS_ROOT}/live-build/${PROJECT}/ubuntu-core-desktop-24-amd64.model-assertion config/
fi fi
OPTS="${OPTS:+$OPTS }--bootstrap-flavour=minimal" OPTS="${OPTS:+$OPTS }--bootstrap-flavour=minimal"
PASSES_TO_LAYERS=true PASSES_TO_LAYERS=true
@ -1168,7 +1170,7 @@ case $PROJECT in
USE_BRIDGE_KERNEL=false USE_BRIDGE_KERNEL=false
DEFAULT_KERNEL="snap:pc-kernel" DEFAULT_KERNEL="snap:pc-kernel"
/usr/share/livecd-rootfs/checkout-translations-branch \ ${LIVECD_ROOTFS_ROOT}/checkout-translations-branch \
https://git.launchpad.net/subiquity po config/catalog-translations https://git.launchpad.net/subiquity po config/catalog-translations
;; ;;
@ -1308,7 +1310,7 @@ case $SUBPROJECT in
# and a variety of things fail without it. # and a variety of things fail without it.
add_package install tzdata add_package install tzdata
cp -af /usr/share/livecd-rootfs/live-build/make-lxd-metadata.py config/make-lxd-metadata cp -af ${LIVECD_ROOTFS_ROOT}/live-build/make-lxd-metadata.py config/make-lxd-metadata
;; ;;
esac esac
@ -1433,6 +1435,7 @@ echo "LB_CHROOT_HOOKS=\"$CHROOT_HOOKS\"" >> config/chroot
echo "SUBPROJECT=\"${SUBPROJECT:-}\"" >> config/chroot echo "SUBPROJECT=\"${SUBPROJECT:-}\"" >> config/chroot
echo "LB_DISTRIBUTION=\"$SUITE\"" >> config/chroot echo "LB_DISTRIBUTION=\"$SUITE\"" >> config/chroot
echo "IMAGEFORMAT=\"$IMAGEFORMAT\"" >> config/chroot echo "IMAGEFORMAT=\"$IMAGEFORMAT\"" >> config/chroot
echo "LIVECD_ROOTFS_ROOT=\"$LIVECD_ROOTFS_ROOT\"" >> config/common
if [ -n "$PASSES" ]; then if [ -n "$PASSES" ]; then
echo "PASSES=\"$PASSES\"" >> config/common echo "PASSES=\"$PASSES\"" >> config/common
fi fi
@ -1566,7 +1569,7 @@ case $PROJECT:${SUBPROJECT:-} in
ubuntustudio:*|edubuntu:*|ubuntu-budgie:*|ubuntucinnamon:*|xubuntu:*| \ ubuntustudio:*|edubuntu:*|ubuntu-budgie:*|ubuntucinnamon:*|xubuntu:*| \
ubuntukylin:*|ubuntu-mate:*|ubuntu-core-installer:*|lubuntu:*) ubuntukylin:*|ubuntu-mate:*|ubuntu-core-installer:*|lubuntu:*)
# Ensure that most things e.g. includes.chroot are copied as is # Ensure that most things e.g. includes.chroot are copied as is
for entry in /usr/share/livecd-rootfs/live-build/${PROJECT}/*; do for entry in ${LIVECD_ROOTFS_ROOT}/live-build/${PROJECT}/*; do
case $entry in case $entry in
*hooks*) *hooks*)
# But hooks are shared across the projects with symlinks # But hooks are shared across the projects with symlinks
@ -1601,11 +1604,11 @@ esac
case $PROJECT in case $PROJECT in
ubuntu-oem|ubuntustudio|edubuntu|ubuntu-budgie|ubuntucinnamon| \ ubuntu-oem|ubuntustudio|edubuntu|ubuntu-budgie|ubuntucinnamon| \
xubuntu|ubuntukylin|ubuntu-mate|lubuntu) xubuntu|ubuntukylin|ubuntu-mate|lubuntu)
cp -af /usr/share/livecd-rootfs/live-build/ubuntu/includes.chroot \ cp -af ${LIVECD_ROOTFS_ROOT}/live-build/ubuntu/includes.chroot \
config/includes.chroot config/includes.chroot
LIVE_LAYER=${LIVE_PREFIX}live LIVE_LAYER=${LIVE_PREFIX}live
cp -af /usr/share/livecd-rootfs/live-build/ubuntu/includes.chroot.minimal.standard.live \ cp -af ${LIVECD_ROOTFS_ROOT}/live-build/ubuntu/includes.chroot.minimal.standard.live \
config/includes.chroot.$LIVE_LAYER config/includes.chroot.$LIVE_LAYER
if [ $PROJECT != ubuntu-oem ]; then if [ $PROJECT != ubuntu-oem ]; then
@ -1621,7 +1624,7 @@ esac
case $SUBPROJECT in case $SUBPROJECT in
buildd) buildd)
cp -af /usr/share/livecd-rootfs/live-build/buildd/* config/ cp -af ${LIVECD_ROOTFS_ROOT}/live-build/buildd/* config/
;; ;;
esac esac
@ -1645,7 +1648,7 @@ if [ "$EXTRA_PPAS" ]; then
extra_ppa=${extra_ppa%:*} extra_ppa=${extra_ppa%:*}
;; ;;
esac esac
extra_ppa_fingerprint="$(/usr/share/livecd-rootfs/get-ppa-fingerprint "$extra_ppa")" extra_ppa_fingerprint="$(${LIVECD_ROOTFS_ROOT}/get-ppa-fingerprint "$extra_ppa")"
cat >> config/archives/extra-ppas.list.chroot <<EOF cat >> config/archives/extra-ppas.list.chroot <<EOF
deb https://ppa.launchpadcontent.net/$extra_ppa/ubuntu @DISTRIBUTION@ main deb https://ppa.launchpadcontent.net/$extra_ppa/ubuntu @DISTRIBUTION@ main
@ -1735,7 +1738,7 @@ fi
if [ "${MAKE_ISO}" = "yes" ]; then if [ "${MAKE_ISO}" = "yes" ]; then
# XXX should pass --build-type here. # XXX should pass --build-type here.
/usr/share/livecd-rootfs/live-build/gen-iso-ids \ ${LIVECD_ROOTFS_ROOT}/live-build/gen-iso-ids \
--project $PROJECT ${SUBPROJECT:+--subproject $SUBPROJECT} \ --project $PROJECT ${SUBPROJECT:+--subproject $SUBPROJECT} \
--arch $ARCH ${SUBARCH:+--subarch $SUBARCH} ${NOW+--serial $NOW} \ --arch $ARCH ${SUBARCH:+--subarch $SUBARCH} ${NOW+--serial $NOW} \
--output-dir config/iso-ids/ --output-dir config/iso-ids/

View File

@ -188,8 +188,8 @@ setup_mountpoint() {
mount sysfs-live -t sysfs "$mountpoint/sys" mount sysfs-live -t sysfs "$mountpoint/sys"
mount securityfs -t securityfs "$mountpoint/sys/kernel/security" mount securityfs -t securityfs "$mountpoint/sys/kernel/security"
# Provide more up to date apparmor features, matching target kernel # Provide more up to date apparmor features, matching target kernel
mount -o bind /usr/share/livecd-rootfs/live-build/apparmor/generic "$mountpoint/sys/kernel/security/apparmor/features/" mount -o bind ${LIVECD_ROOTFS_ROOT}/live-build/apparmor/generic "$mountpoint/sys/kernel/security/apparmor/features/"
mount -o bind /usr/share/livecd-rootfs/live-build/seccomp/generic.actions_avail "$mountpoint/proc/sys/kernel/seccomp/actions_avail" mount -o bind ${LIVECD_ROOTFS_ROOT}/live-build/seccomp/generic.actions_avail "$mountpoint/proc/sys/kernel/seccomp/actions_avail"
# cgroup2 mount for LP: 1944004 # cgroup2 mount for LP: 1944004
mount -t cgroup2 none "$mountpoint/sys/fs/cgroup" mount -t cgroup2 none "$mountpoint/sys/fs/cgroup"
mount -t tmpfs none "$mountpoint/tmp" mount -t tmpfs none "$mountpoint/tmp"
@ -860,7 +860,7 @@ snap_validate_seed() {
fi fi
if [ ${boot_filename} != undefined ]; then # we have a known boot file so we can proceed with checking for features to mount if [ ${boot_filename} != undefined ]; then # we have a known boot file so we can proceed with checking for features to mount
kern_major_min=$(readlink --canonicalize --no-newline ${CHROOT_ROOT}/boot/${boot_filename} | grep --extended-regexp --only-matching --max-count 1 '[0-9]+\.[0-9]+') kern_major_min=$(readlink --canonicalize --no-newline ${CHROOT_ROOT}/boot/${boot_filename} | grep --extended-regexp --only-matching --max-count 1 '[0-9]+\.[0-9]+')
if [ -d /usr/share/livecd-rootfs/live-build/apparmor/${kern_major_min} ]; then if [ -d ${LIVECD_ROOTFS_ROOT}/live-build/apparmor/${kern_major_min} ]; then
# if an Ubuntu version has different kernel apparmor features between LTS and HWE kernels # if an Ubuntu version has different kernel apparmor features between LTS and HWE kernels
# a snap pre-seeding issue can occur, where the incorrect apparmor features are reported # a snap pre-seeding issue can occur, where the incorrect apparmor features are reported
# basic copy of a directory structure overriding the "generic" feature set # basic copy of a directory structure overriding the "generic" feature set
@ -868,7 +868,7 @@ snap_validate_seed() {
# Bind kernel apparmor directory to feature directory for snap preseeding # Bind kernel apparmor directory to feature directory for snap preseeding
umount "${CHROOT_ROOT}/sys/kernel/security/apparmor/features/" umount "${CHROOT_ROOT}/sys/kernel/security/apparmor/features/"
mount --bind /usr/share/livecd-rootfs/live-build/apparmor/${kern_major_min} "${CHROOT_ROOT}/sys/kernel/security/apparmor/features/" mount --bind ${LIVECD_ROOTFS_ROOT}/live-build/apparmor/${kern_major_min} "${CHROOT_ROOT}/sys/kernel/security/apparmor/features/"
fi fi
fi fi
@ -894,7 +894,7 @@ snap_validate_seed() {
# mount generic apparmor feature again (cleanup) # mount generic apparmor feature again (cleanup)
if [ -d /build/config/hooks.d/extra/apparmor/${kern_major_min} ]; then if [ -d /build/config/hooks.d/extra/apparmor/${kern_major_min} ]; then
umount "${CHROOT_ROOT}/sys/kernel/security/apparmor/features/" umount "${CHROOT_ROOT}/sys/kernel/security/apparmor/features/"
mount -o bind /usr/share/livecd-rootfs/live-build/apparmor/generic "${CHROOT_ROOT}/sys/kernel/security/apparmor/features/" mount -o bind ${LIVECD_ROOTFS_ROOT}/live-build/apparmor/generic "${CHROOT_ROOT}/sys/kernel/security/apparmor/features/"
fi fi
} }
@ -1254,7 +1254,7 @@ setup_cidata() {
local mountpoint=$(mktemp -d) local mountpoint=$(mktemp -d)
mkfs.vfat -F 32 -n CIDATA ${cidata_dev} mkfs.vfat -F 32 -n CIDATA ${cidata_dev}
mount ${cidata_dev} ${mountpoint} mount ${cidata_dev} ${mountpoint}
cp /usr/share/livecd-rootfs/live-build/cidata/* ${mountpoint} cp ${LIVECD_ROOTFS_ROOT}/live-build/cidata/* ${mountpoint}
cat >>${mountpoint}/meta-data.sample <<END cat >>${mountpoint}/meta-data.sample <<END
#instance-id: iid-$(openssl rand -hex 8) #instance-id: iid-$(openssl rand -hex 8)
@ -1454,5 +1454,5 @@ gpt_root_partition_uuid() {
# is importable, and uses config/iso-dir as the standard working directory # is importable, and uses config/iso-dir as the standard working directory
# for ISO metadata and intermediate files. # for ISO metadata and intermediate files.
isobuild () { isobuild () {
PYTHONPATH=/usr/share/livecd-rootfs/live-build/ /usr/share/livecd-rootfs/live-build/isobuild --workdir config/iso-dir "$@" PYTHONPATH=${LIVECD_ROOTFS_ROOT}/live-build/ ${LIVECD_ROOTFS_ROOT}/live-build/isobuild --workdir config/iso-dir "$@"
} }

View File

@ -180,7 +180,7 @@ build_layered_squashfs () {
# Operate on the upperdir directly, so that we are only # Operate on the upperdir directly, so that we are only
# modifying mtime on files that are actually changed in # modifying mtime on files that are actually changed in
# this layer. LP: #2107332 # this layer. LP: #2107332
/usr/share/livecd-rootfs/sync-mtime chroot "$overlay_dir" ${LIVECD_ROOTFS_ROOT}/sync-mtime chroot "$overlay_dir"
fi fi
create_squashfs "${overlay_dir}" ${squashfs_f} create_squashfs "${overlay_dir}" ${squashfs_f}
@ -206,7 +206,7 @@ build_layered_squashfs () {
if [ -f config/seeded-languages ]; then if [ -f config/seeded-languages ]; then
usc_opts="$usc_opts --langs $(cat config/seeded-languages)" usc_opts="$usc_opts --langs $(cat config/seeded-languages)"
fi fi
/usr/share/livecd-rootfs/update-source-catalog source $usc_opts ${LIVECD_ROOTFS_ROOT}/update-source-catalog source $usc_opts
else else
echo "No catalog entry template for $pass" echo "No catalog entry template for $pass"
fi fi
@ -227,7 +227,7 @@ done
if [ -n "$DEFAULT_KERNEL" -a -f livecd.${PROJECT_FULL}.install-sources.yaml ]; then if [ -n "$DEFAULT_KERNEL" -a -f livecd.${PROJECT_FULL}.install-sources.yaml ]; then
write_kernel_yaml "$DEFAULT_KERNEL" "$BRIDGE_KERNEL_REASONS" write_kernel_yaml "$DEFAULT_KERNEL" "$BRIDGE_KERNEL_REASONS"
/usr/share/livecd-rootfs/update-source-catalog merge \ ${LIVECD_ROOTFS_ROOT}/update-source-catalog merge \
--output livecd.${PROJECT_FULL}.install-sources.yaml \ --output livecd.${PROJECT_FULL}.install-sources.yaml \
--template config/kernel.yaml --template config/kernel.yaml
fi fi

View File

@ -237,7 +237,7 @@ create_chroot_pass () {
lb chroot_interactive ${*} lb chroot_interactive ${*}
# Misc ubuntu cleanup and post-layer configuration # Misc ubuntu cleanup and post-layer configuration
/usr/share/livecd-rootfs/minimize-manual chroot ${LIVECD_ROOTFS_ROOT}/minimize-manual chroot
clean_debian_chroot clean_debian_chroot
Chroot chroot "dpkg-query -W" > chroot.packages.${pass} Chroot chroot "dpkg-query -W" > chroot.packages.${pass}

View File

@ -11,6 +11,7 @@ case ${PASS:-} in
esac esac
. config/binary . config/binary
. config/common
. config/functions . config/functions
case ${SUBPROJECT} in case ${SUBPROJECT} in
@ -56,4 +57,4 @@ PROJECT_FULL=$PROJECT${SUBARCH:+-$SUBARCH}
usc_opts="--output livecd.${PROJECT_FULL}.install-sources.yaml \ usc_opts="--output livecd.${PROJECT_FULL}.install-sources.yaml \
--template config/edge.catalog-in.yaml \ --template config/edge.catalog-in.yaml \
--size 0" --size 0"
/usr/share/livecd-rootfs/update-source-catalog source $usc_opts ${LIVECD_ROOTFS_ROOT}/update-source-catalog source $usc_opts

View File

@ -7,10 +7,12 @@
set -e set -e
. config/common
chroot_directory=$1 chroot_directory=$1
auto_packages=$(/usr/share/livecd-rootfs/auto-markable-pkgs $chroot_directory) auto_packages=$(${LIVECD_ROOTFS_ROOT}/auto-markable-pkgs $chroot_directory)
if [ -n "$auto_packages" ]; then if [ -n "$auto_packages" ]; then
chroot $chroot_directory apt-mark auto $auto_packages chroot $chroot_directory apt-mark auto $auto_packages
fi fi
[ -z "$(/usr/share/livecd-rootfs/auto-markable-pkgs $chroot_directory 2> /dev/null)" ] [ -z "$(${LIVECD_ROOTFS_ROOT}/auto-markable-pkgs $chroot_directory 2> /dev/null)" ]