1- #! /bin/bash
1+ #! /bin/sh
22
33# Copyright 2013-2023, Derrick Wood <[email protected] >44#
55# This file is part of the Kraken 2 taxonomic sequence classification system.
66
77set -e
88
9- VERSION=" 2.1.3"
9+ SCRIPT=" $( realpath " $0 " ) "
10+ ROOT=$( dirname " $SCRIPT " )
11+ VERSION=" $( cat " $ROOT /VERSION" ) "
12+
13+ cd " $ROOT "
1014
1115if [ -z " $1 " ] || [ -n " $2 " ]
1216then
13- echo " Usage: $( basename $0 ) KRAKEN2_DIR"
17+ echo " Usage: $( basename " $SCRIPT " ) KRAKEN2_DIR"
1418 exit 64
1519fi
1620
2327
2428# Perl cmd used to canonicalize dirname - "readlink -f" doesn't work
2529# on OS X.
26- export KRAKEN2_DIR=$( perl -MCwd=abs_path -le ' print abs_path(shift)' " $1 " )
30+ export KRAKEN2_DIR
31+ KRAKEN2_DIR=$( perl -MCwd=abs_path -le ' print abs_path(shift)' " $1 " )
2732
2833mkdir -p " $KRAKEN2_DIR "
2934make -C src install
3035for file in scripts/*
3136do
37+ destination_file=" $KRAKEN2_DIR /$( basename " $file " ) "
3238 perl -pl -e ' BEGIN { while (@ARGV) { $_ = shift; ($k,$v) = split /=/, $_, 2; $H{$k} = $v } }' \
3339 -e ' s/#####=(\w+)=#####/$H{$1}/g' \
3440 " KRAKEN2_DIR=$KRAKEN2_DIR " " VERSION=$VERSION " \
35- < " $file " > " $KRAKEN2_DIR / $( basename $file ) "
41+ < " $file " > " $destination_file "
3642 if [ -x " $file " ]
3743 then
38- chmod +x " $KRAKEN2_DIR / $( basename $file ) "
44+ chmod +x " $destination_file "
3945 fi
4046done
4147
@@ -44,7 +50,7 @@ echo "Kraken 2 installation complete."
4450echo
4551echo " To make things easier for you, you may want to copy/symlink the following"
4652echo " files into a directory in your PATH:"
47- for file in $KRAKEN2_DIR /kraken2*
53+ for file in " $KRAKEN2_DIR " /kraken2*
4854do
4955 if [ -x " $file " ]
5056 then
0 commit comments