pengqianheng / rpms / kernel

Forked from rpms/kernel a year ago
Clone
Justin Vreeland 794d92
#!/bin/bash
Justin Vreeland 794d92
set -e
Justin Vreeland 794d92
Justin Vreeland 1fc083
# shellcheck disable=SC1091
Justin Vreeland 794d92
. /etc/os-release
Justin Vreeland 794d92
Justin Vreeland 794d92
kernelver=$1 && shift
Justin Vreeland 794d92
rootfs=$1 && shift
Justin Vreeland 794d92
variant=$1 && shift
Justin Vreeland 794d92
Justin Vreeland 794d92
output="${rootfs}/lib/modules/${kernelver}/bls.conf"
Justin Vreeland 794d92
date=$(date -u +%Y%m%d%H%M%S)
Justin Vreeland 794d92
Justin Vreeland 794d92
if [ "${variant:-5}" = "debug" ]; then
Justin Vreeland 794d92
    debugname=" with debugging"
Justin Vreeland 794d92
    debugid="-debug"
Justin Vreeland 794d92
else
Justin Vreeland 794d92
    debugname=""
Justin Vreeland 794d92
    debugid=""
Justin Vreeland 794d92
fi
Justin Vreeland 794d92
Justin Vreeland 1fc083
# shellcheck will complain about bootprefix being referenced but not assigned,
Justin Vreeland 1fc083
# but that is perfectly OK here.
Justin Vreeland 1fc083
# shellcheck disable=SC2154
Justin Vreeland 1fc083
cat > "$output" <
Justin Vreeland 794d92
title ${NAME} (${kernelver}) ${VERSION}${debugname}
Justin Vreeland 794d92
version ${kernelver}${debugid}
Justin Vreeland 794d92
linux ${bootprefix}/vmlinuz-${kernelver}
Justin Vreeland 794d92
initrd ${bootprefix}/initramfs-${kernelver}.img
Justin Vreeland 794d92
options \$kernelopts
Justin Vreeland 1fc083
id ${ID}-${date}-${kernelver}${debugid}
Justin Vreeland 794d92
grub_users \$grub_users
Justin Vreeland 794d92
grub_arg --unrestricted
Justin Vreeland 794d92
grub_class kernel${variant}
Justin Vreeland 794d92
EOF