From eaea1483f7e150cdedb09e0dcaab3fb023277b0f Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Wed, 8 Nov 2023 14:26:22 -0500 Subject: [PATCH] fix fish support on ostree --- src/planner/ostree.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/planner/ostree.rs b/src/planner/ostree.rs index fa246a4..d5825f6 100644 --- a/src/planner/ostree.rs +++ b/src/planner/ostree.rs @@ -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