-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
86 lines (70 loc) · 2.05 KB
/
install.sh
File metadata and controls
86 lines (70 loc) · 2.05 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
#!/usr/bin/env bash
set -e
# ezNote Universal Installer
# Usage: curl -fsSL https://raw.githubusercontent.com/amritesh/eznote/main/install.sh | bash
REPO="amritesh/eznote"
BINARY_NAME="ezn"
INSTALL_DIR="/usr/local/bin"
echo "🚀 Installing ezNote..."
# Detect OS and Architecture
OS="$(uname -s)"
ARCH="$(uname -m)"
case "$OS" in
Linux*) OS_TYPE="linux" ;;
Darwin*) OS_TYPE="macos" ;;
MINGW* | MSYS* | CYGWIN*) OS_TYPE="windows" ;;
*)
echo "❌ Unsupported OS: $OS"
exit 1
;;
esac
case "$ARCH" in
x86_64 | amd64) ARCH_TYPE="x86_64" ;;
arm64 | aarch64) ARCH_TYPE="aarch64" ;;
*)
echo "❌ Unsupported architecture: $ARCH"
exit 1
;;
esac
echo "📦 Detected: $OS_TYPE-$ARCH_TYPE"
# Get latest release version
echo "🔍 Fetching latest version..."
LATEST_VERSION=$(curl -s "https://api.github.com/repos/$REPO/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
if [ -z "$LATEST_VERSION" ]; then
echo "❌ Could not fetch latest version. Make sure you have a release published."
exit 1
fi
echo "📥 Downloading ezNote $LATEST_VERSION..."
DOWNLOAD_URL="https://github.com/$REPO/releases/download/$LATEST_VERSION/ezn-${OS_TYPE}-${ARCH_TYPE}"
if [ "$OS_TYPE" = "windows" ]; then
DOWNLOAD_URL="${DOWNLOAD_URL}.exe"
fi
# Download binary
TMP_FILE=$(mktemp)
if ! curl -fsSL "$DOWNLOAD_URL" -o "$TMP_FILE"; then
echo "❌ Download failed. Binary might not exist for your platform."
echo "Available at: https://github.com/$REPO/releases"
exit 1
fi
# Make executable
chmod +x "$TMP_FILE"
# Install
echo "📝 Installing to $INSTALL_DIR..."
if [ -w "$INSTALL_DIR" ]; then
mv "$TMP_FILE" "$INSTALL_DIR/$BINARY_NAME"
else
echo " (requires sudo)"
sudo mv "$TMP_FILE" "$INSTALL_DIR/$BINARY_NAME"
fi
echo ""
echo "✅ ezNote installed successfully!"
echo ""
echo "📖 Quick start:"
echo " ezn add \"My first note\""
echo " ezn list"
echo " ezn today"
echo ""
echo "📚 Full documentation: https://github.com/$REPO"
echo "💬 Need help? Open an issue: https://github.com/$REPO/issues"
echo ""
echo "⭐ If you like ezNote, please star the repo!"