forked from DerrickWood/kraken
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_kraken.sh
executable file
·61 lines (53 loc) · 1.75 KB
/
install_kraken.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
#!/bin/bash
# Copyright 2013-2015, Derrick Wood <[email protected]>
#
# This file is part of the Kraken taxonomic classification system.
#
# Kraken is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Kraken is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Kraken. If not, see <http://www.gnu.org/licenses/>.
set -e
VERSION="0.10.5-beta"
if [ -z "$1" ] || [ -n "$2" ]
then
echo "Usage: $(basename $0) KRAKEN_DIR"
exit 64
fi
if [ "$1" = "KRAKEN_DIR" ]
then
echo "Please replace \"KRAKEN_DIR\" with the name of the directory"
echo "that you want to install Kraken in."
exit 1
fi
# Perl cmd used to canonicalize dirname - "readlink -f" doesn't work
# on OS X.
export KRAKEN_DIR=$(perl -MCwd=abs_path -le 'print abs_path(shift)' "$1")
(cd src && make)
mkdir -p "$KRAKEN_DIR"
for file in scripts/*
do
perl -pl -e 'BEGIN { while (@ARGV) { $_ = shift; ($k,$v) = split /=/, $_, 2; $H{$k} = $v } }'\
-e 's/#####=(\w+)=#####/$H{$1}/g' \
"KRAKEN_DIR=$KRAKEN_DIR" "VERSION=$VERSION" \
< "$file" > "$KRAKEN_DIR/$(basename $file)"
done
make -C src install
chmod -R +x "$KRAKEN_DIR"
echo
echo "Kraken installation complete."
echo
echo "To make things easier for you, you may want to copy/symlink the following"
echo "files into a directory in your PATH:"
for file in $KRAKEN_DIR/kraken*
do
echo " $file"
done