kernel-install: don't fail on kernel removal in non-EFI installs
In non-EFI installation /boot/efi/EFI/qubes may not exists. In this case do not try to touch (non-existing) files there. Fixes QubesOS/qubes-issues#1829
This commit is contained in:
parent
85effc2946
commit
f7eaa7bec2
@ -64,22 +64,24 @@ case "$COMMAND" in
|
|||||||
remove)
|
remove)
|
||||||
# don't care about changing default= line - yum should prevent removing
|
# don't care about changing default= line - yum should prevent removing
|
||||||
# currently running kernel
|
# currently running kernel
|
||||||
awk -F = --assign "kver=${KVER}" '
|
if [ -r $EFI_DIR/xen.cfg ]; then
|
||||||
/^\[/ {
|
awk -F = --assign "kver=${KVER}" '
|
||||||
# section header - previous section (if any) ended
|
/^\[/ {
|
||||||
|
# section header - previous section (if any) ended
|
||||||
|
|
||||||
in_current=0;
|
in_current=0;
|
||||||
}
|
|
||||||
/^\[/ {
|
|
||||||
if ($0 == "[" kver "]")
|
|
||||||
in_current=1;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
if (!in_current) {
|
|
||||||
print;
|
|
||||||
}
|
}
|
||||||
}' $EFI_DIR/xen.cfg > $EFI_DIR/xen.cfg.new
|
/^\[/ {
|
||||||
mv $EFI_DIR/xen.cfg.new $EFI_DIR/xen.cfg
|
if ($0 == "[" kver "]")
|
||||||
|
in_current=1;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
if (!in_current) {
|
||||||
|
print;
|
||||||
|
}
|
||||||
|
}' $EFI_DIR/xen.cfg > $EFI_DIR/xen.cfg.new
|
||||||
|
mv $EFI_DIR/xen.cfg.new $EFI_DIR/xen.cfg
|
||||||
|
fi
|
||||||
rm -f "$EFI_DIR/initramfs-${KVER}.img"
|
rm -f "$EFI_DIR/initramfs-${KVER}.img"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
Loading…
Reference in New Issue
Block a user