mirror of
https://git.launchpad.net/livecd-rootfs
synced 2025-02-22 19:01:30 +00:00
make another possibly more generally useful function
This commit is contained in:
parent
c85cae9bfe
commit
416ef912ed
@ -335,3 +335,50 @@ skip_lb_stage() {
|
||||
mkdir -p .build
|
||||
touch ".build/$STAGE"
|
||||
}
|
||||
|
||||
recreate_initramfs() {
|
||||
# Regenerate the initramfs by running update-initramfs in the
|
||||
# chroot at $1 and copying the generated initramfs
|
||||
# around. Beware that this was written for a single use case
|
||||
# (live-server) and may not work in all cases without
|
||||
# tweaking...
|
||||
CHROOT="$1"
|
||||
# Start by cargo culting bits of lb_chroot_hacks:
|
||||
chroot "$CHROOT" sh -c "${UPDATE_INITRAMFS_OPTIONS:-} update-initramfs -k all -t -u"
|
||||
case "${LB_INITRAMFS_COMPRESSION}" in
|
||||
gzip)
|
||||
;;
|
||||
|
||||
bzip2)
|
||||
for INITRAMFS in $(find "$CHROOT"/boot -name 'initrd*' -not -type l); do
|
||||
zcat "${INITRAMFS}" | bzip2 -c ${BZIP2_OPTIONS} > "${INITRAMFS}.new"
|
||||
mv "${INITRAMFS}.new" "${INITRAMFS}"
|
||||
done
|
||||
;;
|
||||
|
||||
lzma)
|
||||
# We probably ought to use COMPRESS= in a temporary file in
|
||||
# /etc/initramfs-tools/conf.d/ instead, but it's hard to
|
||||
# pass options that way.
|
||||
for INITRAMFS in $(find "$CHROOT"/boot -name 'initrd*' -not -type l); do
|
||||
zcat "${INITRAMFS}" | lzma -c ${LZMA_OPTIONS} > "${INITRAMFS}.new"
|
||||
mv "${INITRAMFS}.new" "${INITRAMFS}"
|
||||
done
|
||||
;;
|
||||
esac
|
||||
# Then bits of lb_binary_linux-image:
|
||||
case "${LB_INITRAMFS}" in
|
||||
casper)
|
||||
DESTDIR="binary/casper"
|
||||
;;
|
||||
|
||||
live-boot)
|
||||
DESTDIR="binary/live"
|
||||
;;
|
||||
|
||||
*)
|
||||
DESTDIR="binary/boot"
|
||||
;;
|
||||
esac
|
||||
mv "$CHROOT"/boot/initrd.img-* $DESTDIR
|
||||
}
|
||||
|
@ -50,20 +50,10 @@ EOF
|
||||
# Install any requirements for the installer, for things we don't want
|
||||
# to see on the installed system
|
||||
chroot $SQUASH_ROOT apt-get update
|
||||
chroot $SQUASH_ROOT apt-get -y install user-setup lupin-casper
|
||||
chroot $SQUASH_ROOT apt-get -y install user-setup curtin lupin-casper
|
||||
|
||||
# Installing lupin-casper means we need a new initramfs, so we
|
||||
# cargo cult stuff from lb_chroot_hacks:
|
||||
CASPER_GENERATE_UUID=1 chroot $SQUASH_ROOT update-initramfs -k all -t -u
|
||||
for INITRAMFS in $(find $SQUASH_ROOT/boot -name 'initrd*' -not -type l); do
|
||||
zcat "${INITRAMFS}" | lzma -c -6 > "${INITRAMFS}.new"
|
||||
mv "${INITRAMFS}.new" "${INITRAMFS}"
|
||||
done
|
||||
# and lb_binary_linux-image:
|
||||
mv $SQUASH_ROOT/boot/initrd.img-* binary/casper/
|
||||
# to replace the previously built one with it.
|
||||
|
||||
chroot $SQUASH_ROOT apt-get -y install curtin
|
||||
# Installing casper means we need a new initramfs
|
||||
UPDATE_INITRAMFS_OPTIONS=CASPER_GENERATE_UUID=1 recreate_initramfs
|
||||
|
||||
# Don't let cloud-init run in the live session.
|
||||
touch $SQUASH_ROOT/etc/cloud/cloud-init.disabled
|
||||
|
Loading…
x
Reference in New Issue
Block a user