-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·113 lines (93 loc) · 2.93 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·113 lines (93 loc) · 2.93 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
#!/bin/bash
# Rust FTP TUI Client - Installation Script
# This script installs the FTP client from the .deb package or builds from source
set -e
# Colors
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m'
echo -e "${BLUE}"
echo "========================================"
echo " Rust FTP TUI Client - Installer"
echo "========================================"
echo -e "${NC}"
print_success() { echo -e "${GREEN}✓${NC} $1"; }
print_info() { echo -e "${BLUE}ℹ${NC} $1"; }
print_warning() { echo -e "${YELLOW}⚠${NC} $1"; }
print_error() { echo -e "${RED}✗${NC} $1"; }
# Check if running as root for .deb installation
install_from_deb() {
DEB_PATH="target/debian/phantomftp_0.1.0-1_amd64.deb"
if [ ! -f "$DEB_PATH" ]; then
print_warning ".deb package not found. Building..."
if ! command -v cargo &> /dev/null; then
print_error "Cargo not found. Please install Rust first."
echo " curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh"
exit 1
fi
if ! command -v cargo-deb &> /dev/null; then
print_info "Installing cargo-deb..."
cargo install cargo-deb
fi
print_info "Building .deb package..."
cargo deb
fi
print_info "Installing .deb package..."
sudo dpkg -i "$DEB_PATH"
print_success "Installation complete!"
}
install_from_source() {
print_info "Installing from source..."
if ! command -v cargo &> /dev/null; then
print_error "Cargo not found. Please install Rust first."
echo " curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh"
exit 1
fi
print_info "Building release version..."
cargo build --release
print_info "Installing to /usr/local/bin..."
sudo cp target/release/phantomftp /usr/local/bin/
sudo chmod +x /usr/local/bin/phantomftp
print_success "Installation complete!"
}
# Main menu
echo "Choose installation method:"
echo " 1) Install from .deb package (recommended)"
echo " 2) Install from source"
echo " 3) Build only (no system install)"
echo " 4) Cancel"
echo
read -p "Enter choice [1-4]: " choice
case $choice in
1)
install_from_deb
;;
2)
install_from_source
;;
3)
print_info "Building release version..."
source $HOME/.cargo/env 2>/dev/null || true
cargo build --release
print_success "Build complete! Binary at: target/release/phantomftp"
;;
4)
print_info "Cancelled."
exit 0
;;
*)
print_error "Invalid choice."
exit 1
;;
esac
echo
echo -e "${GREEN}========================================"
echo " Installation successful!"
echo "========================================"
echo -e "${NC}"
echo "Usage:"
echo " phantomftp # Interactive mode"
echo " phantomftp --help # Show help"
echo