Introduce a GHCUP_INSTALL_BASE_PREFIX

Partly "fixes" #7
This commit is contained in:
Julian Ospald 2018-12-13 22:50:08 +08:00
parent 6072ded541
commit 75e48da9a0
No known key found for this signature in database
GPG Key ID: 511B62C09D50CD28

18
ghcup
View File

@ -58,10 +58,19 @@ VERBOSE=false
# Whether to force installation and overwrite files.
FORCE=false
# @VARIABLE: GHCUP_INSTALL_BASE_PREFIX
# @DESCRIPTION:
# The main install directory prefix, under which .ghcup
# directory will be created. This directory is user
# configurable via the environment variable of the
# same name. It must be non-empty and the path
# it points to must exist.
: "${GHCUP_INSTALL_BASE_PREFIX:=$HOME}"
# @VARIABLE: INSTALL_BASE
# @DESCRIPTION:
# The main install directory where all ghcup stuff happens.
INSTALL_BASE="$HOME/.ghcup"
INSTALL_BASE="$GHCUP_INSTALL_BASE_PREFIX/.ghcup"
# @VARIABLE: GHC_LOCATION
# @DESCRIPTION:
@ -1659,10 +1668,13 @@ list() {
#######################
if [ -z "$HOME" ] ; then
die "HOME env not set, cannot operate"
if [ -z "${GHCUP_INSTALL_BASE_PREFIX}" ] ; then
die "GHCUP_INSTALL_BASE_PREFIX empty, cannot operate"
fi
if [ ! -d "${GHCUP_INSTALL_BASE_PREFIX}" ] ; then
die "${GHCUP_INSTALL_BASE_PREFIX} does not exist"
fi