| 1 | #!/bin/bash |
|---|
| 2 | |
|---|
| 3 | bold=$(tput bold) |
|---|
| 4 | underline=$(tput smul) |
|---|
| 5 | normal=$(tput sgr0) |
|---|
| 6 | |
|---|
| 7 | echoerr() { |
|---|
| 8 | cat <<< "$@" 1>&2 |
|---|
| 9 | } |
|---|
| 10 | |
|---|
| 11 | # error message function (nested exit): |
|---|
| 12 | trap "exit 1" TERM |
|---|
| 13 | export ARBINST_SCRIPT_PID=$$ |
|---|
| 14 | err() { |
|---|
| 15 | echoerr "Error in `basename $0`:" |
|---|
| 16 | echoerr "${bold} $@${normal}" |
|---|
| 17 | echoerr "Please fix and then rerun script!" |
|---|
| 18 | kill -s TERM $ARBINST_SCRIPT_PID |
|---|
| 19 | } |
|---|
| 20 | |
|---|
| 21 | separator() { |
|---|
| 22 | echo '' |
|---|
| 23 | } |
|---|
| 24 | |
|---|
| 25 | separator |
|---|
| 26 | echo "${bold}${underline}Welcome to the ARB Package${normal}" |
|---|
| 27 | |
|---|
| 28 | test -z "${BASH_VERSINFO}" && separator && err "Please call this script using 'bash arb_install.sh'" |
|---|
| 29 | |
|---|
| 30 | elim_invalid_chars() { |
|---|
| 31 | local FILE="${1}" |
|---|
| 32 | # remove some characters really unwanted in paths: |
|---|
| 33 | FILE=${FILE// /} |
|---|
| 34 | FILE=${FILE//\'/} |
|---|
| 35 | FILE=${FILE//\"/} |
|---|
| 36 | FILE=${FILE//\`/} |
|---|
| 37 | echo ${FILE} |
|---|
| 38 | } |
|---|
| 39 | |
|---|
| 40 | DL_DIR=$(pwd) |
|---|
| 41 | DL_NS=$(elim_invalid_chars "${DL_DIR}") |
|---|
| 42 | |
|---|
| 43 | if [ ! "$DL_NS" = "$DL_DIR" ]; then |
|---|
| 44 | separator |
|---|
| 45 | if [ ! "$DL_NS" = "" ]; then |
|---|
| 46 | echo "Note: the path '$DL_NS' would be ok.." |
|---|
| 47 | fi |
|---|
| 48 | err "Your download directory '$DL_DIR' contains invalid characters." |
|---|
| 49 | fi |
|---|
| 50 | |
|---|
| 51 | cont() { |
|---|
| 52 | echo "Warning: $@" 1>&2 |
|---|
| 53 | echo "${bold}Do you want to continue [y]${normal}" |
|---|
| 54 | read var |
|---|
| 55 | case "$var" in |
|---|
| 56 | n) err "Script aborted by user" ;; |
|---|
| 57 | *) echo 'Continuing...' ;; |
|---|
| 58 | esac |
|---|
| 59 | } |
|---|
| 60 | |
|---|
| 61 | untar() { |
|---|
| 62 | local TGZ="$1"; shift |
|---|
| 63 | |
|---|
| 64 | # remove old DEPOT BUG |
|---|
| 65 | rm -f DEPOT/gde/bin |
|---|
| 66 | |
|---|
| 67 | if [ ! -r "${TGZ}" ]; then |
|---|
| 68 | err "Cannot find or read file '${TGZ}'" |
|---|
| 69 | fi |
|---|
| 70 | if gunzip --stdout "${TGZ}" | tar xfv -; then |
|---|
| 71 | echo ">>> ${TGZ} uncompressed and untared" |
|---|
| 72 | if [ ! -e bin/arb_ntree ]; then |
|---|
| 73 | err "bin/arb_ntree not found (wrong archive?)" |
|---|
| 74 | fi |
|---|
| 75 | if [ ! -x bin/arb_ntree ]; then |
|---|
| 76 | err "bin/arb_ntree not executable (wrong archive?)" |
|---|
| 77 | fi |
|---|
| 78 | else |
|---|
| 79 | err "Failed to uncompress/untar '${TGZ}'" |
|---|
| 80 | fi |
|---|
| 81 | } |
|---|
| 82 | |
|---|
| 83 | arb_realpath() { |
|---|
| 84 | # replacement for 'realpath' |
|---|
| 85 | # |
|---|
| 86 | # Note: this function is duplicated in SH/arb_path.sh@arb_realpath |
|---|
| 87 | local FILE="$1"; shift |
|---|
| 88 | |
|---|
| 89 | local REALPATH=$(realpath "$FILE" 2>/dev/null ) |
|---|
| 90 | local READLINK=$(readlink -f "$FILE" 2>/dev/null ) |
|---|
| 91 | |
|---|
| 92 | if [ -z "${REALPATH}" ]; then |
|---|
| 93 | if [ -z "${READLINK}" ]; then |
|---|
| 94 | echoerr "Warning: neighter realpath nor readlink works here" |
|---|
| 95 | if [ -e "${FILE}" ]; then |
|---|
| 96 | local PWDFILE="$(pwd)/${FILE}" |
|---|
| 97 | if [ -e "${PWDFILE}" ]; then echo "${PWDFILE}" |
|---|
| 98 | else echo "${FILE}" |
|---|
| 99 | fi |
|---|
| 100 | else echo "${FILE}" |
|---|
| 101 | fi |
|---|
| 102 | else echo "${READLINK}" |
|---|
| 103 | fi |
|---|
| 104 | else |
|---|
| 105 | if [ -z "${READLINK}" ]; then echo "${REALPATH}" |
|---|
| 106 | else |
|---|
| 107 | if [ "${READLINK}" != "${REALPATH}" ]; then |
|---|
| 108 | echoerr "Warning: realpath and readlink differ (REALPATH=${REALPATH} READLINK=${READLINK})" |
|---|
| 109 | fi |
|---|
| 110 | echo "${REALPATH}" |
|---|
| 111 | fi |
|---|
| 112 | fi |
|---|
| 113 | } |
|---|
| 114 | |
|---|
| 115 | # -------------------------------------------------- |
|---|
| 116 | # detect input archives: |
|---|
| 117 | |
|---|
| 118 | separator |
|---|
| 119 | |
|---|
| 120 | ARB_TGZ= |
|---|
| 121 | SINA_TGZ= |
|---|
| 122 | |
|---|
| 123 | for TGZ in arb*.tgz; do |
|---|
| 124 | NOSINA=${TGZ%-sina-fat.tgz} |
|---|
| 125 | if [ "${NOSINA}" = "$TGZ" ]; then |
|---|
| 126 | if [ -z "${ARB_TGZ}" ]; then |
|---|
| 127 | ARB_TGZ="${TGZ}" |
|---|
| 128 | else |
|---|
| 129 | echo "Found two arb archives:" |
|---|
| 130 | ls -al -h "${ARB_TGZ}" "${TGZ}" |
|---|
| 131 | echo "" |
|---|
| 132 | err "cannot decide which to use. Please remove one of these!" |
|---|
| 133 | fi |
|---|
| 134 | else |
|---|
| 135 | if [ -z "${SINA_TGZ}" ]; then |
|---|
| 136 | SINA_TGZ="${TGZ}" |
|---|
| 137 | else |
|---|
| 138 | echo "Found two sina archives:" |
|---|
| 139 | ls -al -h "${SINA_TGZ}" "${TGZ}" |
|---|
| 140 | echo "" |
|---|
| 141 | err "cannot decide which to use. Please remove one of these!" |
|---|
| 142 | fi |
|---|
| 143 | fi |
|---|
| 144 | done |
|---|
| 145 | |
|---|
| 146 | if [ -n "${SINA_TGZ}" ]; then |
|---|
| 147 | SINA_TGZ=$(arb_realpath "${SINA_TGZ}") |
|---|
| 148 | echo "Detected sina tarball: ${SINA_TGZ}" |
|---|
| 149 | fi |
|---|
| 150 | |
|---|
| 151 | if [ -z "${ARB_TGZ}" ]; then |
|---|
| 152 | echo "For available arb versions please refer to" |
|---|
| 153 | echo " http://bugs.arb-home.de/wiki#ARBversions" |
|---|
| 154 | separator |
|---|
| 155 | err "No arb tarball found in `pwd`" |
|---|
| 156 | fi |
|---|
| 157 | ARB_TGZ=$(arb_realpath "${ARB_TGZ}") |
|---|
| 158 | echo "Detected arb tarball: ${ARB_TGZ}" |
|---|
| 159 | |
|---|
| 160 | # -------------------------------------------------- |
|---|
| 161 | # general instructions + ask for destination: |
|---|
| 162 | |
|---|
| 163 | separator |
|---|
| 164 | echo ' Note: - You may abort this script with ctrl-"C"' |
|---|
| 165 | echo ' - You can rerun this script as often as you like' |
|---|
| 166 | echo ' - Old ARB data will be kept if requested (in this case' |
|---|
| 167 | echo ' you can simply change some options)' |
|---|
| 168 | echo ' - Pressing <return> will select the value in brackets' |
|---|
| 169 | separator |
|---|
| 170 | echo "${underline}Please answer some questions:${normal}" |
|---|
| 171 | separator |
|---|
| 172 | echo 'Where would you like to install ARB?' |
|---|
| 173 | echo ' ARB is not a single program but a set of programs, datafiles ...' |
|---|
| 174 | echo ' To install ARB, all files will be stored in a single directory.' |
|---|
| 175 | separator |
|---|
| 176 | echo ' This script will create that directory, copy all needed files and' |
|---|
| 177 | echo ' sets permissions correctly.' |
|---|
| 178 | separator |
|---|
| 179 | echo ' Please note that you will need write permission at the destination.' |
|---|
| 180 | separator |
|---|
| 181 | if [ "$EUID" -ne 0 ]; then |
|---|
| 182 | # normal user |
|---|
| 183 | ARBHOMED=${HOME}/arb |
|---|
| 184 | echo ' - to install ARB inside your home directory, enter "'${ARBHOMED}'"' |
|---|
| 185 | echo ' - otherwise press Ctrl-C now to abort installation and' |
|---|
| 186 | echo ' rerun this script using:' |
|---|
| 187 | echo ' sudo bash arb_install.sh' |
|---|
| 188 | else |
|---|
| 189 | # root user |
|---|
| 190 | ARBHOMED=/usr/arb |
|---|
| 191 | echo ' - to install ARB for all users, enter "'${ARBHOMED}'"' |
|---|
| 192 | fi |
|---|
| 193 | separator |
|---|
| 194 | |
|---|
| 195 | if [ "$ARBHOME" != "" ]; then |
|---|
| 196 | if test -f $ARBHOME/lib/arb_tcp.dat; then |
|---|
| 197 | echo " Note: There seems to be an existing arb installation at" |
|---|
| 198 | echo " ${ARBHOME}" |
|---|
| 199 | separator |
|---|
| 200 | fi |
|---|
| 201 | fi |
|---|
| 202 | |
|---|
| 203 | echo "${bold}Enter full installation path: [${ARBHOME:-${ARBHOMED}}]${normal}" |
|---|
| 204 | read ARBHOMEI |
|---|
| 205 | separator |
|---|
| 206 | |
|---|
| 207 | if [ "$ARBHOMEI" = "" ]; then |
|---|
| 208 | ARBHOME="${ARBHOME:-${ARBHOMED}}"; |
|---|
| 209 | else |
|---|
| 210 | ARBHOME="${ARBHOMEI}"; |
|---|
| 211 | fi |
|---|
| 212 | |
|---|
| 213 | # check for some really unwanted characters in path: |
|---|
| 214 | AH_NS=$(elim_invalid_chars ${ARBHOME}) |
|---|
| 215 | if [ ! "$AH_NS" = "$ARBHOME" ]; then |
|---|
| 216 | separator |
|---|
| 217 | if [ ! "$AH_NS" = "" ]; then |
|---|
| 218 | echo "Note: the path '$AH_NS' would be ok.." |
|---|
| 219 | fi |
|---|
| 220 | err "The specified path '$ARBHOME' contains invalid characters." |
|---|
| 221 | fi |
|---|
| 222 | |
|---|
| 223 | ARBHOME=$(arb_realpath "${ARBHOME}") |
|---|
| 224 | |
|---|
| 225 | # -------------------------------------------------- |
|---|
| 226 | # handle existing arb installation: |
|---|
| 227 | |
|---|
| 228 | if test -d $ARBHOME; then |
|---|
| 229 | if test -w $ARBHOME; then |
|---|
| 230 | separator |
|---|
| 231 | echo 'The destination directory' |
|---|
| 232 | echo " $ARBHOME" |
|---|
| 233 | echo 'already exists!' |
|---|
| 234 | |
|---|
| 235 | if [ -z "$(ls -A ${ARBHOME})" ]; then |
|---|
| 236 | echo "Note: directory is empty and will be used for arb installation." |
|---|
| 237 | else |
|---|
| 238 | ARB_TCP_BAK=arb_tcp_`date +%Y%m%d`.dat |
|---|
| 239 | if [ ! -e ${ARB_TCP_BAK} -a -e $ARBHOME/lib/arb_tcp.dat ]; then |
|---|
| 240 | echo '[creating backup copy of arb_tcp.dat in download directory]' |
|---|
| 241 | cp $ARBHOME/lib/arb_tcp.dat ${ARB_TCP_BAK} |
|---|
| 242 | fi |
|---|
| 243 | |
|---|
| 244 | echo ' You may now' |
|---|
| 245 | echo ' * either delete the old arb directory completely' |
|---|
| 246 | echo ' * or only update/change options of the old version.' |
|---|
| 247 | echo "${bold}Delete old directory? (y/n)[n]${normal}" |
|---|
| 248 | read delete_dir |
|---|
| 249 | echo |
|---|
| 250 | case "$delete_dir" in |
|---|
| 251 | y) |
|---|
| 252 | if rm -r $ARBHOME/* ;then |
|---|
| 253 | echo ">>> all data in $ARBHOME deleted" |
|---|
| 254 | else |
|---|
| 255 | cont "failed to delete files in $ARBHOME" |
|---|
| 256 | fi |
|---|
| 257 | ;; |
|---|
| 258 | *) |
|---|
| 259 | if test -f $ARBHOME/lib/arb_tcp.dat; then |
|---|
| 260 | bckup=$ARBHOME/lib/arb_tcp.dat.`date +%y%m%d%H%M%S` |
|---|
| 261 | echo ">>>old $ARBHOME/lib/arb_tcp.dat found" |
|---|
| 262 | echo ">>>backup to $bckup" |
|---|
| 263 | cp $ARBHOME/lib/arb_tcp.dat $bckup |
|---|
| 264 | fi |
|---|
| 265 | echo ">>> old data not deleted";; |
|---|
| 266 | esac |
|---|
| 267 | fi |
|---|
| 268 | else |
|---|
| 269 | err "directory exists and is not writable"; |
|---|
| 270 | fi |
|---|
| 271 | else |
|---|
| 272 | if mkdir -p $ARBHOME; then |
|---|
| 273 | echo ">>> $ARBHOME created" |
|---|
| 274 | else |
|---|
| 275 | err "cannot create directory $ARBHOME"; |
|---|
| 276 | fi |
|---|
| 277 | fi |
|---|
| 278 | |
|---|
| 279 | cd $ARBHOME |
|---|
| 280 | ARBHOME=`pwd` |
|---|
| 281 | |
|---|
| 282 | if [ -d lib/pictures ]; then |
|---|
| 283 | separator |
|---|
| 284 | echo "${underline}Old ARB package found${normal} (type n to change only some options)." |
|---|
| 285 | echo "${bold} Do you want to update the old package? (y/n)[y]${normal}" |
|---|
| 286 | read var; |
|---|
| 287 | case "$var" in |
|---|
| 288 | n) |
|---|
| 289 | echo "Old version unchanged" |
|---|
| 290 | ;; |
|---|
| 291 | *) |
|---|
| 292 | echo "updating ARB"; |
|---|
| 293 | untar "${ARB_TGZ}" |
|---|
| 294 | ;; |
|---|
| 295 | esac |
|---|
| 296 | else |
|---|
| 297 | untar "${ARB_TGZ}" |
|---|
| 298 | fi |
|---|
| 299 | |
|---|
| 300 | # -------------------------------------------------- |
|---|
| 301 | # configure ptserver: |
|---|
| 302 | |
|---|
| 303 | separator |
|---|
| 304 | echo "${underline}Specify PT_SERVER files location${normal}" |
|---|
| 305 | echo ' ARB needs a writeable directory to store the pt_server files. ' |
|---|
| 306 | echo ' Those files are needed for fast database search' |
|---|
| 307 | echo ' (by probe_design, probe_match and the automatic aligner)' |
|---|
| 308 | echo ' and need a lot of disc space (up to several 100 mega bytes,' |
|---|
| 309 | echo ' e.g. 4000 16S RNA sequences require about 40 MB).' |
|---|
| 310 | echo ' This files are not created now. They can be build by any user via' |
|---|
| 311 | echo ' <ARB_NTREE/Probes/PT_SERVER admin/Build server>' |
|---|
| 312 | echo ' You may define a special directory as the pt_server files location.' |
|---|
| 313 | echo ' This prevents any loss of data installing a new version of ' |
|---|
| 314 | echo ' ARB. ' |
|---|
| 315 | |
|---|
| 316 | echo 'Where do you want to put your pt_server data' |
|---|
| 317 | echo ' 1. <CR> - (new installation of ARB)' |
|---|
| 318 | echo ' for placing pt_server data within ARB directory tree' |
|---|
| 319 | echo ' (Default location).' |
|---|
| 320 | echo ' - (updating ARB)' |
|---|
| 321 | echo ' using the previous location' |
|---|
| 322 | echo ' 2. "Path" to link pt_server data directory to' |
|---|
| 323 | echo " (if you choose this option you won't loose your PT-Servers when doing future software updates)" |
|---|
| 324 | echo "${bold}Enter path:${normal}" |
|---|
| 325 | read pt_dir |
|---|
| 326 | echo |
|---|
| 327 | case "$pt_dir" in |
|---|
| 328 | "") |
|---|
| 329 | echo "installing the pt_server data in $ARBHOME/lib/pts" |
|---|
| 330 | if test -h ${ARBHOME}/lib/pts ; then |
|---|
| 331 | echo "Are you sure to delete " |
|---|
| 332 | echo ">>> pt_server files at non default location:" |
|---|
| 333 | ls -ld ${ARBHOME}/lib/pts |
|---|
| 334 | else |
|---|
| 335 | if test -d ${ARBHOME}/lib/pts; then |
|---|
| 336 | echo ">>> pt_server files at default location: unchanged" |
|---|
| 337 | else |
|---|
| 338 | (cd lib;rm -f pts;mkdir pts;) |
|---|
| 339 | fi |
|---|
| 340 | fi;; |
|---|
| 341 | *) |
|---|
| 342 | echo "changing your pt_server file location" |
|---|
| 343 | if test -h ${ARBHOME}/lib/pts; then |
|---|
| 344 | echo ">>> non default location found: removing old link" |
|---|
| 345 | rm lib/pts |
|---|
| 346 | else |
|---|
| 347 | if test -d ${ARBHOME}/lib/pts; then |
|---|
| 348 | echo ">>> data in default location found" |
|---|
| 349 | echo "${bold}Do you want to remove old ptserver data (recommended)? [y]${normal}" |
|---|
| 350 | read ANSWER |
|---|
| 351 | case "$ANSWER" in |
|---|
| 352 | n) echo 'data not deleted' ;; |
|---|
| 353 | *) rm -r lib/pts |
|---|
| 354 | echo 'data deleted' ;; |
|---|
| 355 | esac |
|---|
| 356 | fi |
|---|
| 357 | fi |
|---|
| 358 | if test ! -d $pt_dir; then |
|---|
| 359 | echo ">>> Creating special PT_SERVER directory $pt_dir" |
|---|
| 360 | if mkdir -p $pt_dir; then |
|---|
| 361 | echo ">>> $pt_dir created" |
|---|
| 362 | else |
|---|
| 363 | err "Couldn't create $pt_dir" |
|---|
| 364 | fi |
|---|
| 365 | fi |
|---|
| 366 | (cd lib;ln -s $pt_dir pts;) |
|---|
| 367 | esac |
|---|
| 368 | |
|---|
| 369 | separator |
|---|
| 370 | echo 'Who is responsible for the PT_SERVER index files?' |
|---|
| 371 | echo ' Answer y: if you trust your users (less administration; recommended)' |
|---|
| 372 | echo ' n: if PT_SERVER files shall only be changable by administrator' |
|---|
| 373 | echo ' or simply press return to keep the settings of an old installation.' |
|---|
| 374 | echo "${bold}Should everybody be allowed to build/update PT_SERVER files? (y/n/dont_change)[dont_change]${normal}" |
|---|
| 375 | read var |
|---|
| 376 | echo |
|---|
| 377 | case "$var" in |
|---|
| 378 | y) |
|---|
| 379 | echo ">>> all users are allowed to update the PT_SERVER"; |
|---|
| 380 | chmod 777 lib/pts |
|---|
| 381 | chmod 666 lib/pts/* 2>/dev/null ;; |
|---|
| 382 | n) |
|---|
| 383 | echo ">>> only `whoami` is allowed to update the pt_server"; |
|---|
| 384 | chmod 755 lib/pts |
|---|
| 385 | chmod 644 lib/pts/* 2>/dev/null ;; |
|---|
| 386 | *) |
|---|
| 387 | echo ">>> permissions of lib/pts remain unchanged";; |
|---|
| 388 | esac |
|---|
| 389 | |
|---|
| 390 | # -------------------------------------------------- |
|---|
| 391 | # configure nameserver: |
|---|
| 392 | |
|---|
| 393 | separator |
|---|
| 394 | echo "${underline}NameServer installation${normal}" |
|---|
| 395 | echo ' The NameServer is a program, that synchronizes all species names' |
|---|
| 396 | echo ' of the databases of different users.' |
|---|
| 397 | echo ' Users that import foreign data into their database and want to' |
|---|
| 398 | echo ' export those data to other ARB users should be allowed to change' |
|---|
| 399 | echo ' the names file in $ARBHOME/lib/nas/names.dat' |
|---|
| 400 | echo ' Answer y: if all users may import foreign databases' |
|---|
| 401 | echo ' n: if there are some mean untrusty users' |
|---|
| 402 | echo ' or simply press return to keep the old settings' |
|---|
| 403 | echo "${bold}Do you trust your users? (y/n/dont_change)[dont_change]${normal}" |
|---|
| 404 | read var |
|---|
| 405 | echo |
|---|
| 406 | case "$var" in |
|---|
| 407 | y) |
|---|
| 408 | echo ">>> all user are allowed to change the names file"; |
|---|
| 409 | chmod 777 lib/nas |
|---|
| 410 | chmod 666 lib/nas/*;; |
|---|
| 411 | n) |
|---|
| 412 | echo ">>> only `whoami` is allowed to change the names file ${ARBHOME}/lib/nas/names.dat" |
|---|
| 413 | chmod 755 lib/nas |
|---|
| 414 | chmod 644 lib/nas/*;; |
|---|
| 415 | *) |
|---|
| 416 | echo ">>> permissions of lib/nas remain unchanged";; |
|---|
| 417 | esac |
|---|
| 418 | |
|---|
| 419 | # -------------------------------------------------- |
|---|
| 420 | # setup arb_tcp.dat: |
|---|
| 421 | |
|---|
| 422 | separator |
|---|
| 423 | echo "${underline}Networking${normal}" |
|---|
| 424 | echo ' To speed up calculation one special host can be assigned as' |
|---|
| 425 | echo ' the PT_SERVER host. That means that all database search is done' |
|---|
| 426 | echo ' on that host. This saves computer resources as different users' |
|---|
| 427 | echo ' may share one server.' |
|---|
| 428 | echo ' To get the best results this host "H" should:' |
|---|
| 429 | echo ' 1. be fast,' |
|---|
| 430 | echo ' 2. have a lot of real memory (>=64 meg),' |
|---|
| 431 | echo ' 3. have a lot of swap space (>=400 meg),' |
|---|
| 432 | echo ' 4. allow all users to run "ssh H ...",' |
|---|
| 433 | echo ' 5. contain the discs with the PT_SERVER files.' |
|---|
| 434 | |
|---|
| 435 | echo ' n You want to assign a special Network host' |
|---|
| 436 | echo ' s You have a Stand alone computer' |
|---|
| 437 | if test "X$bckup" != "X"; then |
|---|
| 438 | echo ' o Use information of already installed ARB' |
|---|
| 439 | echo "${bold}Choose (s/n/o)[s]${normal}" |
|---|
| 440 | else |
|---|
| 441 | echo "${bold}Choose (s/n)[s]${normal}" |
|---|
| 442 | |
|---|
| 443 | fi |
|---|
| 444 | read var |
|---|
| 445 | echo |
|---|
| 446 | |
|---|
| 447 | |
|---|
| 448 | case "$var" in |
|---|
| 449 | o) |
|---|
| 450 | mv $bckup lib/arb_tcp.dat; |
|---|
| 451 | echo ">>> old lib/arb_tcp.dat restored";; |
|---|
| 452 | n) |
|---|
| 453 | separator |
|---|
| 454 | echo "Enter the name of your host for the pt_server" |
|---|
| 455 | read host |
|---|
| 456 | echo "Checking connection to $host" |
|---|
| 457 | if ssh $host ls >/dev/zero; then |
|---|
| 458 | echo ">>> ssh $host ok" |
|---|
| 459 | else |
|---|
| 460 | err ">>> cannot run 'ssh $host'"; |
|---|
| 461 | fi |
|---|
| 462 | rm -f lib/arb_tcp.dat; |
|---|
| 463 | cat lib/arb_tcp_org.dat |sed -e "/localhost\:/$host\:/g" >lib/arb_tcp.dat |
|---|
| 464 | echo ">>> server installed";; |
|---|
| 465 | *) |
|---|
| 466 | cp lib/arb_tcp_org.dat lib/arb_tcp.dat |
|---|
| 467 | echo ">>> server installed";; |
|---|
| 468 | esac |
|---|
| 469 | |
|---|
| 470 | # -------------------------------------------------- |
|---|
| 471 | # install sina: |
|---|
| 472 | |
|---|
| 473 | separator |
|---|
| 474 | echo "${underline}SINA integration${normal}" |
|---|
| 475 | if [ -n "${SINA_TGZ}" ]; then |
|---|
| 476 | echo "Detected sina archive: ${SINA_TGZ}" |
|---|
| 477 | if [ -x bin/sina ]; then |
|---|
| 478 | echo "Note: The installed arb already seems to contain sina." |
|---|
| 479 | echo " => will not install another sina!" |
|---|
| 480 | else |
|---|
| 481 | INSTALL_SINA=0 |
|---|
| 482 | HAVE_SINA=0 |
|---|
| 483 | # check for installation via SH/arb_sina_install_from_fat_tarball.sh |
|---|
| 484 | if [ -d bin/fatsina ]; then |
|---|
| 485 | echo "Note: there is already another sina installed from a tarball." |
|---|
| 486 | HAVE_SINA=1 |
|---|
| 487 | echo "${bold} Do you want to update the sina installation? (y/n)[y]${normal}" |
|---|
| 488 | else |
|---|
| 489 | echo "${bold} Do you want to install sina into arb? (y/n)[y]${normal}" |
|---|
| 490 | INSTALL_SINA=1 |
|---|
| 491 | fi |
|---|
| 492 | |
|---|
| 493 | read var; |
|---|
| 494 | case "$var" in |
|---|
| 495 | n) |
|---|
| 496 | if [ ${HAVE_SINA} = 1 ]; then |
|---|
| 497 | echo "Old sina version unchanged." |
|---|
| 498 | else |
|---|
| 499 | echo "Will not install sina." |
|---|
| 500 | fi |
|---|
| 501 | ;; |
|---|
| 502 | |
|---|
| 503 | *) |
|---|
| 504 | if [ ${HAVE_SINA} = 1 ]; then |
|---|
| 505 | echo "updating SINA from ${SINA_TGZ}"; |
|---|
| 506 | SH/arb_sina_install_from_fat_tarball.sh UNINSTALL "${ARBHOME}" |
|---|
| 507 | else |
|---|
| 508 | echo "installing SINA from ${SINA_TGZ}"; |
|---|
| 509 | fi |
|---|
| 510 | SH/arb_sina_install_from_fat_tarball.sh "${SINA_TGZ}" "${ARBHOME}" |
|---|
| 511 | ;; |
|---|
| 512 | esac |
|---|
| 513 | fi |
|---|
| 514 | else |
|---|
| 515 | if [ ! -x bin/sina ]; then |
|---|
| 516 | if [ ! -d bin/fatsina ]; then |
|---|
| 517 | echo "No sina installed with arb." |
|---|
| 518 | echo "Hint: the installation script will attempt to install sina for you," |
|---|
| 519 | echo " if you download an arb-XXX-fat-sina.tgz and" |
|---|
| 520 | echo " save it into ${DL_DIR}" |
|---|
| 521 | fi |
|---|
| 522 | fi |
|---|
| 523 | fi |
|---|
| 524 | |
|---|
| 525 | # -------------------------------------------------- |
|---|
| 526 | # finish + print instructions for setup |
|---|
| 527 | |
|---|
| 528 | separator |
|---|
| 529 | echo "${bold}>>> ARB installation completed${normal}" |
|---|
| 530 | |
|---|
| 531 | separator |
|---|
| 532 | SHELL_ANS=0 |
|---|
| 533 | |
|---|
| 534 | echo "${underline}Finally, you have to tell your system where to find arb${normal}" |
|---|
| 535 | echo "First find out which shell you are using, by opening a new terminal window and typing" |
|---|
| 536 | echo ' echo $SHELL' |
|---|
| 537 | echo "" |
|---|
| 538 | echo "Depending on what is your shell there are several choices:" |
|---|
| 539 | echo "" |
|---|
| 540 | echo " 1. Change your local .profile or .bashrc (if you are using ksh/bash, which" |
|---|
| 541 | echo " is the default shell for Linux)" |
|---|
| 542 | echo " 2. Change your local .cshrc file (if you are using csh/tcsh)" |
|---|
| 543 | echo " 3. Create an alias for arb (any shell)" |
|---|
| 544 | echo " 4. I don't want to edit anything (any shell)" |
|---|
| 545 | echo "" |
|---|
| 546 | |
|---|
| 547 | echo "${bold}Enter (1,2,3 or 4) to achieve further installation instructions:${normal}" |
|---|
| 548 | |
|---|
| 549 | while [ "$SHELL_ANS" = "0" ]; do |
|---|
| 550 | |
|---|
| 551 | read var |
|---|
| 552 | |
|---|
| 553 | separator |
|---|
| 554 | case "$var" in |
|---|
| 555 | 1) |
|---|
| 556 | echo '******************************************************'; |
|---|
| 557 | echo "${bold}add the following lines to your ~/.profile${normal}"; |
|---|
| 558 | echo "${bold}or to your ~/.bashrc for bash-users${normal}"; |
|---|
| 559 | echo '******************************************************'; |
|---|
| 560 | echo " ARBHOME=$ARBHOME;export ARBHOME"; |
|---|
| 561 | echo ' LD_LIBRARY_PATH=${ARBHOME}/lib:${LD_LIBRARY_PATH}'; |
|---|
| 562 | echo ' export LD_LIBRARY_PATH'; |
|---|
| 563 | echo ' PATH=${ARBHOME}/bin:${PATH}'; |
|---|
| 564 | echo ' export PATH'; |
|---|
| 565 | separator |
|---|
| 566 | echo 'enter the following command:'; |
|---|
| 567 | echo ' . ~/.profile' |
|---|
| 568 | SHELL_ANS=1 |
|---|
| 569 | ;; |
|---|
| 570 | 2) |
|---|
| 571 | echo '******************************************'; |
|---|
| 572 | echo "${bold}add the following lines to your ~/.cshrc${normal}"; |
|---|
| 573 | echo '******************************************'; |
|---|
| 574 | echo " setenv ARBHOME $ARBHOME"; |
|---|
| 575 | if test "X${LD_LIBRARY_PATH}" != "X"; then |
|---|
| 576 | echo ' setenv LD_LIBRARY_PATH $ARBHOME/lib\:$LD_LIBRARY_PATH'; |
|---|
| 577 | else |
|---|
| 578 | echo ' setenv LD_LIBRARY_PATH $ARBHOME/lib'; |
|---|
| 579 | fi |
|---|
| 580 | echo ' setenv PATH $ARBHOME/bin\:$PATH'; |
|---|
| 581 | separator |
|---|
| 582 | echo 'enter the following command:'; |
|---|
| 583 | echo ' source ~/.cshrc' |
|---|
| 584 | SHELL_ANS=1 |
|---|
| 585 | ;; |
|---|
| 586 | 3) |
|---|
| 587 | echo '**************************************************'; |
|---|
| 588 | echo "${bold}add one of the following lines to your init file${normal}"; |
|---|
| 589 | echo '**************************************************'; |
|---|
| 590 | echo "# bash users add to ~/.bashrc:"; |
|---|
| 591 | echo " alias arb=$ARBHOME/bin/arb"; |
|---|
| 592 | echo "# tcsh users add to ~/.cshrc:"; |
|---|
| 593 | echo " alias arb '$ARBHOME/bin/arb'"; |
|---|
| 594 | SHELL_ANS=1 |
|---|
| 595 | ;; |
|---|
| 596 | 4) |
|---|
| 597 | echo "Note: You will need to specify the full path to start arb."; |
|---|
| 598 | SHELL_ANS=2 |
|---|
| 599 | ;; |
|---|
| 600 | *) |
|---|
| 601 | echo 'wrong answer' |
|---|
| 602 | ;; |
|---|
| 603 | esac |
|---|
| 604 | done |
|---|
| 605 | |
|---|
| 606 | if [ "$EUID" -eq 0 ]; then |
|---|
| 607 | # only shown to root user: |
|---|
| 608 | separator |
|---|
| 609 | echo "${underline}Note for sysadmins:${normal}" |
|---|
| 610 | echo " In order to provide arb for all users, edit one or several" |
|---|
| 611 | echo " of the global shell init files in /etc (e.g. /etc/bash.bashrc)" |
|---|
| 612 | echo " in the same manner as described above for the" |
|---|
| 613 | echo " local shell init files." |
|---|
| 614 | separator |
|---|
| 615 | echo " Note for unintended sysadmins:" |
|---|
| 616 | echo " To edit the global bash init file use e.g." |
|---|
| 617 | echo " sudo nano /etc/bash.bashrc" |
|---|
| 618 | echo " Insert the 'arb' alias on a separate line." |
|---|
| 619 | fi |
|---|
| 620 | separator |
|---|
| 621 | echo "Please read the files" |
|---|
| 622 | echo " $ARBHOME/arb_INSTALL.txt" |
|---|
| 623 | echo " $ARBHOME/arb_UBUNTU.txt (if you're using ubuntu)" |
|---|
| 624 | echo "about additional libraries and tools needed by ARB." |
|---|
| 625 | separator |
|---|
| 626 | echo "After you have installed everything and performed the changes to your init file," |
|---|
| 627 | echo "open a new terminal window and start arb by typing" |
|---|
| 628 | separator |
|---|
| 629 | if [ $SHELL_ANS = 2 ]; then |
|---|
| 630 | echo " $ARBHOME/bin/arb"; |
|---|
| 631 | else |
|---|
| 632 | echo " arb" |
|---|
| 633 | fi |
|---|
| 634 | separator |
|---|
| 635 | echo "${bold}Have much fun using ARB${normal}" |
|---|
| 636 | echo "ARB Team <arb@arb-home.de>" |
|---|
| 637 | separator |
|---|
| 638 | |
|---|