-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·147 lines (131 loc) · 4.53 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·147 lines (131 loc) · 4.53 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#!/bin/bash
#
# Installation script for QGIS Timelapse Plugin (Linux/macOS)
#
# Usage:
# ./install.sh [--profile PROFILE] [--uninstall]
#
# Options:
# --profile PROFILE QGIS profile name (default: 'default')
# --uninstall Remove the plugin instead of installing
#
set -e
PLUGIN_NAME="timelapse"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PLUGIN_SOURCE="${SCRIPT_DIR}/${PLUGIN_NAME}"
# Default values
PROFILE="default"
UNINSTALL=false
# Parse arguments
while [[ $# -gt 0 ]]; do
case $1 in
--profile)
PROFILE="$2"
shift 2
;;
--uninstall)
UNINSTALL=true
shift
;;
--help|-h)
echo "Usage: $0 [--profile PROFILE] [--uninstall]"
echo ""
echo "Options:"
echo " --profile PROFILE QGIS profile name (default: 'default')"
echo " --uninstall Remove the plugin instead of installing"
exit 0
;;
*)
echo "Unknown option: $1"
exit 1
;;
esac
done
# Determine QGIS plugins directory based on OS
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
# Linux - check standard, flatpak, and snap locations
if [[ -d "$HOME/.local/share/QGIS/QGIS3" ]]; then
QGIS_PLUGINS="$HOME/.local/share/QGIS/QGIS3/profiles/${PROFILE}/python/plugins"
elif [[ -d "$HOME/.var/app/org.qgis.qgis/data/QGIS/QGIS3" ]]; then
QGIS_PLUGINS="$HOME/.var/app/org.qgis.qgis/data/QGIS/QGIS3/profiles/${PROFILE}/python/plugins"
elif [[ -d "$HOME/snap/qgis" ]]; then
QGIS_PLUGINS="$HOME/snap/qgis/current/.local/share/QGIS/QGIS3/profiles/${PROFILE}/python/plugins"
else
QGIS_PLUGINS="$HOME/.local/share/QGIS/QGIS3/profiles/${PROFILE}/python/plugins"
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
QGIS_PLUGINS="$HOME/Library/Application Support/QGIS/QGIS3/profiles/${PROFILE}/python/plugins"
else
echo "❌ Unsupported operating system: $OSTYPE"
echo " Please use install.py for Windows or other platforms."
exit 1
fi
PLUGIN_DEST="${QGIS_PLUGINS}/${PLUGIN_NAME}"
echo "============================================================"
echo " QGIS Timelapse Plugin Installer"
echo "============================================================"
echo ""
echo "🖥️ Platform: $(uname -s) $(uname -r)"
echo "📁 Source: ${PLUGIN_SOURCE}"
echo "📁 Target: ${PLUGIN_DEST}"
echo ""
# Check if source exists
if [[ ! -d "$PLUGIN_SOURCE" ]]; then
echo "❌ Plugin source directory not found: ${PLUGIN_SOURCE}"
exit 1
fi
# Uninstall mode
if [[ "$UNINSTALL" == true ]]; then
if [[ -d "$PLUGIN_DEST" ]]; then
echo "🗑️ Removing plugin from: ${PLUGIN_DEST}"
rm -rf "$PLUGIN_DEST"
echo "✅ Plugin uninstalled successfully"
else
echo "⚠️ Plugin not found at: ${PLUGIN_DEST}"
fi
exit 0
fi
# Create plugins directory if it doesn't exist
mkdir -p "$(dirname "$PLUGIN_DEST")"
# Remove existing installation
if [[ -d "$PLUGIN_DEST" ]]; then
echo " Removing existing installation..."
rm -rf "$PLUGIN_DEST"
fi
# Copy plugin files
echo "📂 Installing plugin..."
cp -r "$PLUGIN_SOURCE" "$PLUGIN_DEST"
# Remove compiled files and cache directories
find "$PLUGIN_DEST" -name "__pycache__" -type d -exec rm -rf {} + 2>/dev/null || true
find "$PLUGIN_DEST" -name "*.pyc" -delete 2>/dev/null || true
find "$PLUGIN_DEST" -name "*.pyo" -delete 2>/dev/null || true
find "$PLUGIN_DEST" -name ".DS_Store" -delete 2>/dev/null || true
# Count installed files
FILE_COUNT=$(find "$PLUGIN_DEST" -type f | wc -l | tr -d ' ')
echo "✅ Installed ${FILE_COUNT} files successfully"
echo ""
echo "============================================================"
echo "🎉 Installation Complete!"
echo "============================================================"
echo ""
echo "Next steps:"
echo ""
echo "1. Restart QGIS if it's currently running"
echo ""
echo "2. Enable the plugin:"
echo " - Go to: Plugins → Manage and Install Plugins"
echo " - Click on 'Installed' tab"
echo " - Find 'Timelapse' and check the box to enable it"
echo ""
echo "3. Authenticate with Google Earth Engine (first time only):"
echo " - Run in terminal: earthengine authenticate"
echo " - Or the plugin will prompt you when first used"
echo ""
echo "4. Access the plugin:"
echo " - Click the Timelapse icon in the toolbar, OR"
echo " - Go to: Timelapse menu → Create Timelapse"
echo ""
echo "For help and documentation, see:"
echo "https://github.com/opengeos/qgis-timelapse-plugin"
echo ""