Misc improvements (no functionality changes, yet).

This commit is contained in:
Eli Barzilay 2011-10-11 17:13:10 -04:00
parent 08e70c5e45
commit f882c01e65

View File

@ -4,7 +4,7 @@
PATH=/usr/bin:/bin PATH=/usr/bin:/bin
if [ "x`echo -n`" = "x-n" ]; then if test "x`echo -n`" = "x-n"; then
echon() { /bin/echo "$*\c"; } echon() { /bin/echo "$*\c"; }
else else
echon() { echo -n "$*"; } echon() { echo -n "$*"; }
@ -27,16 +27,16 @@ exithandler() {
trap exithandler 2 3 9 15 trap exithandler 2 3 9 15
lookfor() { lookfor() {
save_IFS="${IFS}" saved_IFS="${IFS}"
IFS=":" IFS=":"
for dir in $PATH; do for dir in $PATH; do
if test -x "$dir/$1"; then if test -x "$dir/$1"; then
eval "$1=$dir/$1" eval "$1=$dir/$1"
IFS="$save_IFS" IFS="$saved_IFS"
return return
fi fi
done done
IFS="$save_IFS" IFS="$saved_IFS"
failwith "could not find \"$1\"." failwith "could not find \"$1\"."
} }
@ -65,7 +65,7 @@ origwd="`pwd`"
echo "This program will extract and install $DISTNAME." echo "This program will extract and install $DISTNAME."
echo "" echo ""
echo "Note: the required diskspace for this installation is about $ORIGSIZE." echo "Note: the required diskspace for this installation is $ORIGSIZE."
############################################################################### ###############################################################################
## What kind of installation? ## What kind of installation?
@ -76,9 +76,9 @@ echo " In this distribution mode files go into different directories according"
echo " to Unix conventions. A \"racket-uninstall\" script will be generated" echo " to Unix conventions. A \"racket-uninstall\" script will be generated"
echo " to be used when you want to remove the installation. If you say 'no'," echo " to be used when you want to remove the installation. If you say 'no',"
echo " the whole Racket directory is kept in a single installation directory" echo " the whole Racket directory is kept in a single installation directory"
echo " (movable and erasable) unit, possibly with convenient external links" echo " (movable and erasable), possibly with external links into it -- this is"
echo " into it -- this is often more convenient, especially if you want to" echo " often more convenient, especially if you want to install multiple"
echo " install multiple versions or keep it in your home directory." echo " versions or keep it in your home directory."
if test ! "x$RELEASED" = "xyes"; then if test ! "x$RELEASED" = "xyes"; then
echo "*** This is a nightly build: such a unix-style distribution is *not*" echo "*** This is a nightly build: such a unix-style distribution is *not*"
echo "*** recommended because it cannot be used to install multiple versions." echo "*** recommended because it cannot be used to install multiple versions."
@ -101,9 +101,8 @@ done
echo "" echo ""
if test "$unixstyle" = "Y"; then if test "$unixstyle" = "Y"; then
echo "Where do you want to base your installation of $DISTNAME?" echo "Where do you want to base your installation of $DISTNAME?"
echo " (Use an existing directory. If you've done such an installation in" echo " (If you've done such an installation in the past, either"
echo " the past, either use the same place, or manually run" echo " enter the same directory, or run 'racket-uninstall' manually.)"
echo " 'racket-uninstall' now.)"
TARGET1="..." TARGET1="..."
else else
echo "Where do you want to install the \"$TARGET\" directory tree?" echo "Where do you want to install the \"$TARGET\" directory tree?"
@ -167,7 +166,7 @@ fi
## Deal with Unix-style path questions ## Deal with Unix-style path questions
set_prefix() { set_prefix() {
where="$1" BASE="$1"
# default dirs -- mimic configure behavior # default dirs -- mimic configure behavior
bindir="$BASE/bin" bindir="$BASE/bin"
collectsdir="$BASE/lib/racket/collects" collectsdir="$BASE/lib/racket/collects"
@ -205,6 +204,7 @@ show_dir_var() {
} }
read_dir() { read_dir() {
echon "New directory: "
read new_dir read new_dir
case "$new_dir" in case "$new_dir" in
"/"* ) echo "$new_dir" ;; "/"* ) echo "$new_dir" ;;
@ -213,7 +213,7 @@ read_dir() {
} }
if test "$unixstyle" = "Y"; then if test "$unixstyle" = "Y"; then
set_prefix "$where" set_prefix "$BASE"
# loop for possible changes # loop for possible changes
done="N" done="N"
while test ! "$done" = "Y"; do while test ! "$done" = "Y"; do
@ -232,19 +232,19 @@ if test "$unixstyle" = "Y"; then
# show_dir_var "[r] Source Tree " "$srcdir" # show_dir_var "[r] Source Tree " "$srcdir"
fi fi
if test "$err" = "Y"; then echo "*** Errors in some paths ***"; fi if test "$err" = "Y"; then echo "*** Errors in some paths ***"; fi
echo "Enter a new prefix, a letter to change an entry, enter to continue" echo "Enter a letter to change an entry, a new prefix, or enter to continue"
echon "> " echon "> "
read change_what read change_what
case "$change_what" in case "$change_what" in
[eE]* ) echon "New directory: "; bindir="`read_dir`" ;; [eE]* ) bindir="`read_dir`" ;;
[sS]* ) echon "New directory: "; collectsdir="`read_dir`" ;; [sS]* ) collectsdir="`read_dir`" ;;
[dD]* ) echon "New directory: "; docdir="`read_dir`" ;; [dD]* ) docdir="`read_dir`" ;;
[lL]* ) echon "New directory: "; libdir="`read_dir`" ;; [lL]* ) libdir="`read_dir`" ;;
[hH]* ) echon "New directory: "; includerktdir="`read_dir`" ;; [hH]* ) includerktdir="`read_dir`" ;;
[oO]* ) echon "New directory: "; librktdir="`read_dir`" ;; [oO]* ) librktdir="`read_dir`" ;;
[mM]* ) echon "New directory: "; mandir="`read_dir`" ;; [mM]* ) mandir="`read_dir`" ;;
# [rR]* ) if test "$PNAME" = "full"; then # [rR]* ) if test "$PNAME" = "full"; then
# echon "New directory: "; srcdir="`read_dir`" # srcdir="`read_dir`"
# else # else
# echo "Invalid response" # echo "Invalid response"
# fi ;; # fi ;;
@ -268,21 +268,21 @@ test "$BINSUM" = "$SUM" || failwith "bad CRC checksum."
echo "ok." echo "ok."
############################################################################### ###############################################################################
## Unpacking into $where/$TARGET ## Unpacking into $BASE/$TARGET
unpack_installation() { unpack_installation() {
# test that no TARGET exists # test that no TARGET exists
if test -d "$BASE/$TARGET" || test -f "$BASE/$TARGET"; then if test -d "$BASE/$TARGET" || test -f "$BASE/$TARGET"; then
echon "\"$BASE/$TARGET\" exists, delete? " echon "\"$BASE/$TARGET\" exists, delete? "
read yesno read R
case "$yesno" in case "$R" in
[yY]*) [yY]* )
echon "Deleting old \"$BASE/$TARGET\"... " echon "Deleting old \"$BASE/$TARGET\"... "
"$rm" -rf "$BASE/$TARGET" \ "$rm" -rf "$BASE/$TARGET" \
|| failwith "could not delete \"$BASE/$TARGET\"." || failwith "could not delete \"$BASE/$TARGET\"."
echo "done." echo "done."
;; ;;
*) failwith "aborting because \"$BASE/$TARGET\" exists." ;; * ) failwith "aborting because \"$BASE/$TARGET\" exists." ;;
esac esac
fi fi
# unpack # unpack
@ -307,14 +307,14 @@ wholedir_install() {
unpack_installation unpack_installation
rm_on_abort="" rm_on_abort=""
cd "$where" cd "$BASE"
if test -d "bin"; then if test -d "bin"; then
echo "Do you want to install new system links within the bin, lib, include," echo "Do you want to install new system links within the bin, lib, include,"
echo " man, and doc subdirectories of \"$where\", possibly overriding" echo " man, and doc subdirectories of \"$BASE\", possibly overriding"
echon " existing links? " echon " existing links? "
read yesno read R
case "$yesno" in case "$R" in
[yY]* ) sysdir="$where" ;; [yY]* ) sysdir="$BASE" ;;
* ) sysdir="" ;; * ) sysdir="" ;;
esac esac
else else
@ -429,7 +429,7 @@ if test ! "x$sysdir" = "x"; then
else else
cd "$docdir" cd "$docdir"
echo "Installing \"$sysdir/$docdir/$TARGET\"." echo "Installing \"$sysdir/$docdir/$TARGET\"."
link "$BASE/$TARGET/notes" "$TARGET" "$sysdir/$docdir" link "$BASE/$TARGET/doc" "$TARGET" "$sysdir/$docdir"
fi fi
fi fi
@ -466,7 +466,7 @@ fi
unpack_installation unpack_installation
cd "$where" cd "$BASE"
"$TARGET/bin/racket" "$TARGET/collects/setup/unixstyle-install.rkt" \ "$TARGET/bin/racket" "$TARGET/collects/setup/unixstyle-install.rkt" \
"move" "$BASE/$TARGET" "$bindir" "$collectsdir" "$docdir" "$libdir" \ "move" "$BASE/$TARGET" "$bindir" "$collectsdir" "$docdir" "$libdir" \
"$includerktdir" "$librktdir" "$mandir" \ "$includerktdir" "$librktdir" "$mandir" \