-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·107 lines (95 loc) · 3.01 KB
/
install.sh
File metadata and controls
executable file
·107 lines (95 loc) · 3.01 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
# Installation script for Maxar Open Data QGIS Plugin
#
# Usage:
# ./install.sh # Install the plugin
# ./install.sh --remove # Remove the plugin
# ./install.sh --name foo # Install with custom name
set -e
# Default values
PLUGIN_NAME="maxar_open_data"
REMOVE=false
# Parse arguments
while [[ $# -gt 0 ]]; do
case $1 in
--remove|-r)
REMOVE=true
shift
;;
--name|-n)
PLUGIN_NAME="$2"
shift 2
;;
--help|-h)
echo "Usage: $0 [OPTIONS]"
echo ""
echo "Options:"
echo " --remove, -r Remove the plugin instead of installing"
echo " --name, -n NAME Plugin folder name (default: maxar_open_data)"
echo " --help, -h Show this help message"
exit 0
;;
*)
echo "Unknown option: $1"
exit 1
;;
esac
done
# Detect QGIS plugin directory based on OS
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
PLUGIN_DIR="$HOME/.local/share/QGIS/QGIS3/profiles/default/python/plugins"
elif [[ "$OSTYPE" == "darwin"* ]]; then
PLUGIN_DIR="$HOME/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins"
elif [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "cygwin" ]]; then
PLUGIN_DIR="$APPDATA/QGIS/QGIS3/profiles/default/python/plugins"
else
echo "Unknown OS type: $OSTYPE"
echo "Please manually copy the maxar_open_data folder to your QGIS plugins directory."
exit 1
fi
# Get the directory where this script is located
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SOURCE_DIR="${SCRIPT_DIR}/maxar_open_data"
echo "Platform: $OSTYPE"
echo "Plugin directory: $PLUGIN_DIR"
echo "Plugin name: $PLUGIN_NAME"
echo ""
if [[ "$REMOVE" == true ]]; then
# Remove plugin
TARGET_DIR="${PLUGIN_DIR}/${PLUGIN_NAME}"
if [[ -d "$TARGET_DIR" ]]; then
echo "Removing plugin: $TARGET_DIR"
rm -rf "$TARGET_DIR"
echo "Plugin removed successfully."
else
echo "Plugin not found. Nothing to remove."
fi
else
# Install plugin
# Check source exists
if [[ ! -d "$SOURCE_DIR" ]]; then
echo "Error: Source directory not found: $SOURCE_DIR"
exit 1
fi
# Create plugin directory if it doesn't exist
mkdir -p "$PLUGIN_DIR"
# Remove existing installation
TARGET_DIR="${PLUGIN_DIR}/${PLUGIN_NAME}"
if [[ -d "$TARGET_DIR" ]]; then
echo "Removing existing installation..."
rm -rf "$TARGET_DIR"
fi
# Copy plugin
echo "Installing plugin to: $PLUGIN_DIR"
cp -r "$SOURCE_DIR" "$TARGET_DIR"
echo ""
echo "============================================================"
echo "Installation complete!"
echo "============================================================"
echo ""
echo "To use the plugin:"
echo " 1. Restart QGIS"
echo " 2. Go to Plugins -> Manage and Install Plugins..."
echo " 3. Enable 'Maxar Open Data'"
echo ""
fi