Skip to content

Commit b091e0f

Browse files
authored
Merge pull request #1502 from cgwalters/composefs-add-lost-commits
composefs: Add missed commits when rebasing
2 parents d9b384d + 95bbfe6 commit b091e0f

File tree

12 files changed

+878
-306
lines changed

12 files changed

+878
-306
lines changed

crates/lib/src/bls_config.rs

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

crates/lib/src/cli.rs

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -819,13 +819,29 @@ async fn upgrade_composefs(_opts: UpgradeOpts) -> Result<()> {
819819
};
820820

821821
let boot_type = BootType::from(&entry);
822+
let mut boot_digest = None;
822823

823824
match boot_type {
824-
BootType::Bls => setup_composefs_bls_boot(BootSetupType::Upgrade, repo, &id, entry),
825-
BootType::Uki => setup_composefs_uki_boot(BootSetupType::Upgrade, repo, &id, entry),
826-
}?;
825+
BootType::Bls => {
826+
boot_digest = Some(setup_composefs_bls_boot(
827+
BootSetupType::Upgrade,
828+
repo,
829+
&id,
830+
entry,
831+
)?)
832+
}
827833

828-
write_composefs_state(&Utf8PathBuf::from("/sysroot"), id, imgref, true, boot_type)?;
834+
BootType::Uki => setup_composefs_uki_boot(BootSetupType::Upgrade, repo, &id, entry)?,
835+
};
836+
837+
write_composefs_state(
838+
&Utf8PathBuf::from("/sysroot"),
839+
id,
840+
imgref,
841+
true,
842+
boot_type,
843+
boot_digest,
844+
)?;
829845

830846
Ok(())
831847
}
@@ -987,18 +1003,27 @@ async fn switch_composefs(opts: SwitchOpts) -> Result<()> {
9871003
};
9881004

9891005
let boot_type = BootType::from(&entry);
1006+
let mut boot_digest = None;
9901007

9911008
match boot_type {
992-
BootType::Bls => setup_composefs_bls_boot(BootSetupType::Upgrade, repo, &id, entry),
993-
BootType::Uki => setup_composefs_uki_boot(BootSetupType::Upgrade, repo, &id, entry),
994-
}?;
1009+
BootType::Bls => {
1010+
boot_digest = Some(setup_composefs_bls_boot(
1011+
BootSetupType::Upgrade,
1012+
repo,
1013+
&id,
1014+
entry,
1015+
)?)
1016+
}
1017+
BootType::Uki => setup_composefs_uki_boot(BootSetupType::Upgrade, repo, &id, entry)?,
1018+
};
9951019

9961020
write_composefs_state(
9971021
&Utf8PathBuf::from("/sysroot"),
9981022
id,
9991023
&target_imgref,
10001024
true,
10011025
boot_type,
1026+
boot_digest,
10021027
)?;
10031028

10041029
Ok(())

crates/lib/src/composefs_consts.rs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/// composefs= paramter in kernel cmdline
2+
pub const COMPOSEFS_CMDLINE: &str = "composefs";
3+
4+
/// Directory to store transient state, such as staged deployemnts etc
5+
pub(crate) const COMPOSEFS_TRANSIENT_STATE_DIR: &str = "/run/composefs";
6+
/// File created in /run/composefs to record a staged-deployment
7+
pub(crate) const COMPOSEFS_STAGED_DEPLOYMENT_FNAME: &str = "staged-deployment";
8+
9+
/// Absolute path to composefs-native state directory
10+
pub(crate) const STATE_DIR_ABS: &str = "/sysroot/state/deploy";
11+
/// Relative path to composefs-native state directory. Relative to /sysroot
12+
pub(crate) const STATE_DIR_RELATIVE: &str = "state/deploy";
13+
/// Relative path to the shared 'var' directory. Relative to /sysroot
14+
pub(crate) const SHARED_VAR_PATH: &str = "state/os/default/var";
15+
16+
/// Section in .origin file to store boot related metadata
17+
pub(crate) const ORIGIN_KEY_BOOT: &str = "boot";
18+
/// Whether the deployment was booted with BLS or UKI
19+
pub(crate) const ORIGIN_KEY_BOOT_TYPE: &str = "boot_type";
20+
/// Key to store the SHA256 sum of vmlinuz + initrd for a deployment
21+
pub(crate) const ORIGIN_KEY_BOOT_DIGEST: &str = "digest";
22+
23+
/// Filename for `loader/entries`
24+
pub(crate) const BOOT_LOADER_ENTRIES: &str = "entries";
25+
/// Filename for staged boot loader entries
26+
pub(crate) const STAGED_BOOT_LOADER_ENTRIES: &str = "entries.staged";
27+
/// Filename for rollback boot loader entries
28+
pub(crate) const ROLLBACK_BOOT_LOADER_ENTRIES: &str = STAGED_BOOT_LOADER_ENTRIES;
29+
30+
/// Filename for grub user config
31+
pub(crate) const USER_CFG: &str = "user.cfg";
32+
/// Filename for staged grub user config
33+
pub(crate) const USER_CFG_STAGED: &str = "user.cfg.staged";
34+
/// Filename for rollback grub user config
35+
pub(crate) const USER_CFG_ROLLBACK: &str = USER_CFG_STAGED;

0 commit comments

Comments
 (0)