Compare commits

...

4 commits

Author SHA1 Message Date
Graham Christensen 2164106795 ... 2023-11-08 20:56:48 -05:00
Graham Christensen 52aff53955 nits 2023-11-08 15:37:31 -05:00
Graham Christensen 576f3f688f fixup: use only our one shell location 2023-11-08 14:32:27 -05:00
Graham Christensen eaea1483f7 fix fish support on ostree 2023-11-08 14:26:52 -05:00

View file

@ -11,7 +11,10 @@ use crate::{
settings::{InitSystem, InstallSettingsError}, settings::{InitSystem, InstallSettingsError},
Action, BuiltinPlanner, Action, BuiltinPlanner,
}; };
use std::{collections::HashMap, path::PathBuf}; use std::{
collections::HashMap,
path::{Path, PathBuf},
};
use super::{ use super::{
linux::{ linux::{
@ -21,6 +24,19 @@ use super::{
ShellProfileLocations, 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: https://github.com/DeterminateSystems/nix-installer/issues/707
pub const OSTREE_FISH_PROFILE_LOCATION: &str = "/usr/local/share/fish/";
/// A planner suitable for immutable systems using ostree, such as Fedora Silverblue /// A planner suitable for immutable systems using ostree, such as Fedora Silverblue
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "cli", derive(clap::Parser))] #[cfg_attr(feature = "cli", derive(clap::Parser))]
@ -158,10 +174,8 @@ impl Planner for Ostree {
.iter() .iter()
.position(|v| *v == PathBuf::from("/usr/share/fish/")) .position(|v| *v == PathBuf::from("/usr/share/fish/"))
{ {
shell_profile_locations shell_profile_locations.fish.vendor_confd_prefixes =
.fish vec![OSTREE_FISH_PROFILE_LOCATION.into()];
.vendor_confd_prefixes
.remove(index);
} }
plan.push( plan.push(
@ -183,6 +197,16 @@ impl Planner for Ostree {
.map_err(PlannerError::Action)? .map_err(PlannerError::Action)?
.boxed(), .boxed(),
); );
if Path::new("/etc/fish").is_dir() {
plan.push(
CreateDirectory::plan(&OSTREE_FISH_PROFILE_LOCATION, None, None, 0o0755, true)
.await
.map_err(PlannerError::Action)?
.boxed(),
);
}
plan.push( plan.push(
ConfigureNix::plan(shell_profile_locations, &self.settings) ConfigureNix::plan(shell_profile_locations, &self.settings)
.await .await