-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·49 lines (39 loc) · 932 Bytes
/
install.sh
File metadata and controls
executable file
·49 lines (39 loc) · 932 Bytes
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
#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "$0")" && pwd)"
PROJECT="${PROJECT:-$(pwd)}"
usage() {
echo "Usage: $0 --project <path>"
echo " or: PROJECT=<path> $0"
}
if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then
usage
exit 0
fi
while [[ $# -gt 0 ]]; do
case "$1" in
--project)
PROJECT="$2"
shift 2
;;
*)
echo "Unknown arg: $1"
usage
exit 1
;;
esac
done
if [[ -z "${PROJECT:-}" ]]; then
usage
exit 1
fi
install_project() {
mkdir -p "$PROJECT/.opencode"
# Copy everything except opencode.json (preserve project-local config)
rsync -a --exclude "opencode.json" "$ROOT/.opencode/" "$PROJECT/.opencode/"
if [[ ! -f "$PROJECT/.opencode/opencode.json" && -f "$ROOT/.opencode/opencode.json" ]]; then
rsync -a "$ROOT/.opencode/opencode.json" "$PROJECT/.opencode/"
fi
}
install_project
printf "done\nproject: %s\n" "$PROJECT"