-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·98 lines (83 loc) · 3.23 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
·98 lines (83 loc) · 3.23 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
#!/usr/bin/env bash
# Stop script if an error is encountered
set -e
# Set parsed arguments
PLATO_WORKDIR=$1
# Set global parameters
POETRY=$HOME/.local/bin
PLATO_SETUP=$PWD/.bash_profile
PLATO_PROJECT_HOME=$PWD
PLATONIUM=$PLATO_PROJECT_HOME/python/platosim/platonium
# If no arguments are given write usage message
if [ -z "$PLATO_WORKDIR" ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
echo ""
echo "Usage: setup.sh"
echo ""
echo "ARGUMENTS:"
echo "</path/to/plato_workdir> : Location to PlatoSim working directory"
echo ""
echo "DESCRIPTION:"
echo "PLATOnium is a PlatoSim toolkit that allows the user to run multi-camera"
echo "simulations and while also using the LESIA pipeline in extention to extract"
echo "on-ground or on-board data products in accordance to the mission strategy."
echo "Given the PLATO_WORDIR as input arguments, this script sets up your path"
echo "environments so they are globally defined on your system."
echo ""
echo "NOTE:"
echo "Only for Linux UNIX users!"
echo ""
exit 1
else
# SETUP PLATONIUM
# Footprint of project setup (overwrite)
if [ -f "$PLATO_SETUP" ]; then
rm $PLATO_SETUP
fi
# Create setup file
touch $PLATO_SETUP
# Export paths
echo "#!/usr/bin/env bash" >> $PLATO_SETUP
echo "export POETRY=$POETRY" >> $PLATO_SETUP
echo "export PLATO_PROJECT_HOME=$PWD" >> $PLATO_SETUP
echo "export PLATO_WORKDIR=$PLATO_WORKDIR" >> $PLATO_SETUP
echo "export PYTHONPATH=$PYTHONPATH:$PLATO_PROJECT_HOME/python" >> $PLATO_SETUP
# Add Write a bash_profile that will be loaded
#if grep -q "source $PLATO_SETUP" "$HOME/.bashrc"; then
echo "" >> $HOME/.bashrc
echo "# >>> -- Export all PlatoSim paths -- <<<" >> $HOME/.bashrc
echo "source $PLATO_SETUP" >> $HOME/.bashrc
echo "# >>> ------------------------------- <<<" >> $HOME/.bashrc
# Add scripts to global executables
cp -rf $PLATONIUM/picsim.py $CONDA_PREFIX/bin/picsim
cp -rf $PLATONIUM/varsim.py $CONDA_PREFIX/bin/varsim
cp -rf $PLATONIUM/payload.py $CONDA_PREFIX/bin/payload
cp -rf $PLATONIUM/platonium.py $CONDA_PREFIX/bin/platonium
cp -rf $PLATONIUM/../scripts/migtool.py $CONDA_PREFIX/bin/migtool
cp -rf $PLATONIUM/../scripts/pdshow.py $CONDA_PREFIX/bin/pdshow
chmod +x $CONDA_PREFIX/bin/picsim
chmod +x $CONDA_PREFIX/bin/varsim
chmod +x $CONDA_PREFIX/bin/payload
chmod +x $CONDA_PREFIX/bin/platonium
chmod +x $CONDA_PREFIX/bin/migtool
chmod +x $CONDA_PREFIX/bin/pdshow
# PROLOGUE
# Finish with prolog message
echo "----------------------------"
echo " PLATOnium has been set up !"
echo "----------------------------"
echo ""
echo " From bash checkout:"
echo ""
echo ">> picsim -h"
echo ">> varsim -h"
echo ">> payload -h"
echo ">> platonium -h"
echo ""
echo " See also help functions:"
echo ""
echo ">> pdshow -h"
echo ">> migtool -h"
echo ""
# Reload .bashrc
bash
fi