-
Notifications
You must be signed in to change notification settings - Fork 7
/
install_linux.sh
executable file
·164 lines (146 loc) · 3.72 KB
/
install_linux.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#!/bin/sh
# A-Track installer for GNU/Linux System
# Authors: Yücel Kılıç, Murat Kaplan, Nurdan Karapınar, Tolga Atay.
# This is an open-source software licensed under GPLv3.
# Variables to use
DEPS_deb="python3 python3-dev python3-pip python3-numpy
python3-scipy python3-pil imagemagick libxt-dev git sextractor
build-essential
"
DEPS_rpm="python3 python3-devel python3-pip python3-numpy
python3-scipy python3-pillow ImageMagick libXt-devel git
sextractor make automake gcc gcc-c++
kernel-devel
"
ROOT_UID=0
#E_NOTROOT=67
# Stop if there are any errors.
set -e
# Check if we are root.
if [ ! "`whoami`" = "root" ]
then
echo ' Please run the script as root or sudo.'
echo ' If you are in Ubuntu, you can'
echo ' become root with'
echo ' sudo -s'
echo ' or '
echo ' sudo ./install.sh'
exit 1
fi
# Functions to use.
#
atrack_dep_deb(){
echo ''
echo ' Installing dependencies for A-Track.'
echo ' (Be patient...)'
echo ''
apt-get update
apt-get install --no-install-recommends -y $DEPS_deb
}
atrack_dep_rpm(){
echo ''
echo ' Installing dependencies (Be patient...)'
echo ''
yum -y install $DEPS_rpm
}
atrack_dep_pip(){
echo ''
echo ' Installing dependencies via pip3.'
echo ''
echo ''
echo ' Installing pandas, numpy, pyfits, pyds9'
echo ' (Be patient...)'
echo ''
pip3 install --upgrade pandas pyfits
pip3 install git+https://github.com/ericmandel/pyds9.git#egg=pyds9
mkdir atrack_tmp/
cd atrack_tmp/
echo ''
echo ' Installing alipy.'
echo ''
git clone https://github.com/akdeniz-uzay/alipy.git
cd alipy
python3 setup.py install
cd ..
echo ''
echo ' Installing astroasciidata.'
echo ''
git clone https://github.com/japs/astroasciidata.git
cd astroasciidata
python3 setup.py install
cd ../..
echo ''
echo ' Installing f2n.'
echo ''
cd f2n
python3 setup.py install
cd ..
if [ -x "/usr/bin/sextractor" ] ; then
ln -s /usr/bin/sextractor /usr/bin/sex
fi
rm -rf atrack_tmp/
}
atrack_post(){
echo ''
echo ' A-Track has been installed.'
echo ''
echo ' You can open a command-line interface'
echo ' in the A-Track directory and run A-Track.'
echo ' Example: python3 atrack.py fits_dir/'
echo ''
}
install_atrack_deb(){
atrack_dep_deb
atrack_dep_pip
atrack_post
}
install_atrack_rpm(){
atrack_dep_rpm
atrack_dep_pip
atrack_post
}
fail_install(){
echo ''
echo 'Do you have the required GNU/Linux Distro?'
echo '(Fedora, Ubuntu, Debian, LinuxMint, CentOS, RedHat)'
echo 'You need to install A-Track manually :('
echo ''
}
# Check which distro we are using and run the appropriate script.
distro=$(cat /etc/issue| head -n1| awk '{print $1}')
# LinuxMint => Linux
if [ $distro = "Debian" -o $distro = "Ubuntu" -o $distro = "Linux" ]; then
echo ''
echo 'The following extra packages will be installed for A-Track;'
echo 'pandas, numpy, pyfits, alipy, astroasciidata, pyds9'
echo $DEPS_deb
echo ''
read -r -p "Do you want to proceed? [y/N] " response
case $response in
[yY][eE][sS]|[yY])
rm -rf atrack_tmp/;
install_atrack_deb;
;;
*)
exit 1
;;
esac
elif [ $distro = "Fedora" -o $distro = "CentOS" ]; then
echo ''
echo 'The following extra packages will be installed for A-Track;'
echo 'pandas, numpy, pyfits, alipy, astroasciidata, pyds9'
echo $DEPS_rpm
echo ''
read -r -p "Do you want to proceed? [y/N] " response
case $response in
[yY][eE][sS]|[yY])
rm -rf atrack_tmp/;
install_atrack_rpm;
;;
*)
exit 1
;;
esac
else fail_install;
fi
exit