@@ -79,8 +79,8 @@ use crate::boundimage::{BoundImage, ResolvedBoundImage};
79
79
use crate :: composefs_consts:: {
80
80
BOOT_LOADER_ENTRIES , COMPOSEFS_CMDLINE , COMPOSEFS_INSECURE_CMDLINE ,
81
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 ,
82
+ ORIGIN_KEY_BOOT_DIGEST , ORIGIN_KEY_BOOT_TYPE , SHARED_VAR_PATH , STAGED_BOOT_LOADER_ENTRIES ,
83
+ STATE_DIR_ABS , STATE_DIR_RELATIVE , USER_CFG , USER_CFG_STAGED ,
84
84
} ;
85
85
use crate :: containerenv:: ContainerExecutionInfo ;
86
86
use crate :: deploy:: {
@@ -93,7 +93,7 @@ use crate::progress_jsonl::ProgressWriter;
93
93
use crate :: spec:: ImageReference ;
94
94
use crate :: store:: Storage ;
95
95
use crate :: task:: Task ;
96
- use crate :: utils:: sigpolicy_from_opt;
96
+ use crate :: utils:: { path_relative_to , sigpolicy_from_opt} ;
97
97
use bootc_mount:: { inspect_filesystem, Filesystem } ;
98
98
99
99
/// The toplevel boot directory
@@ -2189,11 +2189,15 @@ pub(crate) fn write_composefs_state(
2189
2189
create_dir_all ( state_path. join ( "etc/upper" ) ) ?;
2190
2190
create_dir_all ( state_path. join ( "etc/work" ) ) ?;
2191
2191
2192
- let actual_var_path = root_path. join ( format ! ( "state/os/fedora/var" ) ) ;
2192
+ let actual_var_path = root_path. join ( SHARED_VAR_PATH ) ;
2193
2193
create_dir_all ( & actual_var_path) ?;
2194
2194
2195
- symlink ( Path :: new ( "../../os/fedora/var" ) , state_path. join ( "var" ) )
2196
- . context ( "Failed to create symlink for /var" ) ?;
2195
+ symlink (
2196
+ path_relative_to ( state_path. as_std_path ( ) , actual_var_path. as_std_path ( ) )
2197
+ . context ( "Getting var symlink path" ) ?,
2198
+ state_path. join ( "var" ) ,
2199
+ )
2200
+ . context ( "Failed to create symlink for /var" ) ?;
2197
2201
2198
2202
let ImageReference {
2199
2203
image : image_name,
0 commit comments