commit
28687d0d1e
@ -1,9 +1,12 @@
|
|||||||
|
# Create, overwrite or update /etc/default/grub in the target system.
|
||||||
|
#
|
||||||
# Write lines to /etc/default/grub (in the target system) based
|
# Write lines to /etc/default/grub (in the target system) based
|
||||||
# on calculated values and the values set in the *defaults* key
|
# on calculated values and the values set in the *defaults* key
|
||||||
# in this configuration file.
|
# in this configuration file.
|
||||||
#
|
#
|
||||||
# Calculated values are:
|
# Calculated values are:
|
||||||
# - GRUB_DISTRIBUTOR, branding module, *bootloaderEntryName*
|
# - GRUB_DISTRIBUTOR, branding module, *bootloaderEntryName* (this
|
||||||
|
# string is sanitized, and see also setting *keepDistributor*)
|
||||||
# - GRUB_ENABLE_CRYPTODISK, based on the presence of filesystems
|
# - GRUB_ENABLE_CRYPTODISK, based on the presence of filesystems
|
||||||
# that use LUKS
|
# that use LUKS
|
||||||
# - GRUB_CMDLINE_LINUX_DEFAULT, adding LUKS setup and plymouth
|
# - GRUB_CMDLINE_LINUX_DEFAULT, adding LUKS setup and plymouth
|
||||||
@ -14,6 +17,12 @@
|
|||||||
# already existed. If set to false, edits the existing file instead.
|
# already existed. If set to false, edits the existing file instead.
|
||||||
overwrite: false
|
overwrite: false
|
||||||
|
|
||||||
|
# If set to true, an **existing** setting for GRUB_DISTRIBUTOR is
|
||||||
|
# kept, not updated to the *bootloaderEntryName* from the branding file.
|
||||||
|
# Use this if the GRUB_DISTRIBUTOR setting in the file is "smart" in
|
||||||
|
# some way (e.g. uses shell-command substitution).
|
||||||
|
keepDistributor: false
|
||||||
|
|
||||||
# Default entries to write to /etc/default/grub if it does not exist yet or if
|
# Default entries to write to /etc/default/grub if it does not exist yet or if
|
||||||
# we are overwriting it.
|
# we are overwriting it.
|
||||||
#
|
#
|
||||||
|
@ -45,7 +45,13 @@ def modify_grub_default(partitions, root_mount_point, distributor):
|
|||||||
|
|
||||||
:param partitions:
|
:param partitions:
|
||||||
:param root_mount_point:
|
:param root_mount_point:
|
||||||
:param distributor:
|
:param distributor: name of the distributor to fill in for
|
||||||
|
GRUB_DISTRIBUTOR. Must be a string. If the job setting
|
||||||
|
*keepDistributor* is set, then this is only used if no
|
||||||
|
GRUB_DISTRIBUTOR is found at all (otherwise, when *keepDistributor*
|
||||||
|
is set, the GRUB_DISTRIBUTOR lines are left unchanged).
|
||||||
|
If *keepDistributor* is unset or false, then GRUB_DISTRIBUTOR
|
||||||
|
is always updated to set this value.
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
default_dir = os.path.join(root_mount_point, "etc/default")
|
default_dir = os.path.join(root_mount_point, "etc/default")
|
||||||
@ -172,8 +178,13 @@ def modify_grub_default(partitions, root_mount_point, distributor):
|
|||||||
have_kernel_cmd = True
|
have_kernel_cmd = True
|
||||||
elif (lines[i].startswith("#GRUB_DISTRIBUTOR")
|
elif (lines[i].startswith("#GRUB_DISTRIBUTOR")
|
||||||
or lines[i].startswith("GRUB_DISTRIBUTOR")):
|
or lines[i].startswith("GRUB_DISTRIBUTOR")):
|
||||||
|
if libcalamares.job.configuration.get("keepDistributor", false):
|
||||||
lines[i] = distributor_line
|
lines[i] = distributor_line
|
||||||
have_distributor_line = True
|
have_distributor_line = True
|
||||||
|
else:
|
||||||
|
# We're not updating because of *keepDistributor*, but if
|
||||||
|
# this was a comment line, then it's still not been set.
|
||||||
|
have_distributor_line = have_distributor_line or not lines[i].startsdwith("#")
|
||||||
else:
|
else:
|
||||||
lines = []
|
lines = []
|
||||||
|
|
||||||
|
2
src/modules/grubcfg/tests/1.global
Normal file
2
src/modules/grubcfg/tests/1.global
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
bogus: true
|
10
src/modules/grubcfg/tests/2.global
Normal file
10
src/modules/grubcfg/tests/2.global
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
bogus: true
|
||||||
|
firmwareType: bios
|
||||||
|
bootLoader: grub
|
||||||
|
rootMountPoint: /tmp/calamares
|
||||||
|
|
||||||
|
branding:
|
||||||
|
bootloaderEntryName: generic
|
||||||
|
partitions: []
|
||||||
|
|
9
src/modules/grubcfg/tests/2.job
Normal file
9
src/modules/grubcfg/tests/2.job
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
overwrite: true
|
||||||
|
keepDistributor: false
|
||||||
|
defaults:
|
||||||
|
GRUB_TIMEOUT: 5
|
||||||
|
GRUB_DEFAULT: "saved"
|
||||||
|
GRUB_DISABLE_SUBMENU: true
|
||||||
|
GRUB_TERMINAL_OUTPUT: "console"
|
||||||
|
GRUB_DISABLE_RECOVERY: true
|
Loading…
Reference in New Issue
Block a user