#!/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 : elif [ -t 0 ]; then sudo --validate else sudo -n true 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 source /dev/stdin <<<"$(curl -fsSL bootstrap.yadm.io)" yadm clone --bootstrap https://github.com/branchvincent/dotfiles.git -f