Improve kernel-install support for initrd files. (#11281)
The current support in kernel-install for initrd images doesn't copy over the initrd file or allow a means for it to be specified (it requires a specific filename in a particular directory). This patchset adds support for (optionally) providing the name of initial ramdisk file to copied over and used by kernel-install.
This commit is contained in:
@@ -6,6 +6,7 @@ COMMAND="$1"
|
||||
KERNEL_VERSION="$2"
|
||||
BOOT_DIR_ABS="$3"
|
||||
KERNEL_IMAGE="$4"
|
||||
INITRD_FILE="$5"
|
||||
|
||||
if ! [[ $KERNEL_INSTALL_MACHINE_ID ]]; then
|
||||
exit 0
|
||||
@@ -82,6 +83,15 @@ cp "$KERNEL_IMAGE" "$BOOT_DIR_ABS/linux" &&
|
||||
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
|
||||
|
||||
@@ -24,7 +24,7 @@ SKIP_REMAINING=77
|
||||
usage()
|
||||
{
|
||||
echo "Usage:"
|
||||
echo " $0 add KERNEL-VERSION KERNEL-IMAGE"
|
||||
echo " $0 add KERNEL-VERSION KERNEL-IMAGE [INITRD-FILE]"
|
||||
echo " $0 remove KERNEL-VERSION"
|
||||
}
|
||||
|
||||
@@ -72,6 +72,7 @@ fi
|
||||
|
||||
KERNEL_VERSION="$1"
|
||||
KERNEL_IMAGE="$2"
|
||||
INITRD_FILE="$3"
|
||||
|
||||
if [[ -f /etc/machine-id ]]; then
|
||||
read MACHINE_ID < /etc/machine-id
|
||||
@@ -123,7 +124,7 @@ case $COMMAND in
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user