Skip to content

Commit 3baecf4

Browse files
authored
Merge pull request #152 from cgwalters/drop-default-filesystem
install: Drop default config
2 parents b9b311f + d43e995 commit 3baecf4

File tree

6 files changed

+31
-12
lines changed

6 files changed

+31
-12
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ all-test:
88

99
install:
1010
install -D -m 0755 -t $(DESTDIR)$(prefix)/bin target/release/bootc
11-
install -D -m 0644 -t $(DESTDIR)$(prefix)/lib/bootc/install lib/src/install/*.toml
11+
install -d $(DESTDIR)$(prefix)/lib/bootc/install
1212
if test -d man; then install -D -m 0644 -t $(DESTDIR)$(prefix)/share/man/man8 man/*.8; fi
1313

1414
bin-archive: all

docs/install.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ other options.
4343
Here's an example:
4444

4545
```
46-
$ podman run --privileged --pid=host --net=none --security-opt label=type:unconfined_t ghcr.io/cgwalters/c9s-oscore bootc install --target-no-signature-verification /path/to/disk
46+
$ podman run --privileged --pid=host --net=none --security-opt label=type:unconfined_t <image> bootc install --target-no-signature-verification /path/to/disk
4747
```
4848

4949
Note that while `--privileged` is used, this command will not
@@ -58,6 +58,23 @@ an installation by default is not fetching anything else external
5858
from the network - the content to be installed
5959
*is the running container image content*.
6060

61+
### Operating system install configuration required
62+
63+
The container image must define its default install configuration. For example,
64+
create `/usr/lib/bootc/install/00-exampleos.toml` with the contents:
65+
66+
```
67+
[install]
68+
root-fs-type = "xfs"
69+
```
70+
71+
At the current time, `root-fs-type` is the only available configuration option, and it must be set.
72+
73+
Configuration files found in this directory will be merged, with higher alphanumeric values
74+
taking precedence. If for example you are building a derived container image from the above OS,
75+
you coudl create a `50-myos.toml` that sets `root-fs-type = "btrfs"` which will override the
76+
prior setting.
77+
6178
### Note: Today `bootc install` has a host requirement on `skopeo`
6279

6380
The one exception to host requirements today is that the host must
@@ -110,7 +127,7 @@ The `AuthorizedKeysFile` invocation below then configures sshd to look
110127
for keys in this location.
111128

112129
```
113-
FROM ghcr.io/cgwalters/c9s-oscore
130+
FROM <image>
114131
RUN mkdir -p /usr/etc-system/ && \
115132
echo 'AuthorizedKeysFile /usr/etc-system/%u.keys' >> /etc/ssh/sshd_config.d/30-auth-system.conf && \
116133
echo 'ssh-ed25519 AAAAC3Nza... [email protected]' > /usr/etc-system/root.keys && chmod 0600 /usr/etc-system/keys && \

lib/src/install.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,15 +405,20 @@ pub(crate) mod config {
405405
config = c.install;
406406
}
407407
}
408-
config.ok_or_else(|| anyhow::anyhow!("Failed to find any installation config files"))
408+
config.ok_or_else(|| anyhow::anyhow!("No bootc/install config found; this operating system must define a default configuration to be installable"))
409409
}
410410

411411
#[test]
412412
/// Verify that we can parse our default config file
413413
fn test_parse_config() {
414414
use super::baseline::Filesystem;
415-
let buf = include_str!("install/00-defaults.toml");
416-
let c: InstallConfigurationToplevel = toml::from_str(buf).unwrap();
415+
416+
let c: InstallConfigurationToplevel = toml::from_str(
417+
r##"[install]
418+
root-fs-type = "xfs"
419+
"##,
420+
)
421+
.unwrap();
417422
let mut install = c.install.unwrap();
418423
assert_eq!(install.root_fs_type.unwrap(), Filesystem::Xfs);
419424
let other = InstallConfigurationToplevel {

lib/src/install/00-defaults.toml

Lines changed: 0 additions & 3 deletions
This file was deleted.

lib/src/privtests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ fn test_install_filesystem(image: &str, blockdev: &Utf8Path) -> Result<()> {
152152
let mountpoint: &Utf8Path = mountpoint_dir.path().try_into().unwrap();
153153

154154
// And run the install
155-
cmd!(sh, "podman run --rm --privileged --pid=host --net=none --env=RUST_LOG -v /usr/bin/bootc:/usr/bin/bootc -v /usr/lib/bootc:/usr/lib/bootc -v {mountpoint}:/target-root {image} bootc install-to-filesystem /target-root").run()?;
155+
cmd!(sh, "podman run --rm --privileged --pid=host --net=none --env=RUST_LOG -v /usr/bin/bootc:/usr/bin/bootc -v {mountpoint}:/target-root {image} bootc install-to-filesystem /target-root").run()?;
156156

157157
cmd!(sh, "umount -R {mountpoint}").run()?;
158158

tests/kolainst/install

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
set -xeuo pipefail
1212

1313
# See https://github.com/cgwalters/bootc-base-images
14-
IMAGE=ghcr.io/cgwalters/fedora-oscore:latest
14+
IMAGE=registry.gitlab.com/centos/cloud/sagano/fedora-boot-tier-0:38
1515
# TODO: better detect this, e.g. look for an empty device
1616
DEV=/dev/vda
1717

@@ -20,7 +20,7 @@ cd $(mktemp -d)
2020

2121
case "${AUTOPKGTEST_REBOOT_MARK:-}" in
2222
"")
23-
podman run --rm -ti --privileged --pid=host --net=none -v /usr/bin/bootc:/usr/bin/bootc -v /usr/lib/bootc:/usr/lib/bootc ${IMAGE} bootc install --karg=foo=bar ${DEV}
23+
podman run --rm -ti --privileged --pid=host --net=none -v /usr/bin/bootc:/usr/bin/bootc ${IMAGE} bootc install --karg=foo=bar ${DEV}
2424
# In theory we could e.g. wipe the bootloader setup on the primary disk, then reboot;
2525
# but for now let's just sanity test that the install command executes.
2626
lsblk ${DEV}

0 commit comments

Comments
 (0)