Deal with a "~/" prefix.
A few additional improvements to the script. original commit: 49949a8421dc65007d600f9f8acb3969453920f8
This commit is contained in:
parent
0a29fb5483
commit
ab24f83a2d
|
@ -61,7 +61,7 @@ lookfor dirname
|
||||||
_POSIX2_VERSION=199209
|
_POSIX2_VERSION=199209
|
||||||
export _POSIX2_VERSION
|
export _POSIX2_VERSION
|
||||||
|
|
||||||
origpwd="`pwd`"
|
origwd="`pwd`"
|
||||||
|
|
||||||
echo "This program will extract and install $DISTNAME."
|
echo "This program will extract and install $DISTNAME."
|
||||||
echo ""
|
echo ""
|
||||||
|
@ -88,9 +88,9 @@ while test "$unixstyle" = "x"; do
|
||||||
echon "Enter yes/no (default: no) > "
|
echon "Enter yes/no (default: no) > "
|
||||||
read unixstyle
|
read unixstyle
|
||||||
case "$unixstyle" in
|
case "$unixstyle" in
|
||||||
[yY]* ) unixstyle="yes" ;;
|
[yY]* ) unixstyle="Y" ;;
|
||||||
[nN]* ) unixstyle="no" ;;
|
[nN]* ) unixstyle="N" ;;
|
||||||
"" ) unixstyle="no" ;;
|
"" ) unixstyle="N" ;;
|
||||||
* ) unixstyle="x" ;;
|
* ) unixstyle="x" ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
@ -99,7 +99,7 @@ done
|
||||||
## Where do you want it?
|
## Where do you want it?
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
if test "$unixstyle" = "yes"; 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 " (Use an existing directory. If you've done such an installation in"
|
||||||
echo " the past, either use the same place, or manually run"
|
echo " the past, either use the same place, or manually run"
|
||||||
|
@ -111,9 +111,9 @@ else
|
||||||
fi
|
fi
|
||||||
echo " 1 - /usr/$TARGET1 [default]"
|
echo " 1 - /usr/$TARGET1 [default]"
|
||||||
echo " 2 - /usr/local/$TARGET1"
|
echo " 2 - /usr/local/$TARGET1"
|
||||||
echo " 3 - \$HOME/$TARGET1 ($HOME/$TARGET1)"
|
echo " 3 - ~/$TARGET1 ($HOME/$TARGET1)"
|
||||||
echo " 4 - ./$TARGET1 (here)"
|
echo " 4 - ./$TARGET1 (here)"
|
||||||
if test "$unixstyle" = "yes"; then
|
if test "$unixstyle" = "Y"; then
|
||||||
echo " Or enter a different directory prefix to install in."
|
echo " Or enter a different directory prefix to install in."
|
||||||
else
|
else
|
||||||
echo " Or enter a different \"racket\" directory to install in."
|
echo " Or enter a different \"racket\" directory to install in."
|
||||||
|
@ -121,27 +121,26 @@ fi
|
||||||
echon "> "
|
echon "> "
|
||||||
read where
|
read where
|
||||||
case "$where" in
|
case "$where" in
|
||||||
"" | "1" ) where="/usr" ;;
|
"~/"* ) where="$HOME/${where#\~/}" ;;
|
||||||
"2" ) where="/usr/local" ;;
|
"~"* ) failwith "cannot use '~user' paths" ;;
|
||||||
"3" ) where="$HOME" ;;
|
esac
|
||||||
"4" | "." ) where="`pwd`" ;;
|
case "$unixstyle$where" in
|
||||||
"/"* )
|
? | ?1 ) where="/usr" ;;
|
||||||
if test "$unixstyle" = "no"; then
|
?2 ) where="/usr/local" ;;
|
||||||
TARGET="`\"$basename\" \"$where\"`"
|
?3 ) where="$HOME" ;;
|
||||||
|
?4 | ?. ) where="`pwd`" ;;
|
||||||
|
N/* ) TARGET="`\"$basename\" \"$where\"`"
|
||||||
|
where="`\"$dirname\" \"$where\"`" ;;
|
||||||
|
Y/* ) ;;
|
||||||
|
N* ) TARGET="`\"$basename\" \"$where\"`"
|
||||||
where="`\"$dirname\" \"$where\"`"
|
where="`\"$dirname\" \"$where\"`"
|
||||||
fi
|
if test -d "$where"; then cd "$where"; where="`pwd`"; cd "$origwd"
|
||||||
;;
|
else where="`pwd`/$where"; fi ;;
|
||||||
* )
|
Y* ) if test -d "$where"; then cd "$where"; where="`pwd`"; cd "$origwd"
|
||||||
if test "$unixstyle" = "no"; then
|
else where="`pwd`/$where"; fi ;;
|
||||||
TARGET="`\"$basename\" \"$where\"`"
|
|
||||||
where="`\"$dirname\" \"$where\"`"
|
|
||||||
fi
|
|
||||||
if test -d "$where"; then cd "$where"; where="`pwd`"; cd "$origpwd"
|
|
||||||
else where="`pwd`/$where"; fi
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if test "$unixstyle" = "no"; then
|
if test "$unixstyle" = "N"; then
|
||||||
# can happen when choosing the root
|
# can happen when choosing the root
|
||||||
if test "$TARGET" = "/"; then
|
if test "$TARGET" = "/"; then
|
||||||
failwith "refusing to remove your root"
|
failwith "refusing to remove your root"
|
||||||
|
@ -195,11 +194,11 @@ dir_createable() {
|
||||||
}
|
}
|
||||||
|
|
||||||
show_dir_var() {
|
show_dir_var() {
|
||||||
if test -f "$2"; then dir_status="(error: not a directory!)"; err="yes"
|
if test -f "$2"; then dir_status="(error: not a directory!)"; err="Y"
|
||||||
elif test ! -d "$2"; then
|
elif test ! -d "$2"; then
|
||||||
if dir_createable "$2"; then dir_status="(will be created)"
|
if dir_createable "$2"; then dir_status="(will be created)"
|
||||||
else dir_status="(error: not writable!)"; err="yes"; fi
|
else dir_status="(error: not writable!)"; err="Y"; fi
|
||||||
elif test ! -w "$2"; then dir_status="(error: not writable!)"; err="yes"
|
elif test ! -w "$2"; then dir_status="(error: not writable!)"; err="Y"
|
||||||
else dir_status="(exists)"
|
else dir_status="(exists)"
|
||||||
fi
|
fi
|
||||||
echo " $1 $2 $dir_status"
|
echo " $1 $2 $dir_status"
|
||||||
|
@ -213,14 +212,14 @@ read_dir() {
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
if test "$unixstyle" = "yes"; then
|
if test "$unixstyle" = "Y"; then
|
||||||
set_prefix "$where"
|
set_prefix "$where"
|
||||||
# loop for possible changes
|
# loop for possible changes
|
||||||
done="no"
|
done="N"
|
||||||
while test ! "$done" = "yes"; do
|
while test ! "$done" = "Y"; do
|
||||||
echo ""
|
echo ""
|
||||||
echo "Target Directories:"
|
echo "Target Directories:"
|
||||||
err="no"
|
err="N"
|
||||||
show_dir_var "[e] Executables " "$bindir"
|
show_dir_var "[e] Executables " "$bindir"
|
||||||
show_dir_var "[s] Scheme Code " "$collectsdir"
|
show_dir_var "[s] Scheme Code " "$collectsdir"
|
||||||
show_dir_var "[d] Core Docs " "$docdir"
|
show_dir_var "[d] Core Docs " "$docdir"
|
||||||
|
@ -232,7 +231,7 @@ if test "$unixstyle" = "yes"; then
|
||||||
echo " (C sources are not kept)"
|
echo " (C sources are not kept)"
|
||||||
# show_dir_var "[r] Source Tree " "$srcdir"
|
# show_dir_var "[r] Source Tree " "$srcdir"
|
||||||
fi
|
fi
|
||||||
if test "$err" = "yes"; 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 new prefix, a letter to change an entry, enter to continue"
|
||||||
echon "> "
|
echon "> "
|
||||||
read change_what
|
read change_what
|
||||||
|
@ -250,11 +249,11 @@ if test "$unixstyle" = "yes"; then
|
||||||
# echo "Invalid response"
|
# echo "Invalid response"
|
||||||
# fi ;;
|
# fi ;;
|
||||||
"/"* ) set_prefix "$change_what" ;;
|
"/"* ) set_prefix "$change_what" ;;
|
||||||
"" ) done="yes" ;;
|
"" ) done="Y" ;;
|
||||||
* ) echo "Invalid response" ;;
|
* ) echo "Invalid response" ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
if test "$err" = "yes"; then failwith "errors in some paths"; fi
|
if test "$err" = "Y"; then failwith "errors in some paths"; fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -319,7 +318,7 @@ if test -d "bin"; then
|
||||||
* ) sysdir="" ;;
|
* ) sysdir="" ;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
cd "$origpwd"
|
cd "$origwd"
|
||||||
echo ""
|
echo ""
|
||||||
echo "If you want to install new system links within the bin, lib, include,"
|
echo "If you want to install new system links within the bin, lib, include,"
|
||||||
echo " man, and doc subdirectories of a common directory prefix (for"
|
echo " man, and doc subdirectories of a common directory prefix (for"
|
||||||
|
@ -478,7 +477,7 @@ cd "$where"
|
||||||
###############################################################################
|
###############################################################################
|
||||||
## Done
|
## Done
|
||||||
|
|
||||||
if test "$unixstyle" = "yes"; then unixstyle_install; else wholedir_install; fi
|
if test "$unixstyle" = "Y"; then unixstyle_install; else wholedir_install; fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "All done."
|
echo "All done."
|
||||||
|
|
Loading…
Reference in New Issue
Block a user