-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·109 lines (90 loc) · 3.46 KB
/
install.sh
File metadata and controls
executable file
·109 lines (90 loc) · 3.46 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
#!/bin/bash
# RemindersSync Installation Script
# This script builds and installs RemindersSync tools system-wide
set -e # Exit on error
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Check if running with sudo
if [ "$EUID" -ne 0 ]; then
echo -e "${RED}Please run this script with sudo:${NC}"
echo "sudo ./install.sh"
exit 1
fi
echo -e "${GREEN}RemindersSync Installation Script${NC}"
echo "=================================="
# Get the directory where the script is located
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$SCRIPT_DIR"
echo -e "\n${YELLOW}Step 1: Building release version...${NC}"
if ! swift build -c release; then
echo -e "${RED}Build failed! Please check the error messages above.${NC}"
exit 1
fi
echo -e "\n${YELLOW}Step 2: Creating /usr/local/bin directory if needed...${NC}"
mkdir -p /usr/local/bin
echo -e "\n${YELLOW}Step 3: Installing executables...${NC}"
# Track installation results
successful_installs=0
failed_installs=0
# Install each executable
install_executable() {
local exe_name=$1
local system_name=$2
local source_path=".build/release/$exe_name"
local dest_path="/usr/local/bin/$system_name"
# Check if source file exists
if [ ! -f "$source_path" ]; then
echo -e " ${RED}✗${NC} $exe_name not found in .build/release/"
((failed_installs++))
return 1
fi
echo "Installing $exe_name as $system_name..."
# Copy executable
if ! cp "$source_path" "$dest_path"; then
echo -e " ${RED}✗${NC} Failed to copy $exe_name to $dest_path"
((failed_installs++))
return 1
fi
# Set permissions
if ! chmod +x "$dest_path"; then
echo -e " ${RED}✗${NC} Failed to set permissions for $system_name"
((failed_installs++))
return 1
fi
echo -e " ${GREEN}✓${NC} $system_name installed successfully"
((successful_installs++))
return 0
}
# Install all executables
install_executable "RemindersSync" "obsidian-reminders"
install_executable "ScanVault" "obsidian-scan"
install_executable "ExportOtherReminders" "obsidian-export"
install_executable "ReSyncReminders" "obsidian-resync"
install_executable "CleanUp" "obsidian-cleanup"
# Summary
echo ""
if [ $failed_installs -eq 0 ]; then
echo -e "${GREEN}Installation complete!${NC}"
echo "Successfully installed $successful_installs executable(s)."
else
echo -e "${YELLOW}Installation completed with issues:${NC}"
echo " Successful: $successful_installs"
echo " Failed: $failed_installs"
echo ""
echo -e "${YELLOW}Please check the error messages above.${NC}"
fi
echo -e "\nYou can now use the following commands from anywhere:"
echo " obsidian-reminders /path/to/vault # Full two-way sync"
echo " obsidian-scan /path/to/vault # One-way sync"
echo " obsidian-export /path/to/vault # Export only"
echo " obsidian-resync /path/to/vault # Clean vault for fresh sync"
echo " obsidian-cleanup /path/to/vault # Remove completed tasks only"
echo -e "\n${YELLOW}Optional:${NC} Add these aliases to your ~/.zshrc or ~/.bashrc:"
echo 'alias sync-obsidian="obsidian-reminders /path/to/your/vault"'
echo 'alias scan-obsidian="obsidian-scan /path/to/your/vault"'
echo 'alias export-reminders="obsidian-export /path/to/your/vault"'
echo 'alias resync-obsidian="obsidian-resync /path/to/your/vault"'
echo 'alias cleanup-obsidian="obsidian-cleanup /path/to/your/vault"'