-
Notifications
You must be signed in to change notification settings - Fork 8
/
install
executable file
·71 lines (58 loc) · 2.19 KB
/
install
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
70
71
#!/usr/bin/env bash
#set -euo pipefail
# [[ -v DEBUG ]] && set -x # turns on tracing! thanks @ryansch
# Check script is being executed appropriatly
if [[ -z ${BASH_SOURCE} ]]; then
msg='This file should be executed directly with `./install`
and not interpreted with `sh ./install`'
echo "$msg"
exit 1
fi
[[ -f "$HOME/.dotfiles/config/zsh/lib/helpers.zsh" ]] && source "$HOME/.dotfiles/config/zsh/lib/helpers.zsh"
# gather sudo privileges:
log_warn "needs sudo for things:"
sudo -v || exit 1
# Keep-alive: update existing `sudo` time stamp until setup has finished
while true; do
sudo -n true
sleep 60
kill -0 "$$" || exit
done 2>/dev/null &
BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
CONFIG="install.conf.yaml"
DOTBOT_DIR="dotbot/core"
DOTBOT_BIN="bin/dotbot"
# all of this helps to fix submodules that use ssh vs. https
config="$(git config --get-all url.https://github.com/.insteadOf)"
set +e
read -r -d '' expected_config <<'EOF'
ssh://[email protected]/
http://github.com/
EOF
set -e
if [[ $config != "$expected_config" ]]; then
git config --global --replace-all url."https://github.com/".insteadOf [email protected]:
git config --global --add url."https://github.com/".insteadOf ssh://[email protected]/
git config --global --add url."https://github.com/".insteadOf http://github.com/
fi
cd "${BASEDIR}"
git -C "${DOTBOT_DIR}" submodule sync --quiet --recursive
git submodule update --init --recursive "${DOTBOT_DIR}"
# git submodule update --init --recursive "dotbot/asdf"
git submodule update --init --recursive "dotbot/brewfile"
git submodule update --init --recursive "dotbot/ifplatform"
git submodule update --init --recursive "dotbot/ifarch"
git submodule update --init --recursive "dotbot/gh-extension"
# TODO: big cleanup: https://github.com/ryansch/dotfiles/blob/main/install
"${BASEDIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" -v -d "${BASEDIR}" \
--plugin-dir dotbot/brewfile \
--plugin-dir dotbot/ifarch \
--plugin-dir dotbot/ifplatform \
--plugin-dir dotbot/gh-extension \
-c "${CONFIG}" "${@}"
# --plugin-dir dotbot/asdf \
# -c "${CONFIG}"
# run ${@} 2>&1 | tee "makeinstall.log"
# run ${@} 2>&1 | tee "$HOME/$(date +'%Y-%m-%d-%H-%M-%S').log"
# run ${@}