forked from dcnora/photometrypipeline
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpost_install.sh
60 lines (45 loc) · 2.1 KB
/
post_install.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
#!/bin/bash
set -e
echo 'Setting up environment'
##########################
# check for dependencies #
##########################
# SExtractor
command -v sex >/dev/null 2>&1 || { echo >&2 "SExtractor is required but it's not installed. Aborting."; exit 1; }
# Swarp
command -v swarp >/dev/null 2>&1 || { echo >&2 "Swarp is required but it's not installed. Aborting."; exit 1; }
# Scamp
command -v scamp >/dev/null 2>&1 || { echo >&2 "Scamp is required but it's not installed. Aborting."; exit 1; }
# MissFITS
command -v missfits >/dev/null 2>&1 || { echo >&2 "MissFITS is required but it's not installed. Aborting."; exit 1; }
# cdsclient
command -v findcat >/dev/null 2>&1 || { echo >&2 "cdsclient is required but it's not installed. Aborting."; exit 1; }
##########################
# set up environment #
##########################
PACKAGE_NAME="photopipe"
# set project root directory
# http://stackoverflow.com/a/246128
# export PIPE_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # allows startup.sh to be called from any directory. will fail if last component of path to startup.sh is a symlink.
PIPE_ROOT=$(python -c "import site; print(site.getsitepackages()[0])")"/"$PACKAGE_NAME
AUTOPROC_CONFIG_PATH=$PIPE_ROOT"/reduction/auto/pipeautoproc.par"
SWARP_PATH="$(command -v swarp)"
SEX_PATH="$(command -v sex)"
SCAMP_PATH="$(command -v scamp)"
touch $AUTOPROC_CONFIG_PATH
# http://unix.stackexchange.com/a/77278
cat <<EOT >> $AUTOPROC_CONFIG_PATH
autoastrocommand : $PIPE_ROOT/reduction/astrom/vlt_autoastrometry.py
getsedcommand : $PIPE_ROOT/photometry/dependencies/get_SEDs.py
swarpcommand : $SWARP_PATH
sexcommand : $SEX_PATH
scampcommand : $SCAMP_PATH
prefix : 2
datadir :
EOT
# add pipeline directories to python path
PYTHONPATH=$PIPE_ROOT/instruments:$PIPE_ROOT/photometry:$PIPE_ROOT/photometry/dependencies:$PIPE_ROOT/reduction:$PIPE_ROOT/reduction/dependencies:$PIPE_ROOT/reduction/auto:$PIPE_ROOT/reduction/astrom:$PYTHONPATH
# save permanently
echo '# photopipe environment' >> /etc/profile
echo 'export PIPE_ROOT='$PIPE_ROOT >> /etc/profile
echo 'export PYTHONPATH='$PYTHONPATH >> /etc/profile