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

Changeset 2220

Show
Ignore:
Timestamp:
05/15/07 12:24:49 (2 years ago)
Author:
larsivi
Message:

fixed uninstaller

Files:

Legend:

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

    r2050 r2220  
    11#!/bin/bash 
    22 
    3 # A simple script to uninstall Tango for GDC 
     3# A simple script to uninstall Tango for DMD 
    44# Copyright (C) 2007  Gregor Richards 
    55# Permission is granted to do anything you please with this software. 
    66# This software is provided with no warranty, express or implied, within the 
    77# bounds of applicable law. 
     8# 
     9# Modifications by Alexander Panek, Lars Ivar Igesund 
    810 
    911die() { 
     
    1315 
    1416usage() { 
    15     echo 'Usage: uninstall.sh [--prefix <install prefix>]' 
     17    echo 'Usage: tango-dmd-tools.sh <command>' 
     18    echo '    --uninstall <install prefix> - uninstalls previous Tango install' 
    1619    exit 0 
    1720} 
    1821 
    19 cd "`dirname $0`" 
    20 dmd --help >& /dev/null || die "gdc not found on your \$PATH!" 1 
    21  
    22 # 0) Parse arguments 
    23 PHOBOS_DIR="`whereis libphobos.a | sed -e 's/libphobos:[ ]*\([^ ]*\)[ ]*.*/\1/' -`" 
    24 PHOBOS_DIR="`dirname $PHOBOS_DIR`" 
    25 PREFIX="$PHOBOS_DIR/.." 
    26 DMD_VER="`gdc --version | head -n 1 | cut -d ' ' -f 3`" 
    27  
    28 while [ "$#" != "0" ] 
    29 do 
    30     if [ "$1" = "--prefix" ] 
     22if [ "$#" = "0" ] 
     23then 
     24    usage 
     25else 
     26    if [ "$1" = "--uninstall" ] 
    3127    then 
    32         PREFIX="$1" 
     28        if [ "$2" ] 
     29        then 
     30            PREFIX="$2" 
     31        else 
     32            usage 
     33        fi 
    3334    else 
    3435        usage 
    3536    fi 
    36     shift 
    37 done 
     37fi 
    3838 
    39 if [ ! -e "$PHOBOS_DIR/libphobos.a.phobos" ] 
     39cd "`dirname $0`" 
     40dmd --help >& /dev/null || die "dmd not found on your \$PATH!" 1 
     41 
     42# revert to phobos if earlier evidence of existense is found 
     43if [ -e "$PREFIX/lib/libphobos.a.phobos" ] 
    4044then 
    41     die "tango does not appear to be installed!" 3 
     45    mv     $PREFIX/lib/libphobos.a.phobos $PREFIX/lib/libphobos.a 
    4246fi 
    43 rm -rf $PHOBOS_DIR/libgphobos.a $PHOBOS_DIR/libtango.a $PREFIX/import/$DMD_VER/object.d 
    44 mv $PREFIX/import/$DMD_VER/object.d.phobos $PREFIX/import/$DMD_VER/object.d 
    45 mv $PHOBOS_DIR/libphobos.a.phobos $PHOBOS_DIR/libphobos.a 
    46 echo "Done!" 
     47if [ -e "$PREFIX/import/object.d.phobos" ] 
     48then 
     49    mv     $PREFIX/import/object.d.phobos $PREFIX/import/object.d 
     50fi 
     51if [ -e "$PREFIX/bin/dmd.conf.phobos" ] 
     52then 
     53    mv   $PREFIX/bin/dmd.conf $PFEFIX/bin/dmd.conf.tango 
     54    mv   $PREFIX/bin/dmd.conf.phobos $PREFIX/bin/dmd.conf 
     55fi 
     56# Tango 0.97 installed to this dir 
     57if [ -e "$PREFIX/import/v1.012" ] 
     58then 
     59    rm -rf $PREFIX/import/v1.012 
     60fi 
     61# Since Tango 0.98 
     62if [ -e "$PREFIX/import/tango/object.di" ] 
     63then 
     64    rm -rf $PREFIX/import/tango/tango 
     65    rm -rf $PREFIX/import/tango/std 
     66    rm -f  $PREFIX/import/tango/object.di 
     67fi 
     68if [ -e "$PREFIX/lib/libtango.a" ] 
     69then 
     70    rm -f $PREFIX/lib/libtango.a 
     71fi 
     72die "Done!" 0 
     73