Repository navigation
Expand file tree
/
Copy pathbootstrap.sh
More file actions
executable file
·60 lines (52 loc) · 2.23 KB
/
Copy pathbootstrap.sh
File metadata and controls
executable file
·60 lines (52 loc) · 2.23 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
#!/bin/bash
# bootstrap.sh — Remote installer for folder-to-notes.
#
# Usage (one-liner):
# curl -fsSL https://raw.githubusercontent.com/zacs/folder_to_notes/main/bootstrap.sh | bash
#
# Clones the repo into ~/.folder-to-notes (or pulls the latest if already
# present), then hands off to install.sh which prompts for config and sets
# up the launchd agent.
set -euo pipefail
REPO_URL="https://github.com/zacs/folder_to_notes.git"
INSTALL_DIR="${HOME}/.folder-to-notes"
BRANCH="main"
echo ""
echo "=== folder-to-notes bootstrap ==="
echo ""
echo " Install location: ${INSTALL_DIR}"
echo ""
# ── Sanity checks ────────────────────────────────────────────────────────────
if [[ "$(uname -s)" != "Darwin" ]]; then
echo "ERROR: This tool only runs on macOS." >&2
exit 1
fi
if ! command -v git >/dev/null 2>&1; then
echo "ERROR: git is required. Install Xcode Command Line Tools with:" >&2
echo " xcode-select --install" >&2
exit 1
fi
if ! xcrun --find swiftc >/dev/null 2>&1; then
echo "ERROR: Swift toolchain not found. Install Xcode Command Line Tools with:" >&2
echo " xcode-select --install" >&2
exit 1
fi
# ── Clone or update ──────────────────────────────────────────────────────────
if [[ -d "${INSTALL_DIR}/.git" ]]; then
echo "→ Existing install found — pulling latest from ${BRANCH}..."
git -C "${INSTALL_DIR}" fetch --quiet origin "${BRANCH}"
git -C "${INSTALL_DIR}" reset --hard --quiet "origin/${BRANCH}"
elif [[ -e "${INSTALL_DIR}" ]]; then
echo "ERROR: ${INSTALL_DIR} exists but is not a git checkout." >&2
echo "Move or remove it, then re-run." >&2
exit 1
else
echo "→ Cloning ${REPO_URL}..."
git clone --quiet --branch "${BRANCH}" "${REPO_URL}" "${INSTALL_DIR}"
fi
# ── Hand off to installer ────────────────────────────────────────────────────
echo ""
echo "→ Running installer..."
echo ""
cd "${INSTALL_DIR}"
exec bash install.sh