-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathfish.sh
executable file
·49 lines (38 loc) · 1.35 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
41
42
43
44
45
46
47
48
49
#!/bin/sh
DOTFILES_BOOTSTRAP=false . ./bootstrap.sh
package="fish"
install_packages_if_necessary curl $package || die "Installing curl or ${package} failed"
fish_path=$(command -v fish)
login_shell="unknown"
if [ "$(uname -s)" = "Darwin" ]; then
login_shell=$(finger "$USER" | perl -n -e'/.*Shell\:\s+(.*)/ && print $1')
elif [ "$(uname -s)" = "Linux" ]; then
login_shell=$(getent passwd "$LOGNAME" | cut -d: -f7)
fi
if ! [ "$login_shell" = "$fish_path" ]; then
info "Changing the login shell to fish..."
sudo chsh -s "${fish_path}" "$USER"
else
info "The login shell is already fish"
fi
info "Appending saved fish_history to current fish_history"
mkdir -p ~/.local/share/fish 2>/dev/null
tmpfile="$(mktemp)"
trap 'rm -f -- "$tmpfile"' INT TERM HUP EXIT
./decrypt.sh ./secrets/fish_history "$tmpfile"
cat "$tmpfile" >> ~/.local/share/fish/fish_history
rm -f "$tmpfile"
info "Installing fisher..."
command "${fish_path}" \
-c 'curl -sL https://git.io/fisher | source && fisher install jorgebucaran/fisher' \
|| die "Installing fisher failed"
# TODO: use fishfile?
command "${fish_path}" \
-c 'fisher install \
mwilliammyers/pack \
mwilliammyers/handy \
mwilliammyers/google-cloud-sdk \
mwilliammyers/j \
jethrokuan/fzf \
patrickf3139/Colored-Man-Pages'
./starship.sh