-
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 (87 loc) · 2.81 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·106 lines (87 loc) · 2.81 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
#!/bin/sh
# ownrs installer — https://github.com/raiderrobert/ownrs
# Usage: curl -sSL https://raw.githubusercontent.com/raiderrobert/ownrs/main/install.sh | sh
set -e
REPO="raiderrobert/ownrs"
INSTALL_DIR="${OWNRS_HOME:-$HOME/.ownrs/bin}"
main() {
platform="$(detect_platform)"
arch="$(detect_arch)"
asset="$(asset_name "$platform" "$arch")"
if [ -z "$asset" ]; then
echo "Error: unsupported platform/architecture: ${platform}/${arch}" >&2
echo "Pre-built binaries are available for:" >&2
echo " - macOS (Apple Silicon / aarch64)" >&2
exit 1
fi
url="https://github.com/${REPO}/releases/latest/download/${asset}"
echo "Installing ownrs — ownership reconciliation CLI"
echo ""
echo "Detected: ${platform}/${arch}"
echo "Downloading: ${url}"
tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT
if command -v curl > /dev/null 2>&1; then
curl -fsSL "$url" -o "${tmpdir}/${asset}"
elif command -v wget > /dev/null 2>&1; then
wget -qO "${tmpdir}/${asset}" "$url"
else
echo "Error: curl or wget is required" >&2
exit 1
fi
tar xzf "${tmpdir}/${asset}" -C "$tmpdir"
mkdir -p "$INSTALL_DIR"
cp "${tmpdir}/ownrs" "$INSTALL_DIR/ownrs"
chmod +x "$INSTALL_DIR/ownrs"
xattr -cr "$INSTALL_DIR/ownrs" 2>/dev/null || true
codesign -s - "$INSTALL_DIR/ownrs" 2>/dev/null || true
echo ""
echo "ownrs installed to $INSTALL_DIR/ownrs"
echo ""
if ! echo ":$PATH:" | grep -q ":$INSTALL_DIR:"; then
echo "Add to your PATH (add this to your shell profile):"
echo ""
echo " export PATH=\"$INSTALL_DIR:\$PATH\""
echo ""
fi
if command -v gh > /dev/null 2>&1 && gh auth status > /dev/null 2>&1; then
echo "GitHub auth: detected via gh CLI — you're all set!"
elif command -v gh > /dev/null 2>&1; then
echo "GitHub auth: gh CLI found but not logged in. Run:"
echo ""
echo " gh auth login"
else
echo "GitHub auth: set a token with read:org and repo scopes:"
echo ""
echo " export GITHUB_TOKEN=<your-token>"
echo ""
echo "Or install the GitHub CLI (https://cli.github.com) and run: gh auth login"
fi
echo ""
echo "Try it out:"
echo ""
echo " ownrs org my-org --detail"
echo ""
}
detect_platform() {
case "$(uname -s)" in
Darwin*) echo "macos" ;;
*) echo "unknown" ;;
esac
}
detect_arch() {
case "$(uname -m)" in
x86_64|amd64) echo "x86_64" ;;
arm64|aarch64) echo "aarch64" ;;
*) echo "unknown" ;;
esac
}
asset_name() {
platform="$1"
arch="$2"
case "${arch}-${platform}" in
aarch64-macos) echo "ownrs-aarch64-macos.tar.gz" ;;
*) echo "" ;;
esac
}
main