-
Notifications
You must be signed in to change notification settings - Fork 4
/
install.sh
executable file
·114 lines (103 loc) · 3.17 KB
/
install.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/usr/bin/env bash
install_fonts_linux() {
echo "installing fonts. Clone is bulky but we're only installing a single font"
pushd /tmp
git clone --filter=blob:none --sparse git@github.com:ryanoasis/nerd-fonts
cd nerd-fonts
git sparse-checkout add patched-fonts/Hack
./install.sh Hack
popd
}
install_brew() {
BREW=https://raw.githubusercontent.com/Homebrew/install/master/install
if command -v brew > /dev/null; then
echo -e "${OK_MSG} Using brew package manager"
else
echo -e "${OK_MSG} Brew package manager not found."
while true; do
read -p "Install brew to continue automatic install?" yn
case $yn in
[Yy]* )
if [ ! `command -v xcode-select` ]; then
echo "[+] Installing xcode command line tools."
xcode-select --install;
fi
ruby -e "$(curl -fsSL ${BREW})"
break;;
[Nn]* )
echo "[+] Please perform a manual installation"
exit;;
* ) echo "Please answer yes or no.";;
esac
done
fi
}
get_linux_dist() {
if [ -f /etc/os-release ]; then
# freedesktop.org and systemd
. /etc/os-release
OS=$NAME
VER=$VERSION_ID
elif type lsb_release >/dev/null 2>&1; then
# linuxbase.org
OS=$(lsb_release -si)
VER=$(lsb_release -sr)
elif [ -f /etc/lsb-release ]; then
# For some versions of Debian/Ubuntu without lsb_release command
. /etc/lsb-release
OS=$DISTRIB_ID
VER=$DISTRIB_RELEASE
elif [ -f /etc/debian_version ]; then
# Older Debian/Ubuntu/etc.
OS=Debian
VER=$(cat /etc/debian_version)
elif [ -f /etc/SuSe-release ]; then
# Older SuSE/etc.
OS=SUSE
elif [ -f /etc/redhat-release ]; then
# Red Hat
OS=$(sudo cat /etc/redhat-release | awk '{print $1 $2}')
VER=$(sudo cat /etc/redhat-release | \
awk '{n=split($0,a," "); print a[n-1]}')
else
# Fall back to uname, e.g. "Linux <version>", also works for BSD, etc.
OS=$(uname -s)
VER=$(uname -r)
fi
}
setup_mac() {
install_brew
echo "installing fonts"
brew install font-hack-nerd-font
echo "${OK_MSG} Setting mason requirements up"
# https://github.com/williamboman/mason.nvim#requirements
for pkg in neovim; do
if brew ls --versions ${pkg} > /dev/null; then
echo -e "\t Skipping $pkg -- already installed"
else
echo -e "\t Installing $pkg"
brew install $pkg > /dev/null 2>/dev/null
fi
done
}
setup_linux() {
echo "${OK_MSG} Setting things up"
get_linux_dist
# FIXME on debian
# apt-get install python3-pynvim
install_fonts_linux
}
install() {
uname="$(uname -s)"
case "${uname}" in
Linux*)
setup_linux;;
Darwin*)
setup_mac;;
*)
echo "Default installer may not work for you!"
echo "Please attempt a manual installation for neovim"
exit 1
esac
}
install