Skip to content

Commit 53db0e9

Browse files
committed
Update sysroot to rootcxt to make the var consistent
1 parent 9ef528d commit 53db0e9

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed

src/bios.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -159,15 +159,15 @@ impl Component for Bios {
159159

160160
fn adopt_update(
161161
&self,
162-
sysroot: &RootContext,
162+
rootcxt: &RootContext,
163163
update: &ContentMetadata,
164164
) -> Result<InstalledContent> {
165-
let bios_devices = blockdev::find_colocated_bios_boot(&sysroot.devices)?;
165+
let bios_devices = blockdev::find_colocated_bios_boot(&rootcxt.devices)?;
166166
let Some(meta) = self.query_adopt(&bios_devices)? else {
167167
anyhow::bail!("Failed to find adoptable system")
168168
};
169169

170-
let mut parent_devices = sysroot.devices.iter();
170+
let mut parent_devices = rootcxt.devices.iter();
171171
let Some(parent) = parent_devices.next() else {
172172
anyhow::bail!("Failed to find parent device");
173173
};
@@ -177,8 +177,8 @@ impl Component for Bios {
177177
"Found multiple parent devices {parent} and {next}; not currently supported"
178178
);
179179
}
180-
self.run_grub_install(sysroot.path.as_str(), &parent)?;
181-
log::debug!("Install grub modules on {parent}");
180+
self.run_grub_install(rootcxt.path.as_str(), &parent)?;
181+
log::debug!("Installed grub modules on {parent}");
182182
Ok(InstalledContent {
183183
meta: update.clone(),
184184
filetree: None,
@@ -190,12 +190,12 @@ impl Component for Bios {
190190
get_component_update(sysroot, self)
191191
}
192192

193-
fn run_update(&self, sysroot: &RootContext, _: &InstalledContent) -> Result<InstalledContent> {
193+
fn run_update(&self, rootcxt: &RootContext, _: &InstalledContent) -> Result<InstalledContent> {
194194
let updatemeta = self
195-
.query_update(&sysroot.sysroot)?
195+
.query_update(&rootcxt.sysroot)?
196196
.expect("update available");
197197

198-
let mut parent_devices = sysroot.devices.iter();
198+
let mut parent_devices = rootcxt.devices.iter();
199199
let Some(parent) = parent_devices.next() else {
200200
anyhow::bail!("Failed to find parent device");
201201
};
@@ -206,7 +206,7 @@ impl Component for Bios {
206206
);
207207
}
208208

209-
self.run_grub_install(sysroot.path.as_str(), &parent)?;
209+
self.run_grub_install(rootcxt.path.as_str(), &parent)?;
210210
log::debug!("Install grub modules on {parent}");
211211

212212
let adopted_from = None;

src/blockdev.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ pub fn find_colocated_esps(devices: &Vec<String>) -> Result<Option<Vec<String>>>
6363
if esps.is_empty() {
6464
return Ok(None);
6565
}
66-
log::debug!("Find esp partitions: {esps:?}");
66+
log::debug!("Found esp partitions: {esps:?}");
6767
Ok(Some(esps))
6868
}
6969

@@ -93,6 +93,6 @@ pub fn find_colocated_bios_boot(devices: &Vec<String>) -> Result<Option<Vec<Stri
9393
if bios_boots.is_empty() {
9494
return Ok(None);
9595
}
96-
log::debug!("Find bios_boot partitions: {bios_boots:?}");
96+
log::debug!("Found bios_boot partitions: {bios_boots:?}");
9797
Ok(Some(bios_boots))
9898
}

src/component.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub(crate) trait Component {
3434
/// Given an adoptable system and an update, perform the update.
3535
fn adopt_update(
3636
&self,
37-
sysroot: &RootContext,
37+
rootcxt: &RootContext,
3838
update: &ContentMetadata,
3939
) -> Result<InstalledContent>;
4040

@@ -66,7 +66,7 @@ pub(crate) trait Component {
6666
/// Used on the client to run an update.
6767
fn run_update(
6868
&self,
69-
sysroot: &RootContext,
69+
rootcxt: &RootContext,
7070
current: &InstalledContent,
7171
) -> Result<InstalledContent>;
7272

src/efi.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,10 @@ impl Component for Efi {
267267
/// Given an adoptable system and an update, perform the update.
268268
fn adopt_update(
269269
&self,
270-
sysroot: &RootContext,
270+
rootcxt: &RootContext,
271271
updatemeta: &ContentMetadata,
272272
) -> Result<InstalledContent> {
273-
let esp_devices = blockdev::find_colocated_esps(&sysroot.devices)?;
273+
let esp_devices = blockdev::find_colocated_esps(&rootcxt.devices)?;
274274
let Some(meta) = self.query_adopt(&esp_devices)? else {
275275
anyhow::bail!("Failed to find adoptable system")
276276
};
@@ -286,12 +286,12 @@ impl Component for Efi {
286286
"Found multiple esp devices {esp} and {next_esp}; not currently supported"
287287
);
288288
}
289-
let destpath = &self.ensure_mounted_esp(sysroot.path.as_ref(), Path::new(&esp))?;
289+
let destpath = &self.ensure_mounted_esp(rootcxt.path.as_ref(), Path::new(&esp))?;
290290

291291
let destdir = &openat::Dir::open(&destpath.join("EFI"))
292292
.with_context(|| format!("opening EFI dir {}", destpath.display()))?;
293293
validate_esp(&destdir)?;
294-
let updated = sysroot
294+
let updated = rootcxt
295295
.sysroot
296296
.sub_dir(&component_updatedirname(self))
297297
.context("opening update dir")?;
@@ -353,22 +353,22 @@ impl Component for Efi {
353353

354354
fn run_update(
355355
&self,
356-
sysroot: &RootContext,
356+
rootcxt: &RootContext,
357357
current: &InstalledContent,
358358
) -> Result<InstalledContent> {
359359
let currentf = current
360360
.filetree
361361
.as_ref()
362362
.ok_or_else(|| anyhow::anyhow!("No filetree for installed EFI found!"))?;
363-
let sysroot_dir = &sysroot.sysroot;
363+
let sysroot_dir = &rootcxt.sysroot;
364364
let updatemeta = self.query_update(sysroot_dir)?.expect("update available");
365365
let updated = sysroot_dir
366366
.sub_dir(&component_updatedirname(self))
367367
.context("opening update dir")?;
368368
let updatef = filetree::FileTree::new_from_dir(&updated).context("reading update dir")?;
369369
let diff = currentf.diff(&updatef)?;
370370

371-
let Some(esp_devices) = blockdev::find_colocated_esps(&sysroot.devices)? else {
371+
let Some(esp_devices) = blockdev::find_colocated_esps(&rootcxt.devices)? else {
372372
anyhow::bail!("Failed to find all esp devices");
373373
};
374374
let mut devices = esp_devices.iter();
@@ -381,7 +381,7 @@ impl Component for Efi {
381381
"Found multiple esp devices {esp} and {next_esp}; not currently supported"
382382
);
383383
}
384-
let destpath = &self.ensure_mounted_esp(sysroot.path.as_ref(), Path::new(&esp))?;
384+
let destpath = &self.ensure_mounted_esp(rootcxt.path.as_ref(), Path::new(&esp))?;
385385

386386
let destdir = &openat::Dir::open(&destpath.join("EFI"))
387387
.with_context(|| format!("opening EFI dir {}", destpath.display()))?;

0 commit comments

Comments
 (0)