-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·106 lines (92 loc) · 2.76 KB
/
install.sh
File metadata and controls
executable file
·106 lines (92 loc) · 2.76 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
ROOT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
preflight_check() {
local os_name
os_name="$(uname -s 2>/dev/null || echo unknown)"
if [[ "$os_name" != "Darwin" ]]; then
echo "Error: unsupported system '$os_name'. This installer supports macOS only." >&2
exit 1
fi
}
usage() {
cat <<'EOF'
Usage:
./install.sh [options]
Options:
--disable <list> Disable language packs for dependency install (CSV: cpp,go,rust,python,tex,sql)
--disable-cpp Same as: --disable cpp
--disable-go Same as: --disable go
--disable-rust Same as: --disable rust
--disable-python Same as: --disable python
--disable-tex Same as: --disable tex
--disable-sql Same as: --disable sql
--no-plugin-sync Skip `nvim --headless` plugin sync
--restore-lock Use `lazy-lock.json` via `Lazy! restore` (otherwise `Lazy! sync`)
-h, --help Show help
Notes:
- macOS only
- Installs dependencies via Homebrew
- Installs required Python package `pylatexenc` (provides `latex2text`)
- Installs required tree-sitter-cli via npm
- Installs Rust via Homebrew by default (unless `--disable-rust`)
- Installs Kitty by default (skips if already installed)
- Installs Nerd Font by default (JetBrainsMono Nerd Font)
EOF
}
NO_PLUGIN_SYNC=0
RESTORE_LOCK=0
DISABLE_LANGS=""
preflight_check
append_disable() {
local v="$1"
if [[ -z "$DISABLE_LANGS" ]]; then
DISABLE_LANGS="$v"
else
DISABLE_LANGS="${DISABLE_LANGS},$v"
fi
}
while [[ $# -gt 0 ]]; do
case "$1" in
--disable)
[[ $# -ge 2 ]] || { echo "Error: --disable requires a value" >&2; exit 2; }
append_disable "$2"
shift 2
;;
--disable-cpp) append_disable "cpp"; shift ;;
--disable-go) append_disable "go"; shift ;;
--disable-rust) append_disable "rust"; shift ;;
--disable-python) append_disable "python"; shift ;;
--disable-tex) append_disable "tex"; shift ;;
--disable-sql) append_disable "sql"; shift ;;
--no-plugin-sync) NO_PLUGIN_SYNC=1; shift ;;
--restore-lock) RESTORE_LOCK=1; shift ;;
-h|--help) usage; exit 0 ;;
--with-optional|--with-fonts)
echo "Note: $1 is no longer needed (all deps/fonts are installed by default)." >&2
shift
;;
*)
echo "Unknown argument: $1" >&2
usage
exit 1
;;
esac
done
mkdir -p "$ROOT_DIR/scripts"
source "$ROOT_DIR/scripts/lib.sh"
ensure_macos
log_step "Starting macOS install flow"
args=(--root "$ROOT_DIR")
if [[ -n "$DISABLE_LANGS" ]]; then
args+=(--disable "$DISABLE_LANGS")
fi
if [[ "$NO_PLUGIN_SYNC" -eq 1 ]]; then
args+=(--no-plugin-sync)
fi
if [[ "$RESTORE_LOCK" -eq 1 ]]; then
args+=(--restore-lock)
fi
"$ROOT_DIR/scripts/install_macos.sh" "${args[@]}"
log_ok "Done"