Fix shell variable quoting for security

Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-01-02 00:59:42 +00:00
parent b6b85e445b
commit 634d11af0d

View File

@@ -43,23 +43,23 @@ fi
echo "Kernel extracted successfully: $KERNEL_FILE" echo "Kernel extracted successfully: $KERNEL_FILE"
# Extract kernel version from the kernel filename # Extract kernel version from the kernel filename
KERNEL_VERSION=$(basename $KERNEL_FILE | sed 's/vmlinuz-//') KERNEL_VERSION=$(basename "$KERNEL_FILE" | sed 's/vmlinuz-//')
echo "Kernel version: $KERNEL_VERSION" echo "Kernel version: $KERNEL_VERSION"
# Copy kernel modules to system location so mkinitramfs can find them # Copy kernel modules to system location so mkinitramfs can find them
echo "Copying kernel modules to system location..." echo "Copying kernel modules to system location..."
if [ -d /kernel/lib/modules/${KERNEL_VERSION} ]; then if [ -d "/kernel/lib/modules/${KERNEL_VERSION}" ]; then
cp -r /kernel/lib/modules/${KERNEL_VERSION} /lib/modules/ cp -r "/kernel/lib/modules/${KERNEL_VERSION}" /lib/modules/
else else
echo "WARNING: No modules found for kernel ${KERNEL_VERSION}" echo "WARNING: No modules found for kernel ${KERNEL_VERSION}"
fi fi
# Generate initrd using mkinitramfs # Generate initrd using mkinitramfs
echo "Generating initrd for kernel version $KERNEL_VERSION..." echo "Generating initrd for kernel version $KERNEL_VERSION..."
mkinitramfs -o /kernel/boot/initrd.img-${KERNEL_VERSION} ${KERNEL_VERSION} mkinitramfs -o "/kernel/boot/initrd.img-${KERNEL_VERSION}" "${KERNEL_VERSION}"
# Verify initrd was created # Verify initrd was created
if [ ! -f /kernel/boot/initrd.img-${KERNEL_VERSION} ]; then if [ ! -f "/kernel/boot/initrd.img-${KERNEL_VERSION}" ]; then
echo "ERROR: Failed to generate initrd" echo "ERROR: Failed to generate initrd"
exit 1 exit 1
fi fi