-
Notifications
You must be signed in to change notification settings - Fork 4
/
install_CCI_LC.sh
executable file
·71 lines (62 loc) · 1.65 KB
/
install_CCI_LC.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
# Get and install ESA-CCI Maps
# File created for MAGO Project
# Alekos Falagas (alek.falagas@gmail.com)
echo "Provide SNAP installation path:"
read -p "Is installation path /home/eouser/$USER/esa-snap/ and auxiliary path /home/eouser/$USER/.snap? [Y/n] " ANSWER
case "$ANSWER" in
[yY] | [yY][eE][sS])
SNAP_INSTALLATION_FOLDER="/home/eouser/$USER/esa-snap/"
SNAP_AUX_FOLDER="/home/eouser/$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
# NO NEED FOR ROOT ACCESS is required for the instalation
FTP="ftp://geo10.elie.ucl.ac.be/CCI/LandCover/ESACCI-LC-L4-LCCS-Map-300m-P1Y-2015-v2.0.7.zip"
CCI=$(basename "$FTP")
if [ ! -f $CCI ]
then
echo "Getting $FTP..."
wget $FTP
echo "Done!"
else
echo "$FTP already exists..."
fi
# Making the directories for the installation
CCI_INSTALLATION_FOLDER="$SNAP_AUX_FOLDER/auxdata/LandCover/CCILandCover-2015/"
FILE="$CCI_INSTALLATION_FOLDER/$CCI"
echo "Installing $CCI under $CCI_INSTALLATION_FOLDER..."
if [ ! -d $CCI_INSTALLATION_FOLDER ]
then
mkdir -p $CCI_INSTALLATION_FOLDER
if [ ! -f $FILE ]
then
cp $CCI $CCI_INSTALLATION_FOLDER
fi
else
if [ ! -f $FILE ]
then
cp $CCI $CCI_INSTALLATION_FOLDER
fi
fi
echo "Removing downloaded files..."
rm $CCI
echo "Done!"
echo "Installation finished!"