Skip to content

Commit b688a90

Browse files
committed
install: add root_path for RootSetup
When `install to-filesystem` on ostree OS, will pass `root_path` to bootupctl to install bootloader. Signed-off-by: Huijing Hei <[email protected]>
1 parent 1f0a312 commit b688a90

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

crates/lib/src/install.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,6 +1073,7 @@ pub(crate) struct RootSetup {
10731073
pub(crate) physical_root_path: Utf8PathBuf,
10741074
/// Directory file descriptor for the above physical root.
10751075
pub(crate) physical_root: Dir,
1076+
pub(crate) root_path: Option<Utf8PathBuf>,
10761077
pub(crate) rootfs_uuid: Option<String>,
10771078
/// True if we should skip finalizing
10781079
skip_finalize: bool,
@@ -1514,7 +1515,7 @@ async fn install_with_sysroot(
15141515
Bootloader::Grub => {
15151516
crate::bootloader::install_via_bootupd(
15161517
&rootfs.device_info,
1517-
&rootfs.physical_root_path,
1518+
&rootfs.root_path,
15181519
&state.config_opts,
15191520
Some(&deployment_path.as_str()),
15201521
)?;
@@ -1986,9 +1987,9 @@ pub(crate) async fn install_to_filesystem(
19861987
.context("Mounting host / to {ALONGSIDE_ROOT_MOUNT}")?;
19871988
}
19881989

1990+
let root_path = &fsopts.root_path;
19891991
// Check that the target is a directory
19901992
{
1991-
let root_path = &fsopts.root_path;
19921993
let st = root_path
19931994
.symlink_metadata()
19941995
.with_context(|| format!("Querying target filesystem {root_path}"))?;
@@ -1999,7 +2000,6 @@ pub(crate) async fn install_to_filesystem(
19992000

20002001
// Check to see if this happens to be the real host root
20012002
if !fsopts.acknowledge_destructive {
2002-
let root_path = &fsopts.root_path;
20032003
let rootfs_fd = Dir::open_ambient_dir(root_path, cap_std::ambient_authority())
20042004
.with_context(|| format!("Opening target root directory {root_path}"))?;
20052005
warn_on_host_root(&rootfs_fd)?;
@@ -2019,7 +2019,6 @@ pub(crate) async fn install_to_filesystem(
20192019

20202020
// Get a file descriptor for the root path
20212021
let rootfs_fd = {
2022-
let root_path = &fsopts.root_path;
20232022
let rootfs_fd = Dir::open_ambient_dir(&fsopts.root_path, cap_std::ambient_authority())
20242023
.with_context(|| format!("Opening target root directory {root_path}"))?;
20252024

@@ -2175,6 +2174,7 @@ pub(crate) async fn install_to_filesystem(
21752174
device_info,
21762175
physical_root_path: fsopts.root_path,
21772176
physical_root: rootfs_fd,
2177+
root_path: Some(root_path.clone()),
21782178
rootfs_uuid: inspect.uuid.clone(),
21792179
boot,
21802180
kargs,

crates/lib/src/install/baseline.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,7 @@ pub(crate) fn install_create_rootfs(
467467
device_info,
468468
physical_root_path,
469469
physical_root,
470+
root_path: None,
470471
rootfs_uuid: Some(root_uuid.to_string()),
471472
boot,
472473
kargs,

0 commit comments

Comments
 (0)