Commits

Peter Szilagyi committed 15afe9e

Tweaked the install script a bit.

  • Participants
  • Parent commits f0202bb

Comments (0)

Files changed (1)

 #!/bin/bash
 
+# Install jane-elisp at Jane Street.
+
 # The word from Kilburg and cwills re. how to install in all offices
-# with Sink: maintainer responsible to find arbitrary machines in
+# with Sink: the app maintainer is responsible to find machines in
 # those offices and sink-install to the office filesystems via those
-# machines.  The offices are four: nyc, ldn, hkg, and tot.
+# machines.
 offices="hkg ldn nyc tot"
 host_hkg=hkg-qws-r02
 host_ldn=ldn-qws-r02
-host_nyc=nyc-qws-147            # nyc-qws-r04 still off after Sandy
+host_nyc=nyc-qws-147
 host_tot=tot-qws-r02
 
 modes="prod test"
 target_prod=/j/office/app/emacs/prod
 target_test=/j/office/app/emacs/dev
 
-# (The CentOS 5 bash doesn't have associative arrays yet, hence going
-# old school for host_* and target_*.)
+# (The CentOS 5 bash doesn't have associative arrays yet, so we're
+# going old school for host_* and target_*.)
 
 set -e -u -o pipefail
-ulimit -c unlimited # allow arbitrarily large core files
+ulimit -c unlimited             # allow arbitrarily large core files
 
 PATH=$PATH:/j/office/app/sink/prod/bin # sink
 
-args=$*                         # before consuming below
+args=$(for a in "$@"; do echo argument "$a"; done) # before consuming below
 
 mode=test
 message=
 # CR pszilagyi: Implement a general-purpose sink-args hook so I can
 # check "sink history list" very easily.
-while test $# -gt 0; do
+on_hosts=
+while [ $# -gt 0 ]; do
     arg=$1
     shift
     case $arg in
-        -prod)
-            mode=prod
-            ;;
-        -test)
-            mode=test
-            ;;
-        -message)
-            message=$1
-            shift
-            ;;
-        -offices)
-            offices=$1
-            shift
-            ;;
+        -prod|-p) mode=prod ;;
+        -test|-t) mode=test ;;
+        -message|-m) message=$1; shift ;;
+        -offices|-office|-o) offices=$1; shift ;;
+        -on-hosts) on_hosts=$1; shift ;; # handy for manually removing old versions
         *)
             echo "Unknown argument: $arg" >&2
             echo "Usage: $0 [-prod] -message M [-offices '[hkg] [ldn] [nyc] [tot]']" >&2
 fi
 
 if [ $mode = "prod" ]; then
-    test -t 1 -a -t 0
+    [ -t 1 -a -t 0 ]
     echo "You are about to install a new PRODUCTION version of omake-emacs."
-    echo -n "Press ENTER to proceed, Ctrl-C to abort. "
+    echo -n "Press ENTER to proceed, Ctrl-C to abort: "
     read
 fi
 
 dot=$(dirname "$0")             # for script-relative filenames
 
-# Log the cwd and command and some version information.
-#
-# This has to be pretty narrow to look good in "sink history list".
-#
-# CR pszilagyi: Dump this in a file and have a short message.
-message+="
-$(pwd):
-  $0 $args
-$(cd "$dot/".. && echo "$(pwd):
-  $(hg paths default)
-    $(hg id -i)")
-$(cd "$dot/"../.. && echo "$(pwd):
-  $(hg paths default)
-    $(hg id -i)")"
-
 eval target=\$target_$mode
 
 # Delete a few of the biggest wastes of space before sink'ing.
 
 set -x
 
-# This should be run from a functioning, built checkout, where the
-# developer has already run the following.
+(cd "$dot/".. && jomake -j 8 .DEFAULT runtest)
+[ -r "$dot/"../doc/jane-emacs.info ]
+[ -r "$dot/"../doc/omake-mode.info ]
+[ -r "$dot/"../elisp/contrib/tex-site.el ]
+[ .elcs= = .elcs="$(find "$dot/".. -name '*.elc')" ]
+[ -x "$dot/"../ocaml/omake/exe/omake_server.exe ]
+[ -x "$dot/"ocp-indent ]
 
-#(cd "$dot/".. && omake)
-test -r "$dot/"../doc/jane-emacs.info
-test -r "$dot/"../doc/omake-mode.info
-test -r "$dot/"../elisp/contrib/tex-site.el
-test .elcs= = .elcs="$(find "$dot/".. -name '*.elc')"
-test -x "$dot/"../ocaml/omake/exe/omake_server.exe
-test -x "$dot/"ocp-indent
+# Log the cwd and command and some version information.
+(
+    pwd
+    : command "$0" "$args"
+    for repo in .. ../..
+    do (cd "$dot/$repo" && pwd && hg paths default && hg id -i)
+    done
+) > "$dot/"../INSTALL-CONTEXT 2>&1
 
 for office in $offices
 do
     eval host=\$host_$office
+
+    if [ -n "$on_hosts" ]
+    then
+        ssh "$host" "$on_hosts" || exit
+        continue
+    fi
+
     sink deploy dir "$dot/"../ "$host:$target/jane-elisp" -message "$message"
 
     # Make all the installed files read-only so I don't accidentally
     # The trailing slash follows the sink-managed symlink.
     #
     # Will making the managed copy read-only confuse "sink"?
+    # Yes, it does, when it tries to remove old versions.
 done