Ignore:
Timestamp:
Oct 13, 2007, 9:38:53 PM (17 years ago)
Author:
andersk
Message:
Things that give me nightmares, volume 459.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • locker/bin/scripts-remove

    r438 r459  
    22
    33if [ "$scriptsdev" != "" -a "$scriptsdev" != "dev" ]; then
    4     echo ERROR:
    5     echo The \$scriptsdev variable is set to an invalid value.
    6     echo \(The variable should not be set.\)
    7     echo Please contact scripts@mit.edu.
     4    echo "ERROR:"
     5    echo "The \$scriptsdev variable is set to an invalid value."
     6    echo "(The variable should not be set.)"
     7    echo "Please contact scripts@mit.edu."
    88fi
    99
     
    1919        fi
    2020        echo
    21         echo ERROR:
     21        echo "ERROR:"
    2222        printf "$2"
    23         printf "$3"
    2423        exit 1
    2524    fi
     
    2726attach scripts sql 2>/dev/null
    2827
    29 echo Welcome to the scripts.mit.edu uninstaller. This program will
    30 echo help you cleanly remove software that you have auto-installed.
     28echo "Welcome to the scripts.mit.edu uninstaller. This program will"
     29echo "help you cleanly remove software that you have auto-installed."
    3130echo
    32 echo Are you removing an installation from:
    33 echo 1. Your personal Athena account
    34 echo 2. A locker that you control \(a club, a course, etc.\)
    35 echo If you do not understand this question, you should answer 1.
     31echo "Are you removing an installation from:"
     32echo "1. Your personal Athena account"
     33echo "2. A locker that you control (a club, a course, etc.)"
     34echo "If you do not understand this question, you should answer 1."
    3635printf "Please enter either 1 or 2: "
    3736read whofor
    38 if [ "$whofor" -eq 1 ]; then
     37if [ "$whofor" = 1 ]; then
    3938    lname=$USER
    4039    lroot=$HOME
    41 elif [ "$whofor" -eq 2 ]; then
     40elif [ "$whofor" = 2 ]; then
    4241    echo
    43     echo Please enter the name of the selected locker below.
     42    echo "Please enter the name of the selected locker below."
    4443    echo "(For the locker /mit/sipb, you would enter sipb.)"
    4544    read lname
     
    4746else
    4847    echo
    49     echo ERROR:
    50     echo You must select either 1 or 2.
     48    echo "ERROR:"
     49    echo "You must select either 1 or 2."
    5150    exit 1
    5251fi
     
    5453
    5554echo
    56 echo When you installed the software, you chose a URL
    57 echo that starts with http://scripts.mit.edu/~"$lname"/.
    58 echo Please enter the full URL where this software was
    59 echo installed. \(This should correspond to a directory
    60 echo in /mit/"$lname"/web_scripts/.\)
    61 printf "URL: http://scripts.mit.edu/~$lname/"
     55echo "When you installed the software, you chose a URL"
     56echo "that starts with http://scripts.mit.edu/~$lname/."
     57echo "Please enter the full URL where this software was"
     58echo "installed.  (This should correspond to a directory"
     59echo "in /mit/$lname/web_scripts/.)"
     60printf "%s" "URL: http://scripts.mit.edu/~$lname/"
    6261read addrend
    6362
    64 addrend=`echo "$addrend" | sed -n 's/^\([a-z0-9A-Z\/-]*[a-z0-9A-Z-]\)\/\?$/\1/ p'`
     63addrend=`perl -0e 'print $ARGV[0] =~ /^([\w\/-]*[\w-])\/*$/' -- "$addrend"`
    6564if [ "$addrend" = "" ]; then
    6665    echo
    67     echo ERROR:
    68     echo You must enter one or more characters after "~$lname/"
    69     echo The completed address must only contain a-z, 0-9, and /.
     66    echo "ERROR:"
     67    echo "You must enter one or more characters after ~$lname/"
     68    echo "The completed address must only contain a-z, 0-9, and /."
    7069    exit 1
    7170fi
     
    7372if [ ! -d "$lroot/web_scripts/$addrend" ]; then
    7473    echo
    75     echo ERROR:
    76     echo The directory "$lroot/web_scripts/$addrend"
    77     echo does not exist. Please make sure that this is the
    78     echo correct installation directory, and try again, or
    79     echo contact scripts@mit.edu for assistance.
     74    echo "ERROR:"
     75    echo "The directory $lroot/web_scripts/$addrend"
     76    echo "does not exist. Please make sure that this is the"
     77    echo "correct installation directory, and try again, or"
     78    echo "contact scripts@mit.edu for assistance."
    8079    exit 1
    8180fi
     
    8685if [ "$sqlinfo" = "" ]; then
    8786    echo
    88     echo You have a MySQL account but you do not have a .my.cnf file.
    89     echo If you do not remember your MySQL account password, you can change it
    90     echo at http://sql.mit.edu using MIT certificates.
     87    echo "You have a MySQL account but you do not have a .my.cnf file."
     88    echo "If you do not remember your MySQL account password, you can change it"
     89    echo "at http://sql.mit.edu using MIT certificates."
    9190    printf "Please type your MySQL password and press [enter]: "
    9291    stty -echo
     
    9796    sqluser=$lname
    9897    . "/mit/scripts/sql/bin$scriptsdev/save-password"
    99     checksqlpass 1 'The MySQL password that you typed appears to be incorrect.\n' ''
     98    checksqlpass 1 'The MySQL password that you typed appears to be incorrect.\n'
    10099    echo
    101     echo OK.  Continuing with the uninstaller...
     100    echo "OK.  Continuing with the uninstaller..."
    102101else
    103     checksqlpass 0 'The MySQL login information in your .my.cnf file\n' 'appears to be incorrect.\n'
     102    checksqlpass 0 'The MySQL login information in your .my.cnf file\nappears to be incorrect.\n'
    104103fi
    105104
     
    107106if [ "$sqldb" != "${addrend}1" -a "$sqldb" != "$addrend" ]; then
    108107    echo
    109     echo ERROR:
    110     echo The auto-uninstaller was unable to find the appropriate
    111     echo database to drop. Please examine the installation to
    112     echo find the database it uses, drop the database from
    113     echo http://sql.mit.edu/, and manually remove the "$addrend"
    114     echo directory \(or re-run the auto-installer\). Contact
    115     echo scripts@mit.edu if you need assistance.
     108    echo "ERROR:"
     109    echo "The auto-uninstaller was unable to find the appropriate"
     110    echo "database to drop. Please examine the installation to"
     111    echo "find the database it uses, drop the database from"
     112    echo "http://sql.mit.edu/, and manually remove the $addrend"
     113    echo "directory (or re-run the auto-installer). Contact"
     114    echo "scripts@mit.edu if you need assistance."
    116115    exit 1
    117116fi
    118117
    119 echo Removing files. Please wait...
    120 echo \(This may take several seconds for large software.\)
     118echo "Removing files. Please wait..."
     119echo "(This may take several seconds for large software.)"
    121120if rm -rf "$lroot/web_scripts/$addrend"; then
    122     echo The directory "$lroot/web_scripts/$addrend"
    123     echo was successfully removed.
     121    echo "The directory $lroot/web_scripts/$addrend"
     122    echo "was successfully removed."
    124123    if [ -d "$lroot/OldFiles/web_scripts/$addrend" ]; then
    125         echo A one-day-old backup of the installation is
    126         echo available from "$lroot/OldFiles/web_scripts/$addrend".
     124        echo "A one-day-old backup of the installation is"
     125        echo "available from $lroot/OldFiles/web_scripts/$addrend".
    127126    fi
    128127else
    129     echo ERROR:
    130     echo The directory "$lroot/web_scripts/$addrend"
    131     echo could not be removed. Please ensure that you have
    132     echo access to this directory and try again, or
    133     echo contact scripts@mit.edu for assistance.
     128    echo "ERROR:"
     129    echo "The directory $lroot/web_scripts/$addrend"
     130    echo "could not be removed. Please ensure that you have"
     131    echo "access to this directory and try again, or"
     132    echo "contact scripts@mit.edu for assistance."
    134133    exit 1
    135134fi
     
    138137if [ "$sqldb" = "${addrend}1" ]; then
    139138    sqldb="$lname+$addrend"
    140     dropped=`sshrun sql/bin$scriptsdev/drop-database "$sqldb"`
     139    dropped=`sshrun "sql/bin$scriptsdev/drop-database" "$sqldb"`
    141140    if [ "$dropped" ]; then
    142         echo The database "$sqldb"
    143         echo was successfully removed.
     141        echo "The database $sqldb"
     142        echo "was successfully removed."
    144143        attach sql 2>/dev/null
    145144        if [ -f "/mit/sql/backup/$lname/$sqldb.sql.gz" ]; then
    146             echo A one-day-old backup of your SQL database is
    147             echo available in /mit/sql/backup/"$lname".
     145            echo "A one-day-old backup of your SQL database is"
     146            echo "available in /mit/sql/backup/$lname".
    148147        fi
    149148        exit
    150149    else
    151         echo ERROR:
    152         echo The database "$lname+$addrend"
    153         echo could not be automatically removed. You can
    154         echo try removing it from http://sql.mit.edu/,
    155         echo or you can contact sql@mit.edu for assistance.
     150        echo "ERROR:"
     151        echo "The database $lname+$addrend"
     152        echo "could not be automatically removed. You can"
     153        echo "try removing it from http://sql.mit.edu/,"
     154        echo "or you can contact sql@mit.edu for assistance."
    156155        exit 1
    157156    fi
    158157fi
    159158echo
    160 echo The installation in "scripts.mit.edu/~$lname/$addrend"
    161 echo has been successfully uninstalled.
     159echo "The installation in http://scripts.mit.edu/~$lname/$addrend"
     160echo "has been successfully uninstalled."
Note: See TracChangeset for help on using the changeset viewer.