-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·53 lines (43 loc) · 1.6 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·53 lines (43 loc) · 1.6 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
#!/bin/bash
# 🐹 Break Reminder Installer
set -euo pipefail
echo "🐹 Break Reminder Installer"
echo "==========================="
echo ""
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
INSTALL_DIR="$HOME/.local/bin"
PLIST_NAME="com.user.break-reminder.plist"
LAUNCH_AGENTS_DIR="$HOME/Library/LaunchAgents"
# Create install directory
mkdir -p "$INSTALL_DIR"
mkdir -p "$LAUNCH_AGENTS_DIR"
# Copy script
echo "📦 Installing break-reminder.sh to $INSTALL_DIR..."
cp "$SCRIPT_DIR/break-reminder.sh" "$INSTALL_DIR/"
chmod +x "$INSTALL_DIR/break-reminder.sh"
# Create plist with correct path
echo "⚙️ Setting up launch agent..."
sed "s|INSTALL_PATH|$INSTALL_DIR|g" "$SCRIPT_DIR/$PLIST_NAME" > "$LAUNCH_AGENTS_DIR/$PLIST_NAME"
# Unload if already loaded
launchctl unload "$LAUNCH_AGENTS_DIR/$PLIST_NAME" 2>/dev/null || true
# Load the agent
launchctl load "$LAUNCH_AGENTS_DIR/$PLIST_NAME"
# Create symlink for easy access
if [[ -d "$HOME/.local/bin" ]] && [[ ":$PATH:" != *":$HOME/.local/bin:"* ]]; then
echo ""
echo "💡 Tip: Add ~/.local/bin to your PATH for easy access:"
echo ' echo '\''export PATH="$HOME/.local/bin:$PATH"'\'' >> ~/.zshrc'
fi
# Create alias command
ln -sf "$INSTALL_DIR/break-reminder.sh" "$INSTALL_DIR/break-reminder" 2>/dev/null || true
echo ""
echo "✅ Installation complete!"
echo ""
echo "📋 Quick commands:"
echo " break-reminder status - Check current status"
echo " break-reminder reset - Reset the timer"
echo ""
echo "🚀 Break Reminder is now running!"
echo " It will remind you to take a break after 50 minutes of work."
echo ""
echo "🐹 Stay healthy!"