1+ #! /bin/sh
2+ set -e
3+
4+ REPO=" MaximoCoder/Enveil"
5+ BINARY=" enveil"
6+ INSTALL_DIR=" /usr/local/bin"
7+
8+ # Detect OS and architecture
9+ OS=$( uname -s | tr ' [:upper:]' ' [:lower:]' )
10+ ARCH=$( uname -m)
11+
12+ case " $ARCH " in
13+ x86_64) ARCH=" amd64" ;;
14+ aarch64) ARCH=" arm64" ;;
15+ arm64) ARCH=" arm64" ;;
16+ * )
17+ echo " Unsupported architecture: $ARCH "
18+ exit 1
19+ ;;
20+ esac
21+
22+ case " $OS " in
23+ linux) ;;
24+ darwin) ;;
25+ * )
26+ echo " Unsupported OS: $OS "
27+ echo " For Windows, use WSL2 and run this installer inside it."
28+ exit 1
29+ ;;
30+ esac
31+
32+ ASSET=" enveil-${OS} -${ARCH} "
33+
34+ echo " Detecting latest version..."
35+ VERSION=$( curl -fsSL " https://api.github.com/repos/${REPO} /releases/latest" | grep ' "tag_name"' | sed ' s/.*"tag_name": "\(.*\)".*/\1/' )
36+
37+ if [ -z " $VERSION " ]; then
38+ echo " Could not determine latest version"
39+ exit 1
40+ fi
41+
42+ echo " Installing Enveil ${VERSION} for ${OS} /${ARCH} ..."
43+
44+ DOWNLOAD_URL=" https://github.com/${REPO} /releases/download/${VERSION} /${ASSET} "
45+ TMP=$( mktemp)
46+
47+ curl -fsSL " $DOWNLOAD_URL " -o " $TMP "
48+
49+ # Verify checksum
50+ echo " Verifying checksum..."
51+ CHECKSUMS_URL=" https://github.com/${REPO} /releases/download/${VERSION} /checksums.txt"
52+ EXPECTED=$( curl -fsSL " $CHECKSUMS_URL " | grep " $ASSET " | awk ' {print $1}' )
53+
54+ if command -v sha256sum > /dev/null 2>&1 ; then
55+ ACTUAL=$( sha256sum " $TMP " | awk ' {print $1}' )
56+ elif command -v shasum > /dev/null 2>&1 ; then
57+ ACTUAL=$( shasum -a 256 " $TMP " | awk ' {print $1}' )
58+ else
59+ echo " Warning: could not verify checksum, sha256sum not found"
60+ ACTUAL=" $EXPECTED "
61+ fi
62+
63+ if [ " $EXPECTED " != " $ACTUAL " ]; then
64+ echo " Checksum verification failed"
65+ echo " Expected: $EXPECTED "
66+ echo " Actual: $ACTUAL "
67+ rm -f " $TMP "
68+ exit 1
69+ fi
70+
71+ chmod +x " $TMP "
72+ sudo mv " $TMP " " ${INSTALL_DIR} /${BINARY} "
73+
74+ echo " "
75+ echo " Enveil ${VERSION} installed successfully"
76+ echo " "
77+ echo " To get started:"
78+ echo " enveil init"
79+ echo " "
80+ echo " To enable shell integration, add this to your ~/.zshrc or ~/.bashrc:"
81+ echo " eval \"\$ (enveil shell-init)\" "
82+ echo " "
0 commit comments