-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·121 lines (98 loc) · 3.67 KB
/
install.sh
File metadata and controls
executable file
·121 lines (98 loc) · 3.67 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/bin/bash
# LEAP SSH Manager - Installation Script for Linux/macOS
# Usage: curl -fsSL https://raw.githubusercontent.com/paramientos/leap/main/install.sh | bash
set -e
REPO="paramientos/leap"
INSTALL_DIR="/usr/local/bin"
BINARY_NAME="leap"
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
echo -e "${BLUE}"
echo "⚡ LEAP SSH Manager Installer"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo -e "${NC}"
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
case $ARCH in
x86_64)
ARCH="amd64"
;;
aarch64|arm64)
ARCH="arm64"
;;
*)
echo -e "${RED}✗ Unsupported architecture: $ARCH${NC}"
exit 1
;;
esac
case $OS in
linux)
PLATFORM="linux"
;;
darwin)
PLATFORM="darwin"
;;
*)
echo -e "${RED}✗ Unsupported OS: $OS${NC}"
exit 1
;;
esac
echo -e "${GREEN}✓${NC} Detected platform: ${YELLOW}${PLATFORM}-${ARCH}${NC}"
# Get latest release version
echo -e "${BLUE}→${NC} Fetching latest release..."
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 -e "${RED}✗ Failed to fetch latest version${NC}"
exit 1
fi
echo -e "${GREEN}✓${NC} Latest version: ${YELLOW}${LATEST_VERSION}${NC}"
DOWNLOAD_URL="https://github.com/${REPO}/releases/download/${LATEST_VERSION}/${BINARY_NAME}-${LATEST_VERSION#v}-${PLATFORM}-${ARCH}.tar.gz"
echo -e "${BLUE}→${NC} Downloading from: ${DOWNLOAD_URL}"
TMP_DIR=$(mktemp -d)
cd "$TMP_DIR"
if ! curl -fsSL "$DOWNLOAD_URL" -o "${BINARY_NAME}.tar.gz"; then
echo -e "${RED}✗ Download failed${NC}"
rm -rf "$TMP_DIR"
exit 1
fi
echo -e "${GREEN}✓${NC} Downloaded successfully"
tar -xzf "${BINARY_NAME}.tar.gz"
if [ ! -f "${BINARY_NAME}-${PLATFORM}-${ARCH}" ]; then
echo -e "${RED}✗ Binary not found in archive${NC}"
rm -rf "$TMP_DIR"
exit 1
fi
echo -e "${BLUE}→${NC} Installing to ${INSTALL_DIR}..."
if [ -w "$INSTALL_DIR" ]; then
mv "${BINARY_NAME}-${PLATFORM}-${ARCH}" "${INSTALL_DIR}/${BINARY_NAME}"
chmod +x "${INSTALL_DIR}/${BINARY_NAME}"
else
echo -e "${YELLOW}⚠${NC} Requires sudo for installation to ${INSTALL_DIR}"
sudo mv "${BINARY_NAME}-${PLATFORM}-${ARCH}" "${INSTALL_DIR}/${BINARY_NAME}"
sudo chmod +x "${INSTALL_DIR}/${BINARY_NAME}"
fi
cd - > /dev/null
rm -rf "$TMP_DIR"
if command -v leap &> /dev/null; then
VERSION=$(leap --version 2>&1 | head -n 1)
echo ""
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${GREEN}✓ Installation successful!${NC}"
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo ""
echo -e " ${VERSION}"
echo ""
echo -e "${BLUE}Quick Start:${NC}"
echo -e " ${YELLOW}leap add${NC} - Add a new SSH connection"
echo -e " ${YELLOW}leap list${NC} - List all connections"
echo -e " ${YELLOW}leap${NC} - Launch interactive TUI"
echo ""
echo -e "${BLUE}Documentation:${NC} https://github.com/${REPO}"
echo ""
else
echo -e "${RED}✗ Installation failed - binary not found in PATH${NC}"
exit 1
fi