
The original image-builder approach had an entirely containerized approach for building target images. This approach was flawed because: 1. There are a number of debian packages which will not install without /sys, /proc, /dev, or /dev/pts mountpoints, and 2. Container build process does not support building with privileges needed to bind-mount these directories into the chroot build space 3. It is a requirement for all packages to be installed in the container image in order to avoid deployment risk of missing mirror resources This patchset addresses this problem by performing necessary privileged steps outside of a containerized build process. At the end of this process, the root filesystem is packaged into a docker container when elevated permissions are no longer required. Change-Id: I5f8dc972f67c5649bf5f9403a5a512d06c948720
76 lines
2.2 KiB
Django/Jinja
Executable File
76 lines
2.2 KiB
Django/Jinja
Executable File
#!/bin/sh -e
|
|
|
|
version="$1"
|
|
kdumpdir="/var/lib/kdump"
|
|
|
|
[ -x /usr/sbin/mkinitramfs ] || exit 0
|
|
|
|
# passing the kernel version is required
|
|
if [ -z "${version}" ]; then
|
|
echo >&2 "W: kdump-tools: ${DPKG_MAINTSCRIPT_PACKAGE:-kdump-tools package} did not pass a version number"
|
|
exit 2
|
|
fi
|
|
|
|
if ! linux-version list | grep "${version}" > /dev/null ; then
|
|
exit 0
|
|
fi
|
|
|
|
# exit if kernel does not need an initramfs
|
|
if [ "$INITRD" = 'No' ]; then
|
|
exit 0
|
|
fi
|
|
|
|
# avoid running multiple times
|
|
if [ -n "$DEB_MAINT_PARAMS" ]; then
|
|
eval set -- "$DEB_MAINT_PARAMS"
|
|
if [ -z "$1" ] || [ "$1" != "configure" ]; then
|
|
exit 0
|
|
fi
|
|
fi
|
|
|
|
# We need a modified copy of initramfs-tools directory
|
|
# with MODULES=dep in initramfs.conf
|
|
if [ ! -d "$kdumpdir" ];then
|
|
mkdir "$kdumpdir" || true
|
|
fi
|
|
# Force re-creation of $kdumpdir/initramfs-tools
|
|
# in case the source has changed since last time
|
|
# we ran
|
|
if [ -d "$kdumpdir/initramfs-tools" ];then
|
|
rm -Rf $kdumpdir/initramfs-tools || true
|
|
fi
|
|
cp -pr /etc/initramfs-tools "$kdumpdir" || true
|
|
|
|
initramfsdir="$kdumpdir/initramfs-tools"
|
|
|
|
# Add scsi_dh_* modules if in use otherwise
|
|
# kexec reboot on multipath will fail
|
|
# (LP: #1635597)
|
|
for I in $(lsmod | grep scsi_dh | cut -d" " -f1);do
|
|
echo "${I}" >> $initramfsdir/modules
|
|
done
|
|
|
|
# canderson: This line needs to be commented out for kdump-tools to install with multistrap
|
|
#sed -e 's/MODULES=.*/MODULES=dep/' /etc/initramfs-tools/initramfs.conf > "$initramfsdir/initramfs.conf" || true
|
|
if ! [ -e "$initramfsdir/initramfs.conf" ];then
|
|
echo >&2 "W: kdump-tools: Unable to create $initramfsdir/initramfs.conf"
|
|
exit 2
|
|
fi
|
|
|
|
# Cleaning up existing initramfs with same version
|
|
# as mkinitramfs do not have a force option
|
|
if [ -e "$kdumpdir/initrd.img-${version}" ];then
|
|
rm -f "$kdumpdir/initrd.img-${version}" || true
|
|
fi
|
|
|
|
# we're good - create initramfs.
|
|
echo "kdump-tools: Generating $kdumpdir/initrd.img-${version}"
|
|
if mkinitramfs -d "$initramfsdir" -o "$kdumpdir/initrd.img-${version}.new" "${version}";then
|
|
mv "$kdumpdir/initrd.img-${version}.new" "$kdumpdir/initrd.img-${version}"
|
|
else
|
|
mkinitramfs_return="$?"
|
|
rm -f "${initramfs}.new"
|
|
echo "update-initramfs: failed for ${initramfs} with $mkinitramfs_return." >&2
|
|
exit $mkinitramfs_return
|
|
fi
|