Changeset 457 for locker


Ignore:
Timestamp:
Oct 13, 2007, 8:59:12 PM (16 years ago)
Author:
andersk
Message:
Things that give me nightmares, volume 457.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • locker/deploy/bin/onathena

    r456 r457  
    33checkfailed() {
    44  if [ -f "$lroot/web_scripts/$addrend/.failed" ]; then
    5     rm -f $lroot/web_scripts/$addrend/.failed
     5    rm -f "$lroot/web_scripts/$addrend/.failed"
    66    exit 1
    77  fi
     
    2626
    2727checksqlpass() {
    28     errors=`sshrun 'sql/bin$scriptsdev/test-password'`
     28    errors=`sshrun "sql/bin$scriptsdev/test-password"`
    2929    if [ "$errors" != "" ]; then
    3030        if [ "$1" -eq 1 ]; then
    31           rm -f $lroot/.sql/my.cnf
     31          rm -f "$lroot/.sql/my.cnf"
    3232        fi
    3333        echo
     
    4848
    4949echo
    50 echo == Welcome to the scripts.mit.edu installer for $sname ==
     50echo "== Welcome to the scripts.mit.edu installer for $sname =="
    5151echo
    5252
     
    5454echo "see <http://scripts.mit.edu/start>."
    5555echo
    56 echo Please report problems with this installer to scripts@mit.edu.
    57 echo
    58 echo Are you performing this install for:
    59 echo 1. Your personal Athena account
    60 echo 2. A locker that you control \(a club, a course, etc\)
    61 echo If you do not understand this question, you should answer \'1\'.
     56echo "Please report problems with this installer to scripts@mit.edu."
     57echo
     58echo "Are you performing this install for:"
     59echo "1. Your personal Athena account"
     60echo "2. A locker that you control (a club, a course, etc)"
     61echo "If you do not understand this question, you should answer '1'."
    6262printf "Please enter either '1' or '2' (without quotes): "
    6363read whofor
    64 if [ "$whofor" -eq 1 ]; then
     64if [ "$whofor" = 1 ]; then
    6565    lname=$USER
    6666    lroot=$HOME
    67 elif [ "$whofor" -eq 2 ]; then
    68     echo
    69     echo OK.  $sname will be installed into a locker of your choice that
    70     echo you control.  Please enter the name of the selected locker below.
     67elif [ "$whofor" = 2 ]; then
     68    echo
     69    echo "OK.  $sname will be installed into a locker of your choice that"
     70    echo "you control.  Please enter the name of the selected locker below."
    7171    echo "(For the locker /mit/lsc -- which has a full path of"
    7272    echo "/afs/athena.mit.edu/activity/l/lsc -- you would simply enter lsc)."
     
    7676else
    7777    echo
    78     echo ERROR:
    79     echo You must select either '1' or '2'.
     78    echo "ERROR:"
     79    echo "You must select either '1' or '2'."
    8080    exit 1
    8181fi
     
    8585
    8686attach scripts 2>/dev/null
    87 . /mit/scripts/bin$scriptsdev/signup-web
    88 
    89 echo
    90 echo Your new copy of $sname will appear on the web at a URL
    91 echo that starts with http://scripts.mit.edu/~$lname/
    92 echo Please decide upon a complete URL and enter it below.
    93 echo You must enter one or more characters after ~$lname/
    94 echo The completed address must only contain a-z, 0-9, and /.
     87. "/mit/scripts/bin$scriptsdev/signup-web"
     88
     89echo
     90echo "Your new copy of $sname will appear on the web at a URL"
     91echo "that starts with http://scripts.mit.edu/~$lname/"
     92echo "Please decide upon a complete URL and enter it below."
     93echo "You must enter one or more characters after ~$lname/"
     94echo "The completed address must only contain a-z, 0-9, and /."
    9595printf "Desired address: http://scripts.mit.edu/~$lname/"
    9696read addrend
    9797
    98 addrend=`perl -e "\\\$temp = \"$addrend\"; \\\$temp .= \"/\" unless \\\$temp =~ /\\\\/$/; \\\$temp =~ /(^([a-z0-9A-Z\\\\/-]+)\$)/; print \\\$1"`
     98addrend=`perl -0e 'print $ARGV[0] =~ /^([\w\/-]*[\w-])\/*$/' -- "$addrend"`
    9999if [ "$addrend" = "" ]; then
    100100        echo
    101         echo ERROR:
    102         echo You must enter one or more characters after ~$lname/
    103         echo The completed address must only contain a-z, 0-9, and /.
     101        echo "ERROR:"
     102        echo "You must enter one or more characters after ~$lname/"
     103        echo "The completed address must only contain a-z, 0-9, and /."
    104104        exit 1
    105105fi
     
    107107if [ -d "$lroot/web_scripts/$addrend" ]; then
    108108    echo
    109     echo ERROR:
    110     echo You already have a directory corresponding to that web address.
    111     echo Please remove that directory, choose a different address, or
    112     echo contact scripts@mit.edu for assistance.
     109    echo "ERROR:"
     110    echo "You already have a directory corresponding to that web address."
     111    echo "Please remove that directory, choose a different address, or"
     112    echo "contact scripts@mit.edu for assistance."
    113113    exit 1
    114114fi
     
    119119
    120120if [ ! -f "$lroot/.my.cnf" ]; then
    121   mkdir $lroot/.sql 2>/dev/null
    122   fs sa $lroot/.sql daemon.scripts write
    123   fs sa $lroot/.sql daemon.sql write
    124   ln -nfs $lroot/.sql/my.cnf $lroot/.my.cnf 2>/dev/null
    125 fi
    126 
    127 fs sa $lroot/.sql system:anyuser none
    128 fs sa $lroot/.sql system:authuser none
     121  mkdir "$lroot/.sql" 2>/dev/null
     122  fs sa "$lroot/.sql" daemon.scripts write
     123  fs sa "$lroot/.sql" daemon.sql write
     124  ln -nfs "$lroot/.sql/my.cnf" "$lroot/.my.cnf" 2>/dev/null
     125fi
     126
     127fs sa "$lroot/.sql" system:anyuser none
     128fs sa "$lroot/.sql" system:authuser none
    129129
    130130if [ "$requires_sql" -eq 1 ]; then
     
    132132  if [ "$sqlinfo" = "" ]; then
    133133      echo
    134       echo You already have a MySQL account but you do not have a .my.cnf file.
    135       echo If you do not remember your MySQL account password, you can change it
    136       echo at http://sql.mit.edu using MIT certificates.
     134      echo "You already have a MySQL account but you do not have a .my.cnf file."
     135      echo "If you do not remember your MySQL account password, you can change it"
     136      echo "at http://sql.mit.edu using MIT certificates."
    137137      printf "Please type your MySQL password and press [enter]: "
    138138      stty -echo
     
    142142      sqlhost="sql.mit.edu"
    143143      sqluser=$lname
    144       . /mit/scripts/sql/bin$scriptsdev/save-password
     144      . "/mit/scripts/sql/bin$scriptsdev/save-password"
    145145      checksqlpass 1 'The MySQL password that you typed appears to be incorrect.\n' ''
    146146      echo
    147       echo OK.  Continuing with the install...
     147      echo "OK.  Continuing with the install..."
    148148  else
    149149      checksqlpass 0 'The MySQL login information in your .my.cnf file\n' 'appears to be incorrect.\n'
     
    161161if [ "$prompt_username" -eq 1 ]; then
    162162    echo
    163     echo You will be able to log in to $sname using a username of your choice.
    164     echo Please decide upon a username and enter it below.
     163    echo "You will be able to log in to $sname using a username of your choice."
     164    echo "Please decide upon a username and enter it below."
    165165    echo "Your username must contain only alphanumeric characters (a-z, 0-9)."
    166166    printf "Desired username: "
    167167    read admin_username
    168     admin_username=`perl -e "\\\$temp = \"$admin_username\"; \\\$temp =~ /(^([a-z0-9A-Z]+)\\\$)/; print \\\$1;"`
     168    admin_username=`perl -0e 'print $ARGV[0] =~ /^([[:alnum:]]+)$/' -- "$admin_username"`
    169169    if [ "$admin_username" = "" ]; then
    170170        echo
    171171        echo ERROR:
    172172        echo "Your username must contain only alphanumeric characters (a-z, 0-9)."
    173         echo You will need to run the installer again and choose a different username.
     173        echo "You will need to run the installer again and choose a different username."
    174174        exit 1
    175175    fi
     
    192192if [ "$prompt_password" -eq 1 ]; then
    193193    stty -echo
    194     sshrun "deploy$scriptsdev/bin/prompt-password '$sname' '$deploy' '$addrend' '$admin_username'"
     194    sshrun "deploy$scriptsdev/bin/prompt-password" "$sname" "$deploy" "$addrend" "$admin_username"
    195195    stty echo
    196196fi
     
    216216if [ "$numfiles" -eq 1 ]; then
    217217    athrun scripts gfind . -mindepth 2 -maxdepth 2 | xargs -i mv \{} .
    218     rmdir $files
     218    rmdir "$files"
    219219fi
    220220if [ -f "/mit/scripts/deploy$scriptsdev/php.ini/$deploy" ]; then
    221         nodot=`echo $lname | sed "/\./s///"`;
    222         sed -e /SCRIPTS_USER/s//$lname/ -e /SCRIPTS_NODOT/s//$nodot/ /mit/scripts/deploy$scriptsdev/php.ini/$deploy > php.ini
     221        nodot=`echo "$lname" | sed "/\./s///"`;
     222        sed -e "/SCRIPTS_USER/ s//$lname/" -e "/SCRIPTS_NODOT/ s//$nodot/" "/mit/scripts/deploy$scriptsdev/php.ini/$deploy" > php.ini
    223223        athrun scripts gfind . -mindepth 1 -type d -exec sh -c 'ln -sf "`echo "$1" | sed '\''s,[^/],,g; s,/,../,g'\''`php.ini" "$1/"' -- {} \;
    224224fi
    225 cd $origdir
    226 
    227 vsshrun "deploy$scriptsdev/bin/$deploy '$sname' '$deploy' '$addrend' '$admin_username' '$requires_sql' '$scriptsdev' '$USER'" || die "Unknown failure during configuration"
    228 rm -f /$lroot/web_scripts/$addrend/.scripts-tmp
     225cd "$origdir"
     226
     227vsshrun "deploy$scriptsdev/bin/$deploy" "$sname" "$deploy" "$addrend" "$admin_username" "$requires_sql" "$scriptsdev" "$USER" || die "Unknown failure during configuration"
     228rm -f "$lroot/web_scripts/$addrend/.scripts-tmp"
    229229checkfailed
    230230
    231231echo
    232 echo == Installation complete! ==
    233 echo You should now be able to access your new copy of $sname at
    234 echo http://scripts.mit.edu/~$lname/$addrend
     232echo "== Installation complete! =="
     233echo "You should now be able to access your new copy of $sname at"
     234echo "http://scripts.mit.edu/~$lname/$addrend/"
    235235echo "(You can replace the http with https if you want to use encryption)"
    236 echo If you have trouble accessing it, feel free to contact
    237 echo the scripts.mit.edu team by e-mailing scripts@mit.edu
     236echo "If you have trouble accessing it, feel free to contact"
     237echo "the scripts.mit.edu team by e-mailing scripts@mit.edu"
    238238exit 0
Note: See TracChangeset for help on using the changeset viewer.