<command>kernel-install</command>
<arg choice="plain">COMMAND</arg>
<arg choice="plain"><replaceable>KERNEL-VERSION</replaceable></arg>
- <arg choice="opt"><replaceable>KERNEL-IMAGE</replaceable></arg>
+ <arg choice="plain"><replaceable>KERNEL-IMAGE</replaceable></arg>
+ <arg choice="opt"><replaceable>INITRD-FILE</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>
<para>The following commands are understood:</para>
<variablelist>
<varlistentry>
- <term><command>add <replaceable>KERNEL-VERSION</replaceable> <replaceable>KERNEL-IMAGE</replaceable></command></term>
+ <term><command>add <replaceable>KERNEL-VERSION</replaceable> <replaceable>KERNEL-IMAGE</replaceable> [<replaceable>INITRD-FILE</replaceable>]</command></term>
<listitem>
<para>This command expects a kernel version string and a path to a kernel image file as
arguments. <command>kernel-install</command> creates the directory
and calls the executables from <filename>/usr/lib/kernel/install.d/*.install</filename> and
<filename>/etc/kernel/install.d/*.install</filename> with the following arguments:
- <programlisting>add <replaceable>KERNEL-VERSION</replaceable> <filename>/boot/<replaceable>MACHINE-ID</replaceable>/<replaceable>KERNEL-VERSION</replaceable>/</filename> <replaceable>KERNEL-IMAGE</replaceable></programlisting>
+ <programlisting>add <replaceable>KERNEL-VERSION</replaceable> <filename>/boot/<replaceable>MACHINE-ID</replaceable>/<replaceable>KERNEL-VERSION</replaceable>/</filename> <replaceable>KERNEL-IMAGE</replaceable> <replaceable>INITRD-FILE</replaceable></programlisting>
</para>
<para>Two default plugins execute the following operations in this case:</para>
<listitem><para><filename>90-loaderentry.install</filename> copies <replaceable>KERNEL-IMAGE</replaceable>
to
<filename>/boot/<replaceable>MACHINE-ID</replaceable>/<replaceable>KERNEL-VERSION</replaceable>/linux</filename>.
+ If <replaceable>INITRD-FILE</replaceable> is provided, it also copies <replaceable>INITRD-FILE</replaceable>
+ to
+ <filename>/boot/<replaceable>MACHINE-ID</replaceable>/<replaceable>KERNEL_VERSION</replaceable>/initrd</filename>.
It also creates a boot loader entry according to the <ulink
url="https://systemd.io/BOOT_LOADER_SPECIFICATION">Boot Loader Specification</ulink> in
<filename>/boot/loader/entries/<replaceable>MACHINE-ID</replaceable>-<replaceable>KERNEL-VERSION</replaceable>.conf</filename>.
The title of the entry is the <replaceable>PRETTY_NAME</replaceable> parameter specified in
<filename>/etc/os-release</filename> or <filename>/usr/lib/os-release</filename> (if the former is
- missing), or "Linux <replaceable>KERNEL-VERSION</replaceable>", if unset. If the file
- <filename>initrd</filename> is found next to the kernel image file, the initrd will be added to the
- configuration.</para></listitem>
+ missing), or "Linux <replaceable>KERNEL-VERSION</replaceable>", if unset.</para></listitem>
</itemizedlist>
</listitem>
</varlistentry>
KERNEL_VERSION="$2"
BOOT_DIR_ABS="$3"
KERNEL_IMAGE="$4"
+INITRD_FILE="$5"
if ! [[ $KERNEL_INSTALL_MACHINE_ID ]]; then
exit 0
exit 1
}
+if [[ -f "${INITRD_FILE}" ]]; then
+ cp "${INITRD_FILE}" "$BOOT_DIR_ABS/initrd" &&
+ chown root:root "$BOOT_DIR_ABS/initrd" &&
+ chmod 0644 "$BOOT_DIR_ABS/initrd" || {
+ echo "Could not copy '$INITRD_FILE' to '$BOOT_DIR_ABS/initrd'." >&2
+ exit 1
+ }
+fi
+
mkdir -p "${LOADER_ENTRY%/*}" || {
echo "Could not create loader entry directory '${LOADER_ENTRY%/*}'." >&2
exit 1
usage()
{
echo "Usage:"
- echo " $0 add KERNEL-VERSION KERNEL-IMAGE"
+ echo " $0 add KERNEL-VERSION KERNEL-IMAGE [INITRD-FILE]"
echo " $0 remove KERNEL-VERSION"
}
KERNEL_VERSION="$1"
KERNEL_IMAGE="$2"
+INITRD_FILE="$3"
if [[ -f /etc/machine-id ]]; then
read MACHINE_ID < /etc/machine-id
for f in "${PLUGINS[@]}"; do
if [[ -x $f ]]; then
- "$f" add "$KERNEL_VERSION" "$BOOT_DIR_ABS" "$KERNEL_IMAGE"
+ "$f" add "$KERNEL_VERSION" "$BOOT_DIR_ABS" "$KERNEL_IMAGE" "$INITRD_FILE"
x=$?
if [[ $x == $SKIP_REMAINING ]]; then
ret=0