Skip to content

Commit 123a5a3

Browse files
committed
moved mounts to the filesystem module
Signed-off-by: Zen <[email protected]>
1 parent 03978b2 commit 123a5a3

File tree

5 files changed

+60
-59
lines changed

5 files changed

+60
-59
lines changed

readme.md

Lines changed: 52 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -81,50 +81,6 @@ Creates `/dev/console` with permissions `0o644`
8181

8282
> Using `mknod_cpio` from `ugrd.base.cpio` will not create the device nodes in the build dir, but within the CPIO archive
8383
84-
#### base.mounts
85-
86-
`mounts`: A dictionary containing entries for mounts, with their associated config.
87-
88-
`root_mount` Is a dict that acts similarly to user defined `mounts`. `destination` is hardcoded to `/mnt/root`.
89-
90-
Each mount has the following available parameters:
91-
92-
* `type` (auto) the mount or filesystem type. Setting the `type` to `vfat` includes the `vfat` kernel module automatically.
93-
* `destination` (/mount name) the mountpoint for the mount, if left unset will use /mount_name.
94-
* `source` The source string or a dict with a key containing the source type, where the value is the target.
95-
- `uuid` Mount by the filesystem UUID.
96-
- `partuuid` Mount by the partition UUID.
97-
- `label` Mount by the device label.
98-
* `base_mount` (false) is used for builtin mounts such as `/dev`, `/sys`, and `/proc`. Setting this to mounts it with a mount command in `init_pre` instead of using `mount -a` in `init_main`.
99-
* `skip_unmount` (false) is used for the builtin `/dev` mount, since it will fail to unmount when in use. Like the name suggests, this skips running `umount` during `init_final`.
100-
* `remake_mountpoint` will recreate the mountpoint with mkdir before the `mount -a` is called. This is useful for `/dev/pty`.
101-
102-
The most minimal mount entry that can be created must have a name, which will be used as the `destination`, and a `source`.
103-
104-
The following configuration mounts the device with `uuid` `ABCD-1234` at `/boot`:
105-
106-
```
107-
[mounts.boot.source]
108-
uuid = "ABCD-1234"
109-
```
110-
111-
The following configuration mounts the device with `label` `extra` to `/mnt/extra`:
112-
113-
```
114-
[mounts.extra]
115-
destination = "/mnt/extra"
116-
117-
[mounts.extra.source]
118-
label = "extra"
119-
```
120-
121-
##### General mount options
122-
123-
These are set at the global level and are not associated with an individual mount:
124-
125-
* `mount_wait` (false) waits for user input before attenmpting to mount the generated fstab at `init_main`.
126-
* `mount_timeout` timeout for `mount_wait` to automatically continue.
127-
12884
#### base.console
12985

13086
This module creates an agetty session. This is used by the `ugrd.crypto.gpg` module so the tty can be used for input and output.
@@ -199,29 +155,74 @@ Similarly `base.ugrd.kmod_novideo` and `kmod_nosound` exist to ignore video and
199155

200156
### Filesystem modules
201157

202-
#### fs.btrfs
158+
#### ugrd.fs.mounts
159+
160+
`mounts`: A dictionary containing entries for mounts, with their associated config.
161+
162+
`root_mount` Is a dict that acts similarly to user defined `mounts`. `destination` is hardcoded to `/mnt/root`.
163+
164+
Each mount has the following available parameters:
165+
166+
* `type` (auto) the mount or filesystem type. Setting the `type` to `vfat` includes the `vfat` kernel module automatically.
167+
* `destination` (/mount name) the mountpoint for the mount, if left unset will use /mount_name.
168+
* `source` The source string or a dict with a key containing the source type, where the value is the target.
169+
- `uuid` Mount by the filesystem UUID.
170+
- `partuuid` Mount by the partition UUID.
171+
- `label` Mount by the device label.
172+
* `base_mount` (false) is used for builtin mounts such as `/dev`, `/sys`, and `/proc`. Setting this to mounts it with a mount command in `init_pre` instead of using `mount -a` in `init_main`.
173+
* `skip_unmount` (false) is used for the builtin `/dev` mount, since it will fail to unmount when in use. Like the name suggests, this skips running `umount` during `init_final`.
174+
* `remake_mountpoint` will recreate the mountpoint with mkdir before the `mount -a` is called. This is useful for `/dev/pty`.
175+
176+
The most minimal mount entry that can be created must have a name, which will be used as the `destination`, and a `source`.
177+
178+
The following configuration mounts the device with `uuid` `ABCD-1234` at `/boot`:
179+
180+
```
181+
[mounts.boot.source]
182+
uuid = "ABCD-1234"
183+
```
184+
185+
The following configuration mounts the device with `label` `extra` to `/mnt/extra`:
186+
187+
```
188+
[mounts.extra]
189+
destination = "/mnt/extra"
190+
191+
[mounts.extra.source]
192+
label = "extra"
193+
```
194+
195+
##### General mount options
196+
197+
These are set at the global level and are not associated with an individual mount:
198+
199+
* `mount_wait` (false) waits for user input before attenmpting to mount the generated fstab at `init_main`.
200+
* `mount_timeout` timeout for `mount_wait` to automatically continue.
201+
202+
203+
#### ugrd.fs.btrfs
203204

204205
Importing this module will run `btrfs device scan` and pull btrfs modules. No config is required.
205206

206207
### Cryptographic modules
207208

208209
Several cryptographic modules are provided, mostly to assist in mounting encrypted volumes and handling keyfiles.
209210

210-
#### crypto.gpg
211+
#### ugrd.crypto.gpg
211212

212213
This module is required to perform GPG decryption within the initramfs. It depends on the `ugrd.base.console` module for agetty, which is required for input.
213214

214215
No configuration options are provided by this module, but it does set the `primary_console` to `tty0` and creates the console entry for it.
215216
This configuration can be overriden in the specified user config if an actual serial interface is used, this is demonstrated in `config_raid_crypt_serial.toml`
216217

217-
#### crypto.smartcard
218+
#### ugrd.crypto.smartcard
218219

219220
Depends on the `ugrd.crypto.gpg` submodule, meant to be used with a YubiKey.
220221

221222
`sc_public_key` should point to the public key associated with the smarcard used to decrypt the GPG protected LUKS keyfile.
222223
This file is added as a dependency and pulled into the initramfs.
223224

224-
#### crypto.cryptsetup
225+
#### ugrd.crypto.cryptsetup
225226

226227
This module is used to decrypt LUKS volumes in the initramfs.
227228

@@ -271,7 +272,7 @@ For example:
271272

272273
```
273274
[imports.build_tasks]
274-
"base.base" = [ "generate_fstab" ]
275+
"ugrd.fs.mounts" = [ "generate_fstab" ]
275276
```
276277

277278
Is used in the base module to make the initramfs generator generate a fstab durinf the `build_tasks` phase.
@@ -327,7 +328,7 @@ This module is loaded in the imports section of the `base.yaml` file:
327328

328329
```
329330
[imports.config_processing]
330-
"ugrd.base.base" = [ "_process_mounts_multi" ]
331+
"ugrd.fs.mounts" = [ "_process_mounts_multi" ]
331332
```
332333

333334
#### build_tasks
@@ -338,7 +339,7 @@ The base module includes a build task for generating the fstab, which is activat
338339

339340
```
340341
[imports.build_tasks]
341-
"ugrd.base.base" = [ "generate_fstab" ]
342+
"ugrd.fs.mounts" = [ "generate_fstab" ]
342343
```
343344

344345
#### Packing tasks

ugrd/base/base.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
shebang = "#!/bin/bash"
22

3-
modules = ["ugrd.base.core", "ugrd.base.mounts"]
3+
modules = ["ugrd.base.core", "ugrd.fs.mounts"]
44

55
binaries = [ "bash", "ls", "cat", "switch_root" ]
66

File renamed without changes.

ugrd/base/mounts.toml renamed to ugrd/fs/mounts.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,22 @@ paths = [ "mnt/root" ]
1212
mount_wait = false
1313

1414
[imports.config_processing]
15-
"ugrd.base.mounts" = [ "_process_mounts_multi" ]
15+
"ugrd.fs.mounts" = [ "_process_mounts_multi" ]
1616

1717
[imports.build_tasks]
18-
"ugrd.base.mounts" = [ "generate_fstab" ]
18+
"ugrd.fs.mounts" = [ "generate_fstab" ]
1919

2020
[imports.init_pre]
21-
"ugrd.base.mounts" = [ "mount_base" ]
21+
"ugrd.fs.mounts" = [ "mount_base" ]
2222

2323
[imports.init_main]
24-
"ugrd.base.mounts" = [ "remake_mountpoints", "mount_fstab" ]
24+
"ugrd.fs.mounts" = [ "remake_mountpoints", "mount_fstab" ]
2525

2626
[imports.init_mount]
27-
"ugrd.base.mounts" = [ "mount_root" ]
27+
"ugrd.fs.mounts" = [ "mount_root" ]
2828

2929
[imports.init_final]
30-
"ugrd.base.mounts" = [ "clean_mounts" ]
30+
"ugrd.fs.mounts" = [ "clean_mounts" ]
3131

3232
[custom_parameters]
3333
mounts = "dict" # Add the mounts property, used to define the mounts to be made in the fstab

ugrd/initramfs_generator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
__author__ = "desultory"
3-
__version__ = "0.7.2"
3+
__version__ = "0.7.3"
44

55
from tomllib import load
66
from pathlib import Path

0 commit comments

Comments
 (0)