[grubcfg] Fix mismatched quoting and escaping.
If we use .replace("'", "'\\''") for escaping, we also need to use single quotes, not double quotes. This was broken by the port from '%' to format, which also randomly changed quoting characters for no good reason. Changing the outer ones does not matter, but \" or ' within a string is not the same thing!
This commit is contained in:
parent
b935c7db79
commit
b1169dc48c
@ -65,7 +65,7 @@ def modify_grub_default(partitions, root_mount_point, distributor):
|
|||||||
if swap_uuid:
|
if swap_uuid:
|
||||||
kernel_params.append("resume=UUID={!s}".format(swap_uuid))
|
kernel_params.append("resume=UUID={!s}".format(swap_uuid))
|
||||||
|
|
||||||
distributor_line = "GRUB_DISTRIBUTOR=\"{!s}\"".format(distributor_replace)
|
distributor_line = "GRUB_DISTRIBUTOR='{!s}'".format(distributor_replace)
|
||||||
|
|
||||||
if not os.path.exists(default_dir):
|
if not os.path.exists(default_dir):
|
||||||
os.mkdir(default_dir)
|
os.mkdir(default_dir)
|
||||||
@ -123,7 +123,7 @@ def modify_grub_default(partitions, root_mount_point, distributor):
|
|||||||
else:
|
else:
|
||||||
escaped_value = str(value).replace("'", "'\\''")
|
escaped_value = str(value).replace("'", "'\\''")
|
||||||
|
|
||||||
lines.append("{!s}=\"{!s}\"".format(key, escaped_value))
|
lines.append("{!s}='{!s}'".format(key, escaped_value))
|
||||||
|
|
||||||
if not have_kernel_cmd:
|
if not have_kernel_cmd:
|
||||||
kernel_cmd = "GRUB_CMDLINE_LINUX_DEFAULT=\"{!s}\"".format(" ".join(kernel_params))
|
kernel_cmd = "GRUB_CMDLINE_LINUX_DEFAULT=\"{!s}\"".format(" ".join(kernel_params))
|
||||||
|
Loading…
Reference in New Issue
Block a user