Files
fish/install.sh
T

85 lines
2.1 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
detect_pkg_manager() {
if command -v apt &>/dev/null; then
echo "apt"
elif command -v dnf &>/dev/null; then
echo "dnf"
elif command -v pacman &>/dev/null; then
echo "pacman"
elif command -v zypper &>/dev/null; then
echo "zypper"
else
echo "unknown"
fi
}
install_fish() {
local pm
pm=$(detect_pkg_manager)
case "$pm" in
apt)
sudo apt update && sudo apt install -y fish
;;
dnf)
sudo dnf install -y fish
;;
pacman)
sudo pacman -S --noconfirm fish
;;
zypper)
sudo zypper install -y fish
;;
*)
echo "No supported package manager found. Please install fish manually: https://fishshell.com"
exit 1
;;
esac
}
install_omf() {
if [ ! -d "$HOME/.local/share/omf" ]; then
echo "Installing Oh My Fish..."
curl https://raw.githubusercontent.com/oh-my-fish/oh-my-fish/master/bin/install > install
fish install --path=~/.local/share/omf --config=~/.config/omf
else
echo "Oh My Fish already installed."
fi
}
install_bobthefish() {
if command -v fish &>/dev/null && [ -f "$HOME/.local/share/omf/init.fish" ]; then
echo "Installing bobthefish theme..."
fish -c 'omf install bobthefish'
fi
}
set_default_shell() {
local fish_path
fish_path=$(command -v fish)
if [ "$SHELL" != "$fish_path" ]; then
echo "Setting default shell to fish..."
if grep -q "^$USER:" /etc/passwd 2>/dev/null; then
chsh -s "$fish_path"
else
echo "Run this manually: chsh -s $fish_path"
fi
else
echo "Fish is already your default shell."
fi
}
main() {
install_fish
install_omf # add way to choose fisher and add ln -s $fisher_path/themes $__fish_config_dir/themes
install_bobthefish
set_default_shell
echo
echo "=== Installation complete ==="
echo "Log out and back in, or run: exec fish"
}
main