Ticket #9528: install.diff

File install.diff, 1.7 KB (added by mpatel, 11 years ago)

Diff of spkg/install vs "4.5".

  • install

    old new  
    11#!/usr/bin/env bash
    22
     3####################################################################################
     4# Check if pipestatus already exists, otherwise
     5# create it to allow upgrade from Sage <4.5.  This is a temporary fix.
     6# See trac 9528: http://trac.sagemath.org/sage_trac/ticket/9528
     7# Go about 30 lines down from here for the actual "install" script.
     8####################################################################################
     9if [ ! -f pipestatus ]; then
     10  echo "Creating pipestatus."
     11  cat > pipestatus <<EOF
     12#!/usr/bin/env bash
     13
     14if [ -z "\$1" ]; then
     15    echo "Run two commands in a pipeline 'CMD1 | CMD2' and exit"
     16    echo "with the exit status of CMD1, *not* that of CMD2."
     17    echo "\$0 cmd1 cmd2"
     18    exit
     19fi
     20
     21# This is useful, for example, in a makefile, where we tee the output
     22# of a build command to a log file.  Because \$? is the exit status of
     23# the last command in a pipeline, make won't stop if tee succeeds but
     24# a preceding command in the pipeline fails.
     25
     26VER=\${BASH_VERSINFO[0]}
     27
     28if [ \$VER -gt 2 ]; then
     29    # Use bash 3.0's pipefail option.
     30    (set -o pipefail; eval "\$1 | \$2")
     31    exit \$?
     32else
     33    # Use redirection.  Adapted from the comp.unix.shell FAQ.  See
     34    # http://www.unix.com/shell-programming-scripting/92163-command-does-not-return-exit-status-due-tee.html
     35    exec 3>&1
     36    eval \`
     37    exec 4>&1 >&3 3>&-
     38    {
     39        eval "\$1" 4>&-; echo "ES1=\$?;" >&4
     40    } | eval "\$2"
     41    echo "ES2=\$?;" >&4
     42    \`
     43    exit \$ES1
     44fi
     45EOF
     46  chmod +x pipestatus
     47fi
     48
     49######################################################################
     50
     51
    352CUR=`pwd`
    453cd ..
    554SAGE_ROOT=`pwd`