| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
# =========================================================================== |
| 4 |
# |
| 5 |
# PUBLIC DOMAIN NOTICE |
| 6 |
# National Center for Biotechnology Information (NCBI) |
| 7 |
# |
| 8 |
# This software/database is a "United States Government Work" under the |
| 9 |
# terms of the United States Copyright Act. It was written as part of |
| 10 |
# the author's official duties as a United States Government employee and |
| 11 |
# thus cannot be copyrighted. This software/database is freely available |
| 12 |
# to the public for use. The National Library of Medicine and the U.S. |
| 13 |
# Government do not place any restriction on its use or reproduction. |
| 14 |
# We would, however, appreciate having the NCBI and the author cited in |
| 15 |
# any work or product based on this material. |
| 16 |
# |
| 17 |
# Although all reasonable efforts have been taken to ensure the accuracy |
| 18 |
# and reliability of the software and data, the NLM and the U.S. |
| 19 |
# Government do not and cannot warrant the performance or results that |
| 20 |
# may be obtained by using this software or data. The NLM and the U.S. |
| 21 |
# Government disclaim all warranties, express or implied, including |
| 22 |
# warranties of performance, merchantability or fitness for any particular |
| 23 |
# purpose. |
| 24 |
# |
| 25 |
# =========================================================================== |
| 26 |
# |
| 27 |
# File Name: rchive |
| 28 |
# |
| 29 |
# Author: Jonathan Kans, Aaron Ucko |
| 30 |
# |
| 31 |
# Version Creation Date: 11/07/2017 |
| 32 |
# |
| 33 |
# ========================================================================== |
| 34 |
|
| 35 |
pth=$( dirname "$0" ) |
| 36 |
|
| 37 |
case "$pth" in |
| 38 |
/* ) |
| 39 |
;; # already absolute |
| 40 |
* ) |
| 41 |
pth=$(cd "$pth" && pwd) |
| 42 |
;; |
| 43 |
esac |
| 44 |
|
| 45 |
case ":$PATH:" in |
| 46 |
*:"$pth":* ) |
| 47 |
;; |
| 48 |
* ) |
| 49 |
PATH="$PATH:$pth" |
| 50 |
export PATH |
| 51 |
;; |
| 52 |
esac |
| 53 |
|
| 54 |
# pass commands to precompiled rchive executable |
| 55 |
PATH=/bin:/usr/bin |
| 56 |
export PATH |
| 57 |
osname=`uname -s` |
| 58 |
cputype=`uname -m` |
| 59 |
case "$osname-$cputype" in |
| 60 |
Linux-x86_64 ) platform=Linux ;; |
| 61 |
Darwin-x86_64 ) platform=Darwin ;; |
| 62 |
Darwin-*arm* ) platform=Silicon ;; |
| 63 |
CYGWIN_NT-* | MINGW*-* ) platform=CYGWIN_NT ;; |
| 64 |
Linux-*arm* ) platform=ARM ;; |
| 65 |
Linux-aarch64 ) platform=ARM64 ;; |
| 66 |
* ) platform=UNSUPPORTED ;; |
| 67 |
esac |
| 68 |
compiled=$0."$platform" |
| 69 |
if [ -x "$compiled" ] |
| 70 |
then |
| 71 |
exec "$compiled" "$@" |
| 72 |
else |
| 73 |
echo "" |
| 74 |
echo "Unable to locate rchive executable. Please execute the following:" |
| 75 |
echo "" |
| 76 |
echo " nquire -dwn ftp.ncbi.nlm.nih.gov entrez/entrezdirect rchive.$platform.gz" |
| 77 |
echo " gunzip -f rchive.$platform.gz" |
| 78 |
echo " chmod +x rchive.$platform" |
| 79 |
echo "" |
| 80 |
fi |