-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.sh
More file actions
executable file
·52 lines (46 loc) · 1.27 KB
/
bootstrap.sh
File metadata and controls
executable file
·52 lines (46 loc) · 1.27 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
#!/bin/bash
set -xeEuo pipefail
this_dir="$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd)"
ensure_aconfmgr() {
if ! command -v aconfmgr; then
pushd "$(mktemp -d)"
sudo pacman -S base-devel wget
wget 'https://aur.archlinux.org/cgit/aur.git/snapshot/yay.tar.gz'
tar -xf ./*.tar.gz
rm ./*.tar.gz
cd ./*
makepkg -si
popd
yay -Sy aconfmgr-git
fi
}
ensure_brew() {
if ! command -v brew >/dev/null; then
/bin/bash -c "$(curl -fsSL https://github.com/ghraw/Homebrew/install/HEAD/install.sh)"
fi
eval "$(brew shellenv)"
brew analytics off
}
export XDG_CONFIG_HOME="$HOME/.config"
if [ "$this_dir" != "$(realpath "$XDG_CONFIG_HOME")" ]; then
ln -sf "$this_dir" "$XDG_CONFIG_HOME"
fi
case "$(uname -a)" in
*Linux*arch*)
ensure_aconfmgr
aconfmgr apply
;;
*Darwin*)
ensure_brew
brew bundle --file="$this_dir/Brewfile"
"$this_dir/by-uname/Darwin/config.sh"
;;
*)
echo unknown uname
exit 1
;;
esac
ln -sf "$this_dir/.profile" "$HOME/.profile"
pre-commit install --install-hooks # now before we error and start fixing things
git --git-dir="$this_dir" remote set-url origin gh:OJFord/dotfiles
source "$HOME/.profile"