@@ -76,10 +76,16 @@ use serde::{Deserialize, Serialize};
76
76
use self :: baseline:: InstallBlockDeviceOpts ;
77
77
use crate :: bls_config:: { parse_bls_config, BLSConfig } ;
78
78
use 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
+ } ;
79
85
use crate :: containerenv:: ContainerExecutionInfo ;
80
86
use crate :: deploy:: {
81
87
get_sorted_uki_boot_entries, prepare_for_pull, pull_from_prepared, PreparedImportMeta ,
82
- PreparedPullResult , USER_CFG , USER_CFG_STAGED ,
88
+ PreparedPullResult ,
83
89
} ;
84
90
use crate :: lsm;
85
91
use crate :: parsers:: grub_menuconfig:: MenuEntry ;
@@ -1537,7 +1543,7 @@ async fn initialize_composefs_repository(
1537
1543
1538
1544
rootfs_dir
1539
1545
. create_dir_all ( "composefs" )
1540
- . context ( "Creating dir ' composefs' " ) ?;
1546
+ . context ( "Creating dir composefs" ) ?;
1541
1547
1542
1548
let repo = open_composefs_repo ( rootfs_dir) ?;
1543
1549
@@ -1552,7 +1558,10 @@ async fn initialize_composefs_repository(
1552
1558
1553
1559
fn get_booted_bls ( ) -> Result < BLSConfig > {
1554
1560
let cmdline = crate :: kernel:: parse_cmdline ( ) ?;
1555
- let booted = cmdline. iter ( ) . find_map ( |x| x. strip_prefix ( "composefs=" ) ) ;
1561
+ let booted = cmdline. iter ( ) . find_map ( |x| {
1562
+ x. strip_prefix ( COMPOSEFS_INSECURE_CMDLINE )
1563
+ . or_else ( || x. strip_prefix ( COMPOSEFS_CMDLINE ) )
1564
+ } ) ;
1556
1565
1557
1566
let Some ( booted) = booted else {
1558
1567
anyhow:: bail!( "Failed to find composefs parameter in kernel cmdline" ) ;
@@ -1744,10 +1753,10 @@ pub(crate) fn setup_composefs_bls_boot(
1744
1753
1745
1754
match & state. composefs_options {
1746
1755
Some ( opt) if opt. insecure => {
1747
- cmdline_options. push_str ( & format ! ( " composefs=? {id_hex}" ) ) ;
1756
+ cmdline_options. push_str ( & format ! ( " {COMPOSEFS_INSECURE_CMDLINE} {id_hex}" ) ) ;
1748
1757
}
1749
1758
None | Some ( ..) => {
1750
- cmdline_options. push_str ( & format ! ( " composefs= {id_hex}" ) ) ;
1759
+ cmdline_options. push_str ( & format ! ( " {COMPOSEFS_CMDLINE} {id_hex}" ) ) ;
1751
1760
}
1752
1761
} ;
1753
1762
@@ -1759,7 +1768,7 @@ pub(crate) fn setup_composefs_bls_boot(
1759
1768
vec ! [
1760
1769
format!( "root=UUID={DPS_UUID}" ) ,
1761
1770
RW_KARG . to_string( ) ,
1762
- format!( "composefs= {id_hex}" ) ,
1771
+ format!( "{COMPOSEFS_CMDLINE} {id_hex}" ) ,
1763
1772
]
1764
1773
. join ( " " ) ,
1765
1774
) ,
@@ -1803,9 +1812,12 @@ pub(crate) fn setup_composefs_bls_boot(
1803
1812
booted_bls. version = 0 ; // entries are sorted by their filename in reverse order
1804
1813
1805
1814
// This will be atomically renamed to 'loader/entries' on shutdown/reboot
1806
- ( boot_dir. join ( "loader/entries.staged" ) , Some ( booted_bls) )
1815
+ (
1816
+ boot_dir. join ( format ! ( "loader/{STAGED_BOOT_LOADER_ENTRIES}" ) ) ,
1817
+ Some ( booted_bls) ,
1818
+ )
1807
1819
} else {
1808
- ( boot_dir. join ( "loader/entries" ) , None )
1820
+ ( boot_dir. join ( format ! ( "loader/{BOOT_LOADER_ENTRIES}" ) ) , None )
1809
1821
} ;
1810
1822
1811
1823
create_dir_all ( & entries_path) . with_context ( || format ! ( "Creating {:?}" , entries_path) ) ?;
@@ -2165,20 +2177,6 @@ fn setup_composefs_boot(root_setup: &RootSetup, state: &State, image_id: &str) -
2165
2177
Ok ( ( ) )
2166
2178
}
2167
2179
2168
- pub ( crate ) const COMPOSEFS_TRANSIENT_STATE_DIR : & str = "/run/composefs" ;
2169
- /// File created in /run/composefs to record a staged-deployment
2170
- pub ( crate ) const COMPOSEFS_STAGED_DEPLOYMENT_FNAME : & str = "staged-deployment" ;
2171
-
2172
- /// Absolute path to composefs-native state directory
2173
- pub ( crate ) const STATE_DIR_ABS : & str = "/sysroot/state/deploy" ;
2174
- /// Relative path to composefs-native state directory. Relative to /sysroot
2175
- pub ( crate ) const STATE_DIR_RELATIVE : & str = "state/deploy" ;
2176
-
2177
- pub ( crate ) const ORIGIN_KEY_BOOT : & str = "boot" ;
2178
- pub ( crate ) const ORIGIN_KEY_BOOT_TYPE : & str = "boot_type" ;
2179
- /// Key to store the SHA256 sum of vmlinuz + initrd for a deployment
2180
- pub ( crate ) const ORIGIN_KEY_BOOT_DIGEST : & str = "digest" ;
2181
-
2182
2180
/// Creates and populates /sysroot/state/deploy/image_id
2183
2181
#[ context( "Writing composefs state" ) ]
2184
2182
pub ( crate ) fn write_composefs_state (
0 commit comments