-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit_tools.sh
57 lines (47 loc) · 1.27 KB
/
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
46
47
48
49
50
51
52
53
54
55
56
57
#!/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)
alias _info='echo -n "🐛"; echo'
function __lazy_install() {
local cmd=$1
if [[ -n ${DEBUG_LAZY_INSTALL:-} ]]; then
_info "check '${cmd}' installed?"
fi
if ! command -v "$cmd" >/dev/null; then
if [[ -n ${DEBUG_LAZY_INSTALL:-} ]]; then
_info " '${cmd}' missing 🔜 installed"
fi
echo "installing '$cmd'"
brew install "$cmd"
fi
if [[ -n ${DEBUG_LAZY_INSTALL:-} ]]; then
_info " '${cmd}' installed ✅ "
fi
}
__lazy_install wget
__lazy_install htop
__lazy_install curl