Skip to content

Commit 3ed9a84

Browse files
committed
set the kernel log level to 5 by default
Signed-off-by: Zen <[email protected]>
1 parent bbb10c2 commit 3ed9a84

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/ugrd/base/base.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
__author__ = 'desultory'
2-
__version__ = '4.9.0'
2+
__version__ = '4.9.1'
33

44
from importlib.metadata import version
55
from pathlib import Path
@@ -52,8 +52,14 @@ def _find_init(self) -> str:
5252
'return 1']
5353

5454

55+
def set_loglevel(self) -> list[str]:
56+
""" Returns bash to set the log level. """
57+
self['exports']['loglevel'] = self['loglevel']
58+
return 'readvar loglevel > /proc/sys/kernel/printk'
59+
60+
5561
@contains('init_target', 'init_target must be set.', raise_exception=True)
56-
def do_switch_root(self) -> str:
62+
def do_switch_root(self) -> list[str]:
5763
"""
5864
Should be the final statement, switches root.
5965
Checks if the root mount is mounted and that it contains an init.

src/ugrd/base/base.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ binaries = [ "awk", "grep", "ls", "cp", "cat", "switch_root" ]
99

1010
paths = [ "root" ]
1111

12+
loglevel = 5
1213
shebang = "#!/bin/bash -l"
1314
autodetect_init = true
1415

@@ -18,6 +19,9 @@ autodetect_init = true
1819
[imports.build_pre]
1920
"ugrd.base.base" = [ "autodetect_init" ]
2021

22+
[imports.init_early]
23+
"ugrd.base.base" = [ "set_loglevel" ]
24+
2125
[imports.init_final]
2226
"ugrd.base.base" = [ "do_switch_root" ]
2327

@@ -29,4 +33,5 @@ autodetect_init = true
2933
[custom_parameters]
3034
init_target = "Path" # Specifies the location of the system init file
3135
autodetect_init = "bool" # If set to true, the init_target will be autodetected based on the system's init system
36+
loglevel = "int" # Set the kernel log level at /proc/sys/kernel/printk
3237
shebang = "str" # Add the shebang property, used because this is a bash script

0 commit comments

Comments
 (0)