kdumpst-load: Don't unnecessarily recreate GRUB config on pstore load
What happens here is that the way GRUB's cmdline _removal_ was implemented so far, it tries to remove "crashkernel=" from GRUB in pstore case, based on kdumpst configuration. BUT it generates the GRUB config no matter what, so if users added a crashkernel entry themselves, that doesn't match kdumpst config file, what happens now is: 1) The code will try to sed-out our crashkernel setting from GRUB's config, with no success (since our particular setting's not there); 2) GRUB config *will be* recreated by kdumpst (needlessly). Fix that by checking if our crashkernel tuning is there before the sed command is attempted (and the GRUB config, recreated). Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
This commit is contained in:
@ -26,6 +26,11 @@ grub_update() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" = "pstore" ] && [ "${CRASHK}" -ne 0 ]; then
|
if [ "$1" = "pstore" ] && [ "${CRASHK}" -ne 0 ]; then
|
||||||
|
# Let's be sure our cmdline is there...
|
||||||
|
if ! grep -q "${GRUB_CMDLINE}" "${GRUB_CFG_FILE}"; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
sed -i "s/\"${GRUB_CMDLINE}/\"/g" "${GRUB_CFG_FILE}"
|
sed -i "s/\"${GRUB_CMDLINE}/\"/g" "${GRUB_CFG_FILE}"
|
||||||
|
|
||||||
if ! grub-mkconfig -o "${GRUB_BOOT_FILE}" 1>/dev/null; then
|
if ! grub-mkconfig -o "${GRUB_BOOT_FILE}" 1>/dev/null; then
|
||||||
|
|||||||
Reference in New Issue
Block a user