Skip to content

Commit a4fe8d9

Browse files
tarkahermo
authored andcommitted
Fix error when moss remove all packages (glibc)
1 parent b2d1966 commit a4fe8d9

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

moss/src/client/mod.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ impl Client {
242242
pub fn new_state(&self, selections: &[Selection], summary: impl ToString) -> Result<Option<State>, Error> {
243243
let old_state = self.installation.active_state;
244244

245-
let fstree = self.blit_root(selections.iter().map(|s| &s.package), old_state.map(state::Id::next))?;
245+
let fstree = self.blit_root(selections.iter().map(|s| &s.package))?;
246246

247247
match &self.scope {
248248
Scope::Stateful => {
@@ -519,7 +519,6 @@ impl Client {
519519
fn blit_root<'a>(
520520
&self,
521521
packages: impl IntoIterator<Item = &'a package::Id>,
522-
state_id: Option<state::Id>,
523522
) -> Result<vfs::tree::Tree<PendingFile>, Error> {
524523
let progress = ProgressBar::new(1).with_style(
525524
ProgressStyle::with_template("\n|{bar:20.red/blue}| {pos}/{len} {msg}")
@@ -688,7 +687,14 @@ BUG_REPORT_URL="https://github.com/serpent-os""#,
688687
tx = state_id.unwrap_or_default()
689688
);
690689

691-
fs::write(root.join("usr").join("lib").join("os-release"), os_release)?;
690+
// It's possible this doesn't exist if
691+
// we remove all packages (=
692+
let dir = root.join("usr").join("lib");
693+
if !dir.exists() {
694+
fs::create_dir(&dir)?;
695+
}
696+
697+
fs::write(dir.join("os-release"), os_release)?;
692698

693699
Ok(())
694700
}

0 commit comments

Comments
 (0)