Revision 2880bac8

View differences:

tools/compiler/GCC/gccsetup.sh
428 428
#                 No error or warnign occurred.
429 429
#             1
430 430
#                 Warning: Installation aborted by user.
431
#            -1
432
#                 Error: specified URL can not be reached.
431 433
#
432 434
function installNewVersion {
433 435
  local installbasedir=${HOME}/gcc-arm-embedded
......
464 466
      printWarning "installation aborted by user\n"
465 467
      return 1
466 468
    fi
467
    if [[ $armgcc_downloadurl != *".tar.bz2" ]]; then
468
      printWarning "please specify a .tar.bz2 file\n"
469
      armgcc_downloadurl=""
470
    fi
471
    if [ ! wget --spider $armgcc_downloadurl 2>/dev/null ]; then
472
      printWarning "$armgcc_downloadurl can not be reached\n"
473
      armgcc_downloadurl=""
469
    # check whether url is valid
470
    wget --spider -r "$armgcc_downloadurl" &>/dev/null
471
    if [ $? -ne 0 ]; then
472
      printError "'$armgcc_downloadurl' can not be reached\n"
473
      return -1
474 474
    fi
475 475
  done
476 476
  printLog "user selected $armgcc_downloadurl\n"
477 477

  
478 478
  # if the file already exists, ask the user if it should be downloaded again
479
  local armgcc_tarball=$(basename "$armgcc_downloadurl")
480
  if [ -e "$armgcc_tarball" ]; then
479
  local armgcc_tarball=$(basename $(wget --spider -r "$armgcc_downloadurl" 2>&1 | \
480
                                    grep "^--" | \
481
                                    tail -n 1 | \
482
                                    awk '{print $NF}'))
483
  if [ -f "$armgcc_tarball" ]; then
481 484
    printWarning "$armgcc_tarball already exists. Delete and redownload? [y/n]\n"
482 485
    local userinput=""
483 486
    readUserInput "YyNn" userinput
484 487
    case "$userinput" in
485 488
      Y|y)
486 489
        rm "$armgcc_tarball"
487
        wget "$armgcc_downloadurl" | tee -a $LOG_FILE
490
        wget "$armgcc_downloadurl" -O "$armgcc_tarball" | tee -a $LOG_FILE
488 491
        ;;
489 492
      N|n)
490 493
        ;;
......
492 495
        printError "unexpected argument: $userinput\n";;
493 496
    esac
494 497
  else
495
    wget "$armgcc_downloadurl" | tee -a $LOG_FILE
498
    wget "$armgcc_downloadurl" -O "$armgcc_tarball" | tee -a $LOG_FILE
496 499
  fi
497 500

  
498 501
  # extract tarball

Also available in: Unified diff