-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfish.sh
executable file
·40 lines (34 loc) · 1.26 KB
/
fish.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env bash
# installs fish
function dotfiles_fish {
source "$(dirname "${BASH_SOURCE[0]}")/sudo.sh"
# if fish is already in PATH exit
if [[ -n $(command -v fish 2>/dev/null) ]] ; then
echo 'dotfiles_fish: fish is already installed!'
return 0
fi
if [[ -z $(command -v apt 2>/dev/null) || $(uname -s) != 'Linux' ]] ; then
echo 'dotfiles_fish: Unsupported OS'
return 1
fi
# install `apt-add-repository`
if [[ -z $(command -v apt-add-repository 2>/dev/null) ]] ; then
dotfiles_sudo apt-get update
dotfiles_sudo apt-get install -y software-properties-common
fi
# install fish
dotfiles_sudo apt-add-repository -y ppa:fish-shell/release-3
dotfiles_sudo apt-get update
dotfiles_sudo apt-get install -y fish | grep -v 'warning: ' # ignore update-alternatives warnings
# install fisher if ~/.config/fish/fish_plugins exists
local url='https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish'
if [[ -f ~/.config/fish/fish_plugins || -L ~/.config/fish/fish_plugins ]] ; then
fish -c "curl -fsSL $url | source && fisher update"
else
fish -c "curl -fsSL $url | source && fisher install jorgebucaran/fisher@main"
fi
}
# if not sourced
if [[ ${BASH_SOURCE[0]} = "$0" ]] ; then
dotfiles_fish "$@"
fi