Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Changeset 2313

Show
Ignore:
Timestamp:
06/16/07 08:33:27 (1 year ago)
Author:
larsivi
Message:

More absolute path safety, related to t#490. Also added some help text.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/install/dmd-posix/installer.sh

    r2230 r2313  
    1515} 
    1616 
     17usage() { 
     18    echo 'Usage: <installer-name>.sh [--prefix <install prefix>] 
     19Options: 
     20  --prefix:  Install prefix is optional on the command line, if not set it 
     21             will be requested during install. The set prefix needs to be 
     22             an absolute path.' 
     23    exit 0 
     24} 
     25 
     26 
    1727# Figure out our complete name 
    1828ORIGDIR=`pwd` 
     
    2030FULLNAME="`pwd`/`basename $0`" 
    2131cd $ORIGDIR 
     32 
     33# parse arguments 
     34while [ "$#" != "0" ] 
     35do 
     36    if [ "$1" = "--prefix" ] 
     37    then 
     38        shift 
     39 
     40        PREFIX="$1" 
     41    else 
     42        usage 
     43    fi 
     44    shift 
     45done 
    2246 
    2347# Create our temporary directory 
     
    3357if [ "$INST_DMD" = "1" ] 
    3458then 
    35     if [ ! "$1" ] 
     59    if [ ! "$PREFIX" ] 
    3660    then 
    37         echo -n "What prefix do you want to install DMD to? " 
     61        echo -n "What prefix do you want to install DMD to (absolute path)? " 
    3862        read DMDDIR 
    3963    else 
    40         DMDDIR="$1
     64        DMDDIR="$PREFIX
    4165    fi 
     66 
     67    if [ "${DMDDIR:0:1}" != "/" ] 
     68    then 
     69        die 1 "The PREFIX needs to be an absolute path" 
     70    fi 
    4271 
    4372    export PATH="$DMDDIR/bin:$PATH" 
     
    76105fi 
    77106 
     107if [ "${DMDDIR:0:1}" != "/" ] 
     108then 
     109    die 1 "The PREFIX needs to be an absolute path" 
     110fi 
     111 
     112 
    78113# Then, cd to our tmpdir and extract core.tar.gz 
    79114cd $TTMP || die 1 "Failed to cd to temporary directory"