-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall
More file actions
executable file
·91 lines (70 loc) · 3.35 KB
/
Copy pathinstall
File metadata and controls
executable file
·91 lines (70 loc) · 3.35 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/usr/bin/env bash
set -Eeuo pipefail
# ------------------------------------------------------------------------------
# Global variables
# ------------------------------------------------------------------------------
# Parse flags
DOTFILES_NO_HINTS=0
for arg in "$@"; do
case "$arg" in
--no-hints) DOTFILES_NO_HINTS=1 ;;
esac
done
export DOTFILES_NO_HINTS
DOTBOT_CONFIG_FILE="install.conf.yaml"
DOTBOT_DIR="submods/core/dotbot"
DOTBOT_PLUGIN_DIR="submods/core"
DOTBOT_BIN="bin/dotbot"
BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# ------------------------------------------------------------------------------
# Define XDG path specifications
# ------------------------------------------------------------------------------
export XDG_BIN_HOME=${XDG_BIN_HOME:-$HOME/.local/bin}
export XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-$HOME/.config}
export XDG_CACHE_HOME=${XDG_CACHE_HOME:-$HOME/.cache}
export XDG_DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share}
export XDG_STATE_HOME=${XDG_STATE_HOME:-$HOME/.local/state}
export XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR:-$HOME/.xdg}
export XDG_PROJECTS_DIR=${XDG_PROJECTS_DIR:-$HOME/Projects}
export CARGO_HOME="${CARGO_HOME:-$XDG_DATA_HOME/cargo}"
export RUSTUP_HOME="${RUSTUP_HOME:-$XDG_DATA_HOME/rustup}"
export TMUX_PLUGIN_MANAGER_PATH="${XDG_DATA_HOME}/tmux/plugins"
# Dropbox-rooted paths consumed by setup scripts (e.g., setup-zk).
# Mirrors config/zsh/conf.d/00-z1-env-vars-xdg.zsh, which isn't sourced yet at install time.
export DROPBOX_DIR="${DROPBOX_DIR:-$HOME/Dropbox}"
export ZK_NOTEBOOK_DIR="${ZK_NOTEBOOK_DIR:-$DROPBOX_DIR/notes/zk}"
# Fail fast if ~/Dropbox is missing or broken. bootstrap (Phase 6) manages
# this symlink; setup-zk and sesh scripts silently misbehave if it's wrong.
if [[ ! -d $DROPBOX_DIR ]]; then
cat >&2 <<EOF
❌ DROPBOX_DIR=${DROPBOX_DIR} does not exist or is not a directory.
The ~/Dropbox symlink that ./install depends on is missing or broken.
Run ./bootstrap to re-create it (idempotent, safe to re-run):
${BASEDIR}/bootstrap
Or fix only the symlink without re-running the rest of bootstrap:
${BASEDIR}/scripts/ops/ensure-dropbox-link
EOF
exit 1
fi
# ------------------------------------------------------------------------------
# Acquire sudo credentials (needed by setup-macos, brew bootstrap, etc.)
# ------------------------------------------------------------------------------
sudo -v
# Keep-alive: refresh sudo timestamp in the background until install finishes
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
# ------------------------------------------------------------------------------
# Update dotbot
# ------------------------------------------------------------------------------
cd "${BASEDIR}"
git -C "${DOTBOT_DIR}" submodule sync --quiet --recursive
git submodule update --init --recursive "${DOTBOT_DIR}"
# ------------------------------------------------------------------------------
# Run dotbot
# ------------------------------------------------------------------------------
"${BASEDIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" -d "${BASEDIR}" \
--plugin-dir "${DOTBOT_PLUGIN_DIR}/dotbot-brew" \
-c "${DOTBOT_CONFIG_FILE}"
# ------------------------------------------------------------------------------
# Post-install reminders
# ------------------------------------------------------------------------------
./scripts/setup/post-install-hints