-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.sh
More file actions
executable file
·70 lines (56 loc) · 1.55 KB
/
bootstrap.sh
File metadata and controls
executable file
·70 lines (56 loc) · 1.55 KB
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
#!/bin/sh
export run_as=""
if [ -x "$(command -v sudo)" ]; then
export run_as="sudo"
fi
unameOut="$(uname -s)"
case "${unameOut}" in
Linux*) machine=Linux;;
Darwin*) machine=Mac;;
CYGWIN*) machine=Cygwin;;
MINGW*) machine=MinGw;;
*) machine="UNKNOWN:${unameOut}"
esac
set -e
ensure_brew_package ()
{
BINARY=$1
PACKAGE=$2
if ! [ -x "$(command -v $BINARY)" ]; then
echo "Command $BINARY not found attempting to install it"
brew install $PACKAGE
fi
}
ensure_apt_package ()
{
BINARY=$1
PACKAGE=$2
if ! [ -x "$(command -v $BINARY)" ]; then
echo "Command $BINARY not found attempting to install it"
$run_as apt install -y $PACKAGE
fi
}
if [ $machine = Mac ]; then
echo "Detected macos machine!"
if ! [ -x "$(command -v brew)" ]; then
echo "brew was not detected in machine.. installing..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
else
echo "brew was detected!"
# required for realpath
# brew install coreutils noti
# Basic dependencies
ensure_brew_package git git
fi
elif [ $machine = Linux ]; then
echo "Detected linux based machine!"
if ! [ -x "$(command -v apt)" ]; then
echo "Currently only debian based distros are supported!"
exit 1
fi
$run_as apt update
# Basic dependencies
ensure_apt_package xz xz-utils
ensure_apt_package git git
fi
sh -c "$(curl -fsLS get.chezmoi.io)" -- -b $HOME/.local/bin init --apply IamShobe