• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1function die() {
2    echo "Error: $*"
3    exit 1
4}
5
6HOST=`uname`
7
8if [ "${HOST:0:6}" == "CYGWIN" ]; then
9    PLATFORM="windows-x86"
10
11    # We can't use symlinks under Cygwin
12    function cpfile { # $1=dest $2=source
13        cp -fv $2 $1/
14    }
15
16    function cpdir() { # $1=dest $2=source
17        rsync -avW --delete-after $2 $1
18    }
19else
20    if [ "$HOST" == "Linux" ]; then
21        PLATFORM="linux-x86"
22    elif [ "$HOST" == "Darwin" ]; then
23        PLATFORM="darwin-x86"
24    else
25        echo "Unsupported platform ($HOST). Nothing done."
26    fi
27
28    # For all other systems which support symlinks
29
30    # computes the "reverse" path, e.g. "a/b/c" => "../../.."
31    function back() {
32        echo $1 | sed 's@[^/]*@..@g'
33    }
34
35    function cpfile { # $1=dest $2=source
36        ln -svf `back $1`/$2 $1/
37    }
38
39    function cpdir() { # $1=dest $2=source
40        ln -svf `back $1`/$2 $1
41    }
42fi
43