[grubcfg] snake-case one configuration key

This makes all the keys in grubcfg consistently
snake-case (rather than one being a camel).
This commit is contained in:
Adriaan de Groot 2022-02-02 15:02:58 +01:00
parent d1e4740e70
commit a352bd946e
6 changed files with 11 additions and 14 deletions

View File

@ -9,7 +9,7 @@
# #
# Calculated values are: # Calculated values are:
# - GRUB_DISTRIBUTOR, branding module, *bootloaderEntryName* (this # - GRUB_DISTRIBUTOR, branding module, *bootloaderEntryName* (this
# string is sanitized, and see also setting *keepDistributor*) # string is sanitized, and see also setting *keep_distributor*)
# - 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
@ -29,9 +29,7 @@ prefer_grub_d: false
# kept, not updated to the *bootloaderEntryName* from the branding file. # kept, not updated to the *bootloaderEntryName* from the branding file.
# Use this if the GRUB_DISTRIBUTOR setting in the file is "smart" in # Use this if the GRUB_DISTRIBUTOR setting in the file is "smart" in
# some way (e.g. uses shell-command substitution). # some way (e.g. uses shell-command substitution).
# keep_distributor: false
# TODO:3.3:snake-case this key
keepDistributor: false
# The default kernel params that should always be applied. # The default kernel params that should always be applied.
# This is an array of strings. If it is unset, the default is # This is an array of strings. If it is unset, the default is

View File

@ -7,8 +7,7 @@ additionalProperties: false
type: object type: object
properties: properties:
overwrite: { type: boolean, default: false } overwrite: { type: boolean, default: false }
# TODO:3.3:snake-case this key keep_istributor: { type: boolean, default: false }
keepDistributor: { type: boolean, default: false }
prefer_grub_d: { type: boolean, default: false } prefer_grub_d: { type: boolean, default: false }
kernel_params: { type: array, items: { type: string } } kernel_params: { type: array, items: { type: string } }
defaults: defaults:

View File

@ -95,10 +95,10 @@ def modify_grub_default(partitions, root_mount_point, distributor):
:param root_mount_point: :param root_mount_point:
:param distributor: name of the distributor to fill in for :param distributor: name of the distributor to fill in for
GRUB_DISTRIBUTOR. Must be a string. If the job setting GRUB_DISTRIBUTOR. Must be a string. If the job setting
*keepDistributor* is set, then this is only used if no *keep_distributor* is set, then this is only used if no
GRUB_DISTRIBUTOR is found at all (otherwise, when *keepDistributor* GRUB_DISTRIBUTOR is found at all (otherwise, when *keep_distributor*
is set, the GRUB_DISTRIBUTOR lines are left unchanged). is set, the GRUB_DISTRIBUTOR lines are left unchanged).
If *keepDistributor* is unset or false, then GRUB_DISTRIBUTOR If *keep_distributor* is unset or false, then GRUB_DISTRIBUTOR
is always updated to set this value. is always updated to set this value.
:return: :return:
""" """
@ -230,11 +230,11 @@ 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): if libcalamares.job.configuration.get("keep_distributor", False):
lines[i] = distributor_line lines[i] = distributor_line
have_distributor_line = True have_distributor_line = True
else: else:
# We're not updating because of *keepDistributor*, but if # We're not updating because of *keep_distributor*, but if
# this was a comment line, then it's still not been set. # this was a comment line, then it's still not been set.
have_distributor_line = have_distributor_line or not lines[i].startswith("#") have_distributor_line = have_distributor_line or not lines[i].startswith("#")
# If btrfs or f2fs is used, don't save default # If btrfs or f2fs is used, don't save default

View File

@ -2,7 +2,7 @@
# SPDX-License-Identifier: CC0-1.0 # SPDX-License-Identifier: CC0-1.0
--- ---
overwrite: true overwrite: true
keepDistributor: false keep_distributor: false
defaults: defaults:
GRUB_TIMEOUT: 5 GRUB_TIMEOUT: 5
GRUB_DEFAULT: "saved" GRUB_DEFAULT: "saved"

View File

@ -3,7 +3,7 @@
--- ---
overwrite: true overwrite: true
prefer_grub_d: true # But it doesn't exist prefer_grub_d: true # But it doesn't exist
keepDistributor: false keep_distributor: false
defaults: defaults:
GRUB_TIMEOUT: 5 GRUB_TIMEOUT: 5
GRUB_DEFAULT: "saved" GRUB_DEFAULT: "saved"

View File

@ -3,7 +3,7 @@
--- ---
overwrite: true overwrite: true
prefer_grub_d: true prefer_grub_d: true
keepDistributor: false keep_distributor: false
defaults: defaults:
GRUB_TIMEOUT: 5 GRUB_TIMEOUT: 5
GRUB_DEFAULT: "saved" GRUB_DEFAULT: "saved"