-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap-fish.sh
executable file
·75 lines (62 loc) · 1.7 KB
/
bootstrap-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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
## This script attempts to install the complete Fish shell environment.
echo_status() {
echo -e "\033[1m\033[32m***\033[94m" $* "\033[0m"
}
echo_error() {
echo -e "\033[1m\033[31m!!!\033[31m" $* "\033[0m"
}
if [ $(id -u) = 0 ]; then
echo_error "This script shouldn't be run as root."
exit 1
fi
while [[ $# -gt 0 ]]; do
case $1 in
--force)
FORCE_INSTALL=YES
shift # past argument
;;
-h|--help)
SHOW_HELP=YES
shift # past argument
;;
-*|--*)
echo_error "Unknown option $1"
exit 1
;;
*)
SHOW_HELP=YES
shift # past argument
;;
esac
done
if [[ -n "${SHOW_HELP}" ]]; then
echo "Usage: bootstrap-fish.sh [--force]"
echo ""
echo "This script will install a complete Fish shell environment."
echo "Use the --force option to run this script even if Fish is already"
echo "installed."
exit 0
fi
if which fish >/dev/null 2>&1 && [[ -z "$FORCE_INSTALL" ]]; then
echo_status "fish is already installed."
echo ""
echo "Note: use --force if you want to run this script anyway."
exit 0
fi
echo_status "Installing fish"
sudo dnf install --assumeyes fish
if ! which fish >/dev/null 2>&1 ; then
echo_error "Installation of fish failed."
exit 1
fi
echo_status "Syncing fish configuration"
mkdir -p ~/.config/fish
rsync -au --exclude-from=.sync-exclude dot-files/.config/fish/ ~/.config/fish/
echo_status "Installing fisher"
fish --no-config -c "curl -sL https://git.io/fisher | source"
echo_status "Installing plugins via fisher"
fish -c "fisher update"
fish install/starship.fish
echo_status "Setting" $(which fish) "as the default shell for" $USER
chsh --shell $(which fish) $USER