-
Notifications
You must be signed in to change notification settings - Fork 4
/
install_senet.sh
executable file
·92 lines (80 loc) · 2.31 KB
/
install_senet.sh
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
# Get and install SEN-ET plugin
# File created for MAGO Project
# Alekos Falagas ([email protected])
echo "Provide SNAP installation path:"
read -p "Is installation path /home/$USER/esa-snap/ and auxiliary path /home/$USER/.snap? [Y/n] " ANSWER
case "$ANSWER" in
[yY] | [yY][eE][sS])
SNAP_INSTALLATION_FOLDER="/home/$USER/esa-snap/"
SNAP_AUX_FOLDER="/home/$USER/.snap"
;;
[nN] | [nN][oO])
read -p "Provide installation path: " SNAP_INSTALLATION_FOLDER
read -p "Provide auxiliary path: " SNAP_AUX_FOLDER
;;
*)
echo "Error: Invalid option."
exit 1
;;
esac
# Check if folders exist
if [ ! -d $SNAP_INSTALLATION_FOLDER ]
then
echo "Error: Directory $SNAP_INSTALLATION_FOLDER does not exists."
exit 2
fi
if [ ! -d $SNAP_AUX_FOLDER ]
then
echo "Error: Directory $SNAP_AUX_FOLDER does not exists."
exit 2
fi
URL="https://www.esa-sen4et.org/static/media/Sen-ET-plugin-v1.0.1.b41ae6c8.zip"
FILENAME=$(basename "$URL")
if [ ! -f $FILENAME ]
then
echo "Getting SEN-ET SNAP plugin..."
wget "$URL"
echo "Done!"
fi
echo "Installing SEN-ET..."
unzip $FILENAME
# Setting plugin installation paths
XML_PATH="$SNAP_AUX_FOLDER/system/config/Modules"
JAR_PATH="$SNAP_AUX_FOLDER/system/modules"
# Make directories if not exist
if [ ! -d $XML_PATH ]
then
echo "Creating $XML_PATH directory..."
mkdir $XML_PATH
fi
if [ ! -d $JAR_PATH ]
then
echo "Creating $JAR_PATH directory..."
mkdir $JAR_PATH
fi
# Unzip netbeans to snap installation folder to install SEN-ET plugin
# Make a temporary folder to unzip nbm files
TMP_DIR="$PWD/.tmp"
NBM_FILES=$(find "$PWD" -type f -name "*.nbm")
for nbm in $NBM_FILES
do
echo "Unpacking $nbm..."
unzip "$nbm" "netbeans/*" -d "$TMP_DIR"
done
cp -r "$TMP_DIR/netbeans/config/Modules/." "$XML_PATH"
cp -r "$TMP_DIR/netbeans/modules/." "$JAR_PATH"
echo "Removing $TMP_DIR directory..."
rm -rf $TMP_DIR
echo "Done."
#Python bundle installation
echo "Installing python bundle..."
BUNDLE_URL="https://senetfiles.blob.core.windows.net/files/sen-et-conda-Linux64.run"
BUNDLE_FILE=$(basename "$BUNDLE_URL")
if [ ! -f $SNAP_AUX_FOLDER/auxdata/$BUNDLE_FILE ]
then
echo "Getting python bundle..."
wget "$BUNDLE_URL" -P "$SNAP_AUX_FOLDER/auxdata/"
fi
chmod +x $SNAP_AUX_FOLDER/auxdata/$BUNDLE_FILE
(cd $SNAP_AUX_FOLDER/auxdata/; ./$BUNDLE_FILE)
echo "Installation finished."