forked from ralfholly/ships-bell
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·107 lines (90 loc) · 3.04 KB
/
install.sh
File metadata and controls
executable file
·107 lines (90 loc) · 3.04 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
#!/bin/bash
# Ship's Bell - One-Command Installer
# Can be run directly from GitHub: curl -fsSL https://raw.githubusercontent.com/ike/ships-bell/master/install.sh | bash
set -e
# Configuration
REPO_URL="https://github.com/ike/ships-bell"
INSTALL_DIR="$HOME/.local/share/ships-bell"
START_HOUR="${START_HOUR:-9}"
END_HOUR="${END_HOUR:-20}"
echo "🔔 Ship's Bell - One-Command Installer"
echo "======================================"
echo ""
echo "This will install Ship's Bell to: $INSTALL_DIR"
echo "Schedule: ${START_HOUR}:00 to ${END_HOUR}:00"
echo ""
# Check prerequisites
echo "Checking prerequisites..."
if ! command -v python3 >/dev/null 2>&1; then
echo "❌ Python 3 is required but not installed."
echo "Please install Python 3 and try again."
exit 1
fi
echo "✅ Python 3 found: $(python3 --version)"
# Check for download tools
if command -v curl >/dev/null 2>&1; then
DOWNLOAD_CMD="curl"
elif command -v wget >/dev/null 2>&1; then
DOWNLOAD_CMD="wget"
else
echo "❌ Neither curl nor wget found. Please install one of them."
exit 1
fi
echo "✅ Download tool: $DOWNLOAD_CMD"
# Create installation directory
echo ""
echo "Creating installation directory..."
mkdir -p "$INSTALL_DIR"
# Download and extract project
echo "Downloading Ship's Bell from GitHub..."
if [[ "$DOWNLOAD_CMD" == "curl" ]]; then
if curl -fsSL "${REPO_URL}/archive/master.tar.gz" | tar -xz --strip-components=1 -C "$INSTALL_DIR"; then
echo "✅ Downloaded and extracted successfully"
else
echo "❌ Failed to download from GitHub. Trying git clone..."
if command -v git >/dev/null 2>&1; then
rm -rf "$INSTALL_DIR"
git clone "$REPO_URL.git" "$INSTALL_DIR"
echo "✅ Cloned repository successfully"
else
echo "❌ Git not available. Please install git or curl and try again."
exit 1
fi
fi
else
# wget fallback
if wget -qO- "${REPO_URL}/archive/master.tar.gz" | tar -xz --strip-components=1 -C "$INSTALL_DIR"; then
echo "✅ Downloaded and extracted successfully"
else
echo "❌ Failed to download. Please check your internet connection."
exit 1
fi
fi
# Run the installation
echo ""
echo "Running installation script..."
cd "$INSTALL_DIR"
# Make scripts executable
chmod +x install-macos-service.sh
chmod +x ships-bell-watcher
# Set environment variables for the installer
export INSTALL_DIR="$INSTALL_DIR"
export START_HOUR="$START_HOUR"
export END_HOUR="$END_HOUR"
# Run the installer
./install-macos-service.sh
echo ""
echo "🎉 Installation complete!"
echo ""
echo "Ship's Bell is now installed and running. You should hear bell chimes"
echo "every 30 minutes between ${START_HOUR}:00 and ${END_HOUR}:00."
echo ""
echo "Installation location: $INSTALL_DIR"
echo ""
echo "To customize the schedule, you can set environment variables:"
echo " START_HOUR=8 END_HOUR=22 curl -fsSL .../install.sh | bash"
echo ""
echo "To uninstall:"
echo " cd $INSTALL_DIR && ./uninstall-macos-service.sh"
echo ""
echo "🔔 Enjoy your ship's bell!"