Skip to content

Commit 0323a53

Browse files
committed
improve docs, move cpio module to the fs section
Signed-off-by: Zen <[email protected]>
1 parent b0cb85e commit 0323a53

File tree

4 files changed

+20
-23
lines changed

4 files changed

+20
-23
lines changed

readme.md

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,6 @@ Modules write to a shared config dict that is accessible by other modules.
144144
* `binaries` is a list used to define programs to be pulled into the initrams. `which` is used to find the path of added entries, and `lddtree` is used to resolve dependendies.
145145
* `paths` is a list of directores to create in the `build_dir`. They do not need a leading `/`.
146146

147-
#### base.cpio
148-
149-
This module handles CPIO creation.
150-
151-
* `out_file` (ugrd.cpio) Sets the name of the output file, under `out_dir` unless a path is defined.
152-
* `mknod_cpio` (true) Only create devicne nodes within the CPIO.
153-
154147
##### symlink creation
155148

156149
Symlinks are defined in the `symlinks` dict. Each entry must have a name, `source` and `target`:
@@ -193,7 +186,7 @@ minor = 1
193186

194187
Creates `/dev/console` with permissions `0o644`
195188

196-
> Using `mknod_cpio` from `ugrd.base.cpio` will not create the device nodes in the build dir, but within the CPIO archive
189+
> Using `mknod_cpio` from `ugrd.fs.cpio` will not create the device nodes in the build dir, but within the CPIO archive
197190
198191
#### base.console
199192

@@ -305,6 +298,13 @@ destination = "/mnt/extra"
305298
label = "extra"
306299
```
307300

301+
#### ugrd.fs.cpio
302+
303+
This module handles CPIO creation.
304+
305+
* `out_file` (ugrd.cpio) Sets the name of the output file, under `out_dir` unless a path is defined.
306+
* `mknod_cpio` (true) Only create devicne nodes within the CPIO.
307+
308308
##### General mount options
309309

310310
These are set at the global level and are not associated with an individual mount:
@@ -535,7 +535,7 @@ The `cpio` module imports the `make_cpio_list` packing function with:
535535

536536
```
537537
[imports.pack]
538-
"ugrd.base.base" = [ "make_cpio_list" ]
538+
"ugrd.fs.cpio" = [ "make_cpio" ]
539539
```
540540

541541
##### funcs
@@ -587,12 +587,12 @@ The `custom_init` function should return a tuple with the line used to call the
587587
def custom_init(self) -> str:
588588
"""
589589
init override for the console module.
590-
Write the main init runlevels to the self.config_dict['_custom_init_file'] file.
590+
Write the main init runlevels to self._custom_init_file.
591591
Returns the output of console_init which is the command to start agetty.
592592
"""
593-
custom_init_contents = [self.config_dict['shebang'],
594-
f"# Console module version v{__version__}"]
595-
custom_init_contents += self.generate_init_main()
593+
custom_init_contents = [self['shebang'],
594+
f"# Console module version v{__version__}",
595+
*self.generate_init_main()]
596596
597597
return console_init(self), custom_init_contents
598598
@@ -603,10 +603,10 @@ def console_init(self) -> str:
603603
Tell it to execute teh _custom_init_file
604604
If the console is a serial port, set the baud rate.
605605
"""
606-
name = self.config_dict['primary_console']
607-
console = self.config_dict['console'][name]
606+
name = self['primary_console']
607+
console = self['console'][name]
608608
609-
out_str = f"agetty --autologin root --login-program {self.config_dict['_custom_init_file']}"
609+
out_str = f"agetty --autologin root --login-program {self['_custom_init_file']}"
610610
611611
console_type = console.get('type', 'tty')
612612
@@ -618,4 +618,3 @@ def console_init(self) -> str:
618618
619619
return out_str
620620
```
621-

src/ugrd/base/base.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
modules = ["ugrd.base.core", "ugrd.fs.mounts", "ugrd.base.cpio"]
1+
modules = ["ugrd.base.core", "ugrd.fs.mounts", "ugrd.fs.cpio"]
22

33
binaries = [ "awk", "grep", "ls", "cat", "switch_root" ]
44

src/ugrd/base/cpio.py renamed to src/ugrd/fs/cpio.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ def make_cpio(self) -> None:
3030

3131

3232
def _process_out_file(self, out_file):
33-
"""
34-
Processes the out_file configuration option.
35-
"""
33+
""" Processes the out_file configuration option. """
3634
if not out_file:
3735
raise ValueError("out_file cannot be empty")
3836

src/ugrd/base/cpio.toml renamed to src/ugrd/fs/cpio.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ mknod_cpio = true
44
required_parameters = ['out_file']
55

66
[imports.config_processing]
7-
"ugrd.base.cpio" = [ "_process_out_file" ]
7+
"ugrd.fs.cpio" = [ "_process_out_file" ]
88

99
[imports.pack]
10-
"ugrd.base.cpio" = [ "make_cpio" ]
10+
"ugrd.fs.cpio" = [ "make_cpio" ]
1111

1212
[custom_parameters]
1313
out_file = "str" # The name of the cpio file to create.

0 commit comments

Comments
 (0)