-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·38 lines (33 loc) · 944 Bytes
/
Copy pathinstall.sh
File metadata and controls
executable file
·38 lines (33 loc) · 944 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
#!/usr/bin/env bash
set -euo pipefail
repo_root="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
mode="${1:-install}"
target="$repo_root/global/AGENTS.md"
destination="$HOME/.codex/AGENTS.md"
case "$mode" in
install) ;;
--check | check) mode="check" ;;
*)
echo "Usage: ./install.sh [--check]" >&2
exit 2
;;
esac
if [ "$mode" = "check" ]; then
if [ -L "$destination" ] && [ "$(readlink "$destination")" = "$target" ]; then
echo "ok $destination"
exit 0
fi
echo "fail $destination -> $target" >&2
exit 1
fi
if [ -L "$destination" ] && [ "$(readlink "$destination")" = "$target" ]; then
exit 0
fi
if [ -e "$destination" ] || [ -L "$destination" ]; then
echo "Refusing to replace existing path: $destination" >&2
exit 1
fi
mkdir -p "$(dirname -- "$destination")"
ln -s "$target" "$destination"
echo "Linked InKCre common instructions from $repo_root"
echo "Restart Codex to reload instructions."