fix fish support on ostree

This commit is contained in:
Graham Christensen 2023-11-08 14:26:22 -05:00
parent a026cc2224
commit eaea1483f7

View file

@ -21,6 +21,19 @@ use super::{
ShellProfileLocations,
};
// Fedora's ostree's fish package creates `/etc/fish` but fish doesn't read from it.
// Its fish does read from /usr/local/share/fish/, but the directory doesn't exist --
// so we ignore it.
//
// We use this const to forcefully create this directory and add it to shell locations
// to think about updating.
//
// This may not be suitable for all possible ostree based distros, but it'll fix
// a good number of selftest failures we're seeing.
//
// See: #707
pub const OSTREE_FISH_PROFILE_LOCATION: &str = "/usr/local/share/fish/";
/// A planner suitable for immutable systems using ostree, such as Fedora Silverblue
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "cli", derive(clap::Parser))]
@ -183,6 +196,16 @@ impl Planner for Ostree {
.map_err(PlannerError::Action)?
.boxed(),
);
if Path::new("/etc/fish").is_directory() {
plan.push(
CreateDirectory::plan(&OSTREE_FISH_PROFILE_LOCATION, None, None, 0o0755, true)
.await
.map_err(PlannerError::Action)?
.boxed(),
);
}
plan.push(
ConfigureNix::plan(shell_profile_locations, &self.settings)
.await