-
Notifications
You must be signed in to change notification settings - Fork 0
/
init_tools.sh
45 lines (37 loc) · 995 Bytes
/
init_tools.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
#!/bin/bash
set -o pipefail
function initMacosX() {
ssh-add --apple-use-keychain
}
# shellcheck disable=SC2154
if [[ ${platform} == "darwin" ]]; then
if [[ ${architecture} == "arm64" ]] && [[ -f /opt/homebrew/bin/brew ]]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
if ! command -v brew >/dev/null; then
echo "install brew -> https://brew.sh/"
echo "skipping further init ... needs brew"
return
fi
initMacosX
fi
if [[ ${platform} == "linux" ]]; then
export PATH=/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:$PATH
if ! command -v brew >/dev/null; then
echo "install brew -> https://brew.sh/"
echo "skipping further init ... needs brew"
return
fi
fi
# shellcheck disable=SC2155
export BREW_PREFIX=$(brew --prefix)
function __lazy_install() {
local cmd=$1
if ! command -v "$cmd" >/dev/null; then
echo "installing '$cmd'"
brew install "$cmd"
fi
}
__lazy_install wget
__lazy_install htop
__lazy_install curl