@@ -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 ;
@@ -1534,7 +1540,7 @@ async fn initialize_composefs_repository(
1534
1540
1535
1541
rootfs_dir
1536
1542
. create_dir_all ( "composefs" )
1537
- . context ( "Creating dir ' composefs' " ) ?;
1543
+ . context ( "Creating dir composefs" ) ?;
1538
1544
1539
1545
let repo = open_composefs_repo ( rootfs_dir) ?;
1540
1546
@@ -1549,7 +1555,10 @@ async fn initialize_composefs_repository(
1549
1555
1550
1556
fn get_booted_bls ( ) -> Result < BLSConfig > {
1551
1557
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
+ } ) ;
1553
1562
1554
1563
let Some ( booted) = booted else {
1555
1564
anyhow:: bail!( "Failed to find composefs parameter in kernel cmdline" ) ;
@@ -1741,10 +1750,10 @@ pub(crate) fn setup_composefs_bls_boot(
1741
1750
1742
1751
match & state. composefs_options {
1743
1752
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}" ) ) ;
1745
1754
}
1746
1755
None | Some ( ..) => {
1747
- cmdline_options. push_str ( & format ! ( " composefs= {id_hex}" ) ) ;
1756
+ cmdline_options. push_str ( & format ! ( " {COMPOSEFS_CMDLINE} {id_hex}" ) ) ;
1748
1757
}
1749
1758
} ;
1750
1759
@@ -1756,7 +1765,7 @@ pub(crate) fn setup_composefs_bls_boot(
1756
1765
vec ! [
1757
1766
format!( "root=UUID={DPS_UUID}" ) ,
1758
1767
RW_KARG . to_string( ) ,
1759
- format!( "composefs= {id_hex}" ) ,
1768
+ format!( "{COMPOSEFS_CMDLINE} {id_hex}" ) ,
1760
1769
]
1761
1770
. join ( " " ) ,
1762
1771
) ,
@@ -1800,9 +1809,12 @@ pub(crate) fn setup_composefs_bls_boot(
1800
1809
booted_bls. version = 0 ; // entries are sorted by their filename in reverse order
1801
1810
1802
1811
// 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
+ )
1804
1816
} else {
1805
- ( boot_dir. join ( "loader/entries" ) , None )
1817
+ ( boot_dir. join ( format ! ( "loader/{BOOT_LOADER_ENTRIES}" ) ) , None )
1806
1818
} ;
1807
1819
1808
1820
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) -
2162
2174
Ok ( ( ) )
2163
2175
}
2164
2176
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
-
2179
2177
/// Creates and populates /sysroot/state/deploy/image_id
2180
2178
#[ context( "Writing composefs state" ) ]
2181
2179
pub ( crate ) fn write_composefs_state (
0 commit comments