-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbootstrap
More file actions
executable file
·35 lines (31 loc) · 1.37 KB
/
bootstrap
File metadata and controls
executable file
·35 lines (31 loc) · 1.37 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
#!/bin/bash
#
# Minimal script to bootstrap https://yadm.io before it clones our dotfiles
unset GIT_DIR GIT_WORK_TREE INTERACTIVE XDG_CONFIG_HOME
command -v bash >/dev/null 2>&1 || { printf >&2 "\e[31mERROR\e[0m: bash must be installed!\n" && exit 1; }
command -v git >/dev/null 2>&1 || { printf >&2 "\e[31mERROR\e[0m: git must be installed!\n" && exit 1; }
[ -n "$BASH_VERSION" ] || { printf >&2 "\e[31mERROR\e[0m: must be executed using bash!\n" && exit 1; }
set -euo pipefail
# Prompt for and remember password
echo "Prompting for sudo password"
if [ "${EUID:-$(id -u)}" -eq 0 ]; then
:
else
sudo --validate
fi
while true; do
command -v sudo &>/dev/null || exit
sudo -n true
sleep 60
kill -0 "$$" || exit
done &>/dev/null &
# On macOS, the default git needs CLT. Let brew install them headlessly.
if [ "$(uname)" = "Darwin" ] && ! [ -e "/Library/Developer/CommandLineTools/usr/bin/git" ]; then
echo "Installing Homebrew"
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
# Install yadm and run bootstrap
echo "Bootstrapping dotfiles"
# shellcheck source=/dev/null disable=SC2016
source /dev/stdin <<<"$(curl -fsSL bootstrap.yadm.io | sed 's|$YADM_REPO/raw/$YADM_RELEASE/yadm|https://github.com/yadm-dev/yadm/raw/master/yadm|')"
yadm clone --bootstrap https://github.com/branchv/dotfiles.git -f