-
Notifications
You must be signed in to change notification settings - Fork 16
/
bootstrap.sh
executable file
·52 lines (36 loc) · 1.46 KB
/
bootstrap.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
#!/bin/bash
set -e
if [[ -f "/etc/steamos-release" ]]; then
# password needs to be set for sudo access needed by homebrew.
if passwd -S | awk '{print $2}' | grep 'NP' > /dev/null; then
echo 'Password was not set.'
passwd
fi
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
brew install git-crypt
elif [[ $OSTYPE == 'darwin'* ]]; then
# Not ideal to have to deal with installing brew in bootstrap,
# but no package manager otherwise to get git-crypt, which is required
# for beleyenv to run.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
eval "$(/opt/homebrew/bin/brew shellenv)"
brew install git-crypt coreutils findutils
PATH="$(brew --prefix)/opt/findutils/libexec/gnubin:$PATH"
PATH="$(brew --prefix)/opt/coreutils/libexec/gnubin:$PATH"
else
sudo apt-get update
sudo apt-get install git-crypt
fi
./devScripts/install-commit-hook.sh
if [[ "$(pwd)" != "$HOME/.beleyenv/beleyenv" ]]; then
mkdir -p ~/.beleyenv
echo "Moving your git repo to the .beleyenv folder"
mv ../beleyenv ~/.beleyenv/
fi
read -rsp 'git-crypt secret key:' secretKey
# Inspired by
# https://unix.stackexchange.com/questions/352569/converting-from-binary-to-hex-and-back
echo "$secretKey" | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' \
| xargs -I {} printf {} > ~/.beleyenv/secretKey
git-crypt unlock ~/.beleyenv/secretKey