kernel-install: do not add kernel entry if already present

The entry may be already present for example when reinstalling package,
or calling the script multiple times (which apparently is the case
during system installation).

(cherry picked from commit 4d4e7cc5e9)
This commit is contained in:
Marek Marczykowski-Górecki 2016-06-03 20:51:18 +02:00
parent c3cfafd265
commit 7c8f2c3d6d
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -15,6 +15,7 @@ fi
case "$COMMAND" in
add)
if ! fgrep -q "[${KVER}]" $EFI_DIR/xen.cfg; then
# take the default section and use it as a template for the new entry
awk -F = --assign "kver=${KVER}" '
/^\[/ {
@ -57,6 +58,7 @@ case "$COMMAND" in
# then change the default
sed -e "s/default=.*/default=$KVER/" -i $EFI_DIR/xen.cfg
fi
cp "/boot/vmlinuz-$KVER" "$EFI_DIR/"
dracut -f "$EFI_DIR/initramfs-${KVER}.img" "$KVER"