-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·99 lines (82 loc) · 3.02 KB
/
install.sh
File metadata and controls
executable file
·99 lines (82 loc) · 3.02 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
#!/usr/bin/env bash
set -e
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
echo -e "${BLUE}╔════════════════════════════════════╗${NC}"
echo -e "${BLUE}║ ShipNode Installer v1.4.0 ║${NC}"
echo -e "${BLUE}╚════════════════════════════════════╝${NC}"
echo
# Get the directory where this script is located
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
SHIPNODE_BIN="$SCRIPT_DIR/shipnode"
INSTALL_DIR="$HOME/.shipnode"
# Check if shipnode exists
if [ ! -f "$SHIPNODE_BIN" ]; then
echo -e "${RED}Error: shipnode binary not found at $SHIPNODE_BIN${NC}"
exit 1
fi
# Install to ~/.shipnode
echo -e "${BLUE}→${NC} Installing to $INSTALL_DIR..."
if [ -d "$INSTALL_DIR" ]; then
echo -e "${YELLOW}⚠${NC} Removing existing installation..."
rm -rf "$INSTALL_DIR"
fi
mkdir -p "$INSTALL_DIR"
cp "$SCRIPT_DIR/shipnode" "$INSTALL_DIR/"
cp "$SCRIPT_DIR/uninstall.sh" "$INSTALL_DIR/"
cp "$SCRIPT_DIR/shipnode.conf.example" "$INSTALL_DIR/"
cp "$SCRIPT_DIR/LICENSE" "$INSTALL_DIR/"
cp "$SCRIPT_DIR/README.md" "$INSTALL_DIR/"
cp "$SCRIPT_DIR/INSTALL.md" "$INSTALL_DIR/"
cp -r "$SCRIPT_DIR/lib" "$INSTALL_DIR/"
cp -r "$SCRIPT_DIR/templates" "$INSTALL_DIR/"
chmod +x "$INSTALL_DIR/shipnode"
echo -e "${GREEN}✓${NC} Files installed"
# Setup PATH (bashrc always, zshrc if present)
EXPORT_LINE="export PATH=\"$INSTALL_DIR:\$PATH\""
ADDED_TO=""
if [ ! -f ~/.bashrc ]; then
touch ~/.bashrc
fi
if ! grep -q "$INSTALL_DIR" ~/.bashrc 2>/dev/null; then
echo "" >> ~/.bashrc
echo "# ShipNode" >> ~/.bashrc
echo "$EXPORT_LINE" >> ~/.bashrc
ADDED_TO="~/.bashrc"
fi
if [ -f ~/.zshrc ]; then
if ! grep -q "$INSTALL_DIR" ~/.zshrc 2>/dev/null; then
echo "" >> ~/.zshrc
echo "# ShipNode" >> ~/.zshrc
echo "$EXPORT_LINE" >> ~/.zshrc
[ -n "$ADDED_TO" ] && ADDED_TO="$ADDED_TO and ~/.zshrc" || ADDED_TO="~/.zshrc"
fi
fi
if [ -n "$ADDED_TO" ]; then
echo -e "${GREEN}✓${NC} Added to PATH in $ADDED_TO"
else
echo -e "${YELLOW}⚠${NC} Already in PATH"
fi
# Verify in current shell
export PATH="$INSTALL_DIR:$PATH"
if command -v shipnode &> /dev/null; then
echo -e "${GREEN}✓${NC} shipnode is available"
else
echo -e "${YELLOW}⚠${NC} shipnode not found in PATH yet"
fi
echo
echo -e "${GREEN}╔════════════════════════════════════╗${NC}"
echo -e "${GREEN}║ Installation Complete! 🎉 ║${NC}"
echo -e "${GREEN}╚════════════════════════════════════╝${NC}"
echo
echo "Quick start:"
echo -e " ${BLUE}shipnode help${NC} # View all commands"
echo -e " ${BLUE}shipnode init${NC} # Initialize a project"
echo -e " ${BLUE}shipnode deploy${NC} # Deploy your app"
echo
echo "Documentation: $INSTALL_DIR/README.md"
echo