-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall
executable file
·62 lines (53 loc) · 1.44 KB
/
install
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
#!/bin/bash
set -eux -o pipefail
os="???"
if [[ $(uname) == "Darwin" ]]; then
os="mac"
elif [[ -f /etc/manjaro-release ]]; then
os="manjaro"
elif [[ -f /etc/centos-release ]]; then
os="centos"
elif grep -q Ubuntu /etc/lsb-release; then
os="ubuntu"
elif grep -q Debian /etc/os-release; then
os="debian"
fi
if [[ "${os}" == "???" ]]; then
echo "unsupported operating system. bye."
exit 1
fi
if [ ! "$(command -v git)" ]; then
if [[ "${os}" == "mac" ]]; then
brew install -f git
elif [[ "${os}" == "manjaro" ]]; then
sudo pacman -Syu git
elif [[ "${os}" == "centos" ]]; then
sudo yum install -y git
elif [[ "${os}" == "ubuntu" || "${os}" == "debian" ]]; then
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y git
fi
fi
if [ ! "$(command -v curl)" ]; then
if [[ "${os}" == "ubuntu" || "${os}" == "debian" ]]; then
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y curl
fi
fi
if [ ! "$(command -v go)" ]; then
if [[ "${os}" == "manjaro" ]]; then
sudo pacman --noconfirm -Syu go
else
pushd ./templates/packages/go
./shared.sh
popd
fi
fi
echo "building for ${os}"
go build -o ./bin/cfg ./cmd/cfg
echo "done"
./bin/cfg
# Run a custom installer if one has been created.
if [[ -f "${HOME}/bin/install-custom-config" ]]; then
"${HOME}/bin/install-custom-config"
fi