Skip to content

Commit bbb10c2

Browse files
committed
set cmdline args in a config var, not hardcoded
Signed-off-by: Zen <[email protected]>
1 parent 5682809 commit bbb10c2

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/ugrd/base/cmdline.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
__author__ = 'desultory'
2-
__version__ = '2.3.1'
3-
4-
5-
CMDLINE_BOOLS = ['quiet', 'debug', 'recovery', 'rootwait']
6-
CMDLINE_STRINGS = ['init', 'root', 'roottype', 'rootflags', 'rootdelay']
2+
__version__ = '2.4.0'
73

84

95
def parse_cmdline_bool(self) -> str:
@@ -32,10 +28,10 @@ def parse_cmdline(self) -> str:
3228
""" Returns bash script to parse /proc/cmdline """
3329
return [r'''cmdline=$(awk -F '--' '{print $1}' /proc/cmdline)''', # Get everything before '--'
3430
r'''setvar INIT_ARGS "$(awk -F '--' '{print $2}' /proc/cmdline)"''', # Get everything after '--'
35-
f'''for bool in {" ".join([f'"{bool}"' for bool in CMDLINE_BOOLS])}; do''',
31+
f'''for bool in {" ".join([f'"{bool}"' for bool in self['cmdline_bools']])}; do''',
3632
' parse_cmdline_bool "$bool"',
3733
'done',
38-
f'''for string in {" ".join([f'"{string}"' for string in CMDLINE_STRINGS])}; do''',
34+
f'''for string in {" ".join([f'"{string}"' for string in self['cmdline_strings']])}; do''',
3935
' parse_cmdline_str "$string"',
4036
'done',
4137
'einfo "Parsed cmdline: $cmdline"']

src/ugrd/base/cmdline.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
cmdline_bools = ['quiet', 'debug', 'recovery', 'rootwait']
2+
cmdline_strings = ['init', 'root', 'roottype', 'rootflags', 'rootdelay', 'loglevel']
3+
4+
15
[imports.init_pre]
26
"ugrd.base.cmdline" = [ "export_exports", "parse_cmdline" ]
37

@@ -9,4 +13,6 @@
913

1014
[custom_parameters]
1115
exports = "dict" # Add the exports property, used to specify the exports for the init script
16+
cmdline_bools = "NoDupFlatList" # set the booleans to be procesed from /proc/cmdline
17+
cmdline_strings = "NoDupFlatList" # set the strings to be procesed from /proc/cmdline
1218
_init_mount = "NoDupFlatList" # List contaning functions which were removed from imports.int_mount by refactor_mounts

0 commit comments

Comments
 (0)