@@ -76,10 +76,16 @@ use serde::{Deserialize, Serialize};
7676use self :: baseline:: InstallBlockDeviceOpts ;
7777use crate :: bls_config:: { parse_bls_config, BLSConfig } ;
7878use crate :: boundimage:: { BoundImage , ResolvedBoundImage } ;
79+ use crate :: composefs_consts:: {
80+ BOOT_LOADER_ENTRIES , COMPOSEFS_CMDLINE , COMPOSEFS_INSECURE_CMDLINE ,
81+ COMPOSEFS_STAGED_DEPLOYMENT_FNAME , COMPOSEFS_TRANSIENT_STATE_DIR , ORIGIN_KEY_BOOT ,
82+ ORIGIN_KEY_BOOT_DIGEST , ORIGIN_KEY_BOOT_TYPE , STAGED_BOOT_LOADER_ENTRIES , STATE_DIR_ABS ,
83+ STATE_DIR_RELATIVE , USER_CFG , USER_CFG_STAGED ,
84+ } ;
7985use crate :: containerenv:: ContainerExecutionInfo ;
8086use crate :: deploy:: {
8187 get_sorted_uki_boot_entries, prepare_for_pull, pull_from_prepared, PreparedImportMeta ,
82- PreparedPullResult , USER_CFG , USER_CFG_STAGED ,
88+ PreparedPullResult ,
8389} ;
8490use crate :: lsm;
8591use crate :: parsers:: grub_menuconfig:: MenuEntry ;
@@ -1534,7 +1540,7 @@ async fn initialize_composefs_repository(
15341540
15351541 rootfs_dir
15361542 . create_dir_all ( "composefs" )
1537- . context ( "Creating dir ' composefs' " ) ?;
1543+ . context ( "Creating dir composefs" ) ?;
15381544
15391545 let repo = open_composefs_repo ( rootfs_dir) ?;
15401546
@@ -1549,7 +1555,10 @@ async fn initialize_composefs_repository(
15491555
15501556fn get_booted_bls ( ) -> Result < BLSConfig > {
15511557 let cmdline = crate :: kernel:: parse_cmdline ( ) ?;
1552- let booted = cmdline. iter ( ) . find_map ( |x| x. strip_prefix ( "composefs=" ) ) ;
1558+ let booted = cmdline. iter ( ) . find_map ( |x| {
1559+ x. strip_prefix ( COMPOSEFS_INSECURE_CMDLINE )
1560+ . or_else ( || x. strip_prefix ( COMPOSEFS_CMDLINE ) )
1561+ } ) ;
15531562
15541563 let Some ( booted) = booted else {
15551564 anyhow:: bail!( "Failed to find composefs parameter in kernel cmdline" ) ;
@@ -1741,10 +1750,10 @@ pub(crate) fn setup_composefs_bls_boot(
17411750
17421751 match & state. composefs_options {
17431752 Some ( opt) if opt. insecure => {
1744- cmdline_options. push_str ( & format ! ( " composefs=? {id_hex}" ) ) ;
1753+ cmdline_options. push_str ( & format ! ( " {COMPOSEFS_INSECURE_CMDLINE} {id_hex}" ) ) ;
17451754 }
17461755 None | Some ( ..) => {
1747- cmdline_options. push_str ( & format ! ( " composefs= {id_hex}" ) ) ;
1756+ cmdline_options. push_str ( & format ! ( " {COMPOSEFS_CMDLINE} {id_hex}" ) ) ;
17481757 }
17491758 } ;
17501759
@@ -1756,7 +1765,7 @@ pub(crate) fn setup_composefs_bls_boot(
17561765 vec ! [
17571766 format!( "root=UUID={DPS_UUID}" ) ,
17581767 RW_KARG . to_string( ) ,
1759- format!( "composefs= {id_hex}" ) ,
1768+ format!( "{COMPOSEFS_CMDLINE} {id_hex}" ) ,
17601769 ]
17611770 . join ( " " ) ,
17621771 ) ,
@@ -1800,9 +1809,12 @@ pub(crate) fn setup_composefs_bls_boot(
18001809 booted_bls. version = 0 ; // entries are sorted by their filename in reverse order
18011810
18021811 // This will be atomically renamed to 'loader/entries' on shutdown/reboot
1803- ( boot_dir. join ( "loader/entries.staged" ) , Some ( booted_bls) )
1812+ (
1813+ boot_dir. join ( format ! ( "loader/{STAGED_BOOT_LOADER_ENTRIES}" ) ) ,
1814+ Some ( booted_bls) ,
1815+ )
18041816 } else {
1805- ( boot_dir. join ( "loader/entries" ) , None )
1817+ ( boot_dir. join ( format ! ( "loader/{BOOT_LOADER_ENTRIES}" ) ) , None )
18061818 } ;
18071819
18081820 create_dir_all ( & entries_path) . with_context ( || format ! ( "Creating {:?}" , entries_path) ) ?;
@@ -2162,20 +2174,6 @@ fn setup_composefs_boot(root_setup: &RootSetup, state: &State, image_id: &str) -
21622174 Ok ( ( ) )
21632175}
21642176
2165- pub ( crate ) const COMPOSEFS_TRANSIENT_STATE_DIR : & str = "/run/composefs" ;
2166- /// File created in /run/composefs to record a staged-deployment
2167- pub ( crate ) const COMPOSEFS_STAGED_DEPLOYMENT_FNAME : & str = "staged-deployment" ;
2168-
2169- /// Absolute path to composefs-native state directory
2170- pub ( crate ) const STATE_DIR_ABS : & str = "/sysroot/state/deploy" ;
2171- /// Relative path to composefs-native state directory. Relative to /sysroot
2172- pub ( crate ) const STATE_DIR_RELATIVE : & str = "state/deploy" ;
2173-
2174- pub ( crate ) const ORIGIN_KEY_BOOT : & str = "boot" ;
2175- pub ( crate ) const ORIGIN_KEY_BOOT_TYPE : & str = "boot_type" ;
2176- /// Key to store the SHA256 sum of vmlinuz + initrd for a deployment
2177- pub ( crate ) const ORIGIN_KEY_BOOT_DIGEST : & str = "digest" ;
2178-
21792177/// Creates and populates /sysroot/state/deploy/image_id
21802178#[ context( "Writing composefs state" ) ]
21812179pub ( crate ) fn write_composefs_state (
0 commit comments