mirror of
https://git.launchpad.net/livecd-rootfs
synced 2025-04-30 05:11:31 +00:00
Apply snap-preseed optimizations after seeding snaps
The snap-preseed command can do a number of things during the build that are currently performed at first boot (apparmor profiles, systemd unit generation, etc). This patch adds a call to reset the seeding and apply these optimizations when adding a seeded snap. As a prerequisite to calling snap-preseed we need to make /dev/mem available as well as mounts from the host to perform this work, so those are also added here. (cherry picked from commit 1ca11c979505ae1b8c4621f034d28070a2715293)
This commit is contained in:
parent
bac2570518
commit
39ebdf6902
@ -112,7 +112,22 @@ preinstall_snaps() {
|
|||||||
for snap in "$@"; do
|
for snap in "$@"; do
|
||||||
SNAP_NO_VALIDATE_SEED=1 snap_preseed chroot "${snap}"
|
SNAP_NO_VALIDATE_SEED=1 snap_preseed chroot "${snap}"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ ! -c /dev/mem ]; then
|
||||||
|
mknod -m 660 /dev/mem c 1 1
|
||||||
|
chown root:kmem /dev/mem
|
||||||
|
fi
|
||||||
|
|
||||||
|
mount --rbind /dev chroot/dev
|
||||||
|
mount --rbind /sys chroot/sys
|
||||||
|
mount --bind /proc chroot/proc
|
||||||
|
|
||||||
snap_validate_seed chroot
|
snap_validate_seed chroot
|
||||||
|
|
||||||
|
umount --recursive chroot/proc
|
||||||
|
umount --recursive chroot/sys
|
||||||
|
umount --recursive chroot/dev
|
||||||
|
|
||||||
lb chroot_resolv remove
|
lb chroot_resolv remove
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,9 +96,15 @@ mount_image() {
|
|||||||
setup_mountpoint() {
|
setup_mountpoint() {
|
||||||
local mountpoint="$1"
|
local mountpoint="$1"
|
||||||
|
|
||||||
|
if [ ! -c /dev/mem ]; then
|
||||||
|
mknod -m 660 /dev/mem c 1 1
|
||||||
|
chown root:kmem /dev/mem
|
||||||
|
fi
|
||||||
|
|
||||||
mount --rbind /dev "$mountpoint/dev"
|
mount --rbind /dev "$mountpoint/dev"
|
||||||
mount proc-live -t proc "$mountpoint/proc"
|
mount proc-live -t proc "$mountpoint/proc"
|
||||||
mount sysfs-live -t sysfs "$mountpoint/sys"
|
mount sysfs-live -t sysfs "$mountpoint/sys"
|
||||||
|
mount securityfs -t securityfs "$mountpoint/sys/kernel/security"
|
||||||
mount -t tmpfs none "$mountpoint/tmp"
|
mount -t tmpfs none "$mountpoint/tmp"
|
||||||
mount -t tmpfs none "$mountpoint/var/lib/apt"
|
mount -t tmpfs none "$mountpoint/var/lib/apt"
|
||||||
mount -t tmpfs none "$mountpoint/var/cache/apt"
|
mount -t tmpfs none "$mountpoint/var/cache/apt"
|
||||||
@ -682,6 +688,8 @@ snap_validate_seed() {
|
|||||||
|
|
||||||
if [ -e "${CHROOT_ROOT}/var/lib/snapd/seed/seed.yaml" ]; then
|
if [ -e "${CHROOT_ROOT}/var/lib/snapd/seed/seed.yaml" ]; then
|
||||||
snap debug validate-seed "${CHROOT_ROOT}/var/lib/snapd/seed/seed.yaml"
|
snap debug validate-seed "${CHROOT_ROOT}/var/lib/snapd/seed/seed.yaml"
|
||||||
|
/usr/lib/snapd/snap-preseed --reset $(realpath "${CHROOT_ROOT}")
|
||||||
|
/usr/lib/snapd/snap-preseed $(realpath "${CHROOT_ROOT}")
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user