Rename self-update to upgrade, fixes #38
This commit is contained in:
parent
2ef3c22cab
commit
475d060abe
@ -62,4 +62,4 @@ edo ghcup -v list -t cabal-install
|
|||||||
edo ghc --version
|
edo ghc --version
|
||||||
|
|
||||||
# self update destructively
|
# self update destructively
|
||||||
edo ghcup -v self-update
|
edo ghcup -v upgrade
|
||||||
|
36
ghcup
36
ghcup
@ -180,7 +180,7 @@ SUBCOMMANDS:
|
|||||||
show Show current/installed GHC
|
show Show current/installed GHC
|
||||||
set Set currently active GHC version
|
set Set currently active GHC version
|
||||||
list Show available GHCs and other tools (upstream)
|
list Show available GHCs and other tools (upstream)
|
||||||
self-update Update this script in-place
|
upgrade Upgrade this script in-place
|
||||||
rm Remove an already installed GHC
|
rm Remove an already installed GHC
|
||||||
install-cabal Install cabal-install
|
install-cabal Install cabal-install
|
||||||
debug-info Print debug info (e.g. detected system/distro)
|
debug-info Print debug info (e.g. detected system/distro)
|
||||||
@ -245,16 +245,16 @@ DISCUSSION:
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# @FUNCTION: self_update_usage
|
# @FUNCTION: upgrade_usage
|
||||||
# @DESCRIPTION:
|
# @DESCRIPTION:
|
||||||
# Print the help message for 'ghcup self-update' to STDERR
|
# Print the help message for 'ghcup upgrade' to STDERR
|
||||||
# and exit the script with status code 1.
|
# and exit the script with status code 1.
|
||||||
self_update_usage() {
|
upgrade_usage() {
|
||||||
(>&2 echo "ghcup-self-update
|
(>&2 echo "ghcup-upgrade
|
||||||
Update the ghcup script in-place
|
Update the ghcup script in-place
|
||||||
|
|
||||||
USAGE:
|
USAGE:
|
||||||
${SCRIPT} self-update [FLAGS] [TARGET-LOCATION]
|
${SCRIPT} upgrade [FLAGS] [TARGET-LOCATION]
|
||||||
|
|
||||||
FLAGS:
|
FLAGS:
|
||||||
-h, --help Prints help information
|
-h, --help Prints help information
|
||||||
@ -657,7 +657,7 @@ check_meta_file_version() {
|
|||||||
}" "$1")
|
}" "$1")
|
||||||
|
|
||||||
if [ "${mymetavar}" != "$2" ] ; then
|
if [ "${mymetavar}" != "$2" ] ; then
|
||||||
die "Unsupported meta file format, run: ghcup self-update"
|
die "Unsupported meta file format, run: ${SCRIPT} upgrade"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
unset mymetavar
|
unset mymetavar
|
||||||
@ -1035,7 +1035,7 @@ install_ghc() {
|
|||||||
warning_message "Consider running: ghcup rm ${myghcver}"
|
warning_message "Consider running: ghcup rm ${myghcver}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
die "Failed to install, consider updating this script via: ${SCRIPT} self-update"
|
die "Failed to install, consider updating this script via: ${SCRIPT} upgrade"
|
||||||
}
|
}
|
||||||
|
|
||||||
for f in "${inst_location}"/bin/*-"${myghcver}" ; do
|
for f in "${inst_location}"/bin/*-"${myghcver}" ; do
|
||||||
@ -1092,17 +1092,17 @@ set_ghc() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
################################
|
############################
|
||||||
#--[ Subcommand self-update ]--#
|
#--[ Subcommand upgrade ]--#
|
||||||
################################
|
############################
|
||||||
|
|
||||||
|
|
||||||
# @FUNCTION: self_update
|
# @FUNCTION: upgrade
|
||||||
# @USAGE: <install-location>
|
# @USAGE: <install-location>
|
||||||
# @DESCRIPTION:
|
# @DESCRIPTION:
|
||||||
# Downloads the latest version of this script and places it into
|
# Downloads the latest version of this script and places it into
|
||||||
# the given directory.
|
# the given directory.
|
||||||
self_update() {
|
upgrade() {
|
||||||
target_location=$1
|
target_location=$1
|
||||||
|
|
||||||
[ -e "${target_location}" ] || die "Destination \"${target_location}\" does not exist, cannot update script"
|
[ -e "${target_location}" ] || die "Destination \"${target_location}\" does not exist, cannot update script"
|
||||||
@ -1380,7 +1380,7 @@ compile_ghc() {
|
|||||||
[ -e "${tmp_dir}/${download_tarball_name}" ] && rm "${tmp_dir}/${download_tarball_name}"
|
[ -e "${tmp_dir}/${download_tarball_name}" ] && rm "${tmp_dir}/${download_tarball_name}"
|
||||||
[ -e "${tmp_dir}/ghc-${myghcver}" ] && rm -r "${tmp_dir}/ghc-${myghcver}"
|
[ -e "${tmp_dir}/ghc-${myghcver}" ] && rm -r "${tmp_dir}/ghc-${myghcver}"
|
||||||
die "Failed to install, consider updating this script via:
|
die "Failed to install, consider updating this script via:
|
||||||
${SCRIPT} self-update
|
${SCRIPT} upgrade
|
||||||
Also check https://ghc.haskell.org/trac/ghc/wiki/Building/Preparation/Linux for build requirements and follow the instructions."
|
Also check https://ghc.haskell.org/trac/ghc/wiki/Building/Preparation/Linux for build requirements and follow the instructions."
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1571,19 +1571,19 @@ if ! is_sourced ; then
|
|||||||
[ "${GHC_VER}" ] || set_usage
|
[ "${GHC_VER}" ] || set_usage
|
||||||
set_ghc "${GHC_VER}"
|
set_ghc "${GHC_VER}"
|
||||||
break;;
|
break;;
|
||||||
self-update)
|
upgrade)
|
||||||
shift 1
|
shift 1
|
||||||
while [ $# -gt 0 ] ; do
|
while [ $# -gt 0 ] ; do
|
||||||
case $1 in
|
case $1 in
|
||||||
-h|--help) self_update_usage;;
|
-h|--help) upgrade_usage;;
|
||||||
*) TARGET_LOCATION=$1
|
*) TARGET_LOCATION=$1
|
||||||
break;;
|
break;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
if [ "${TARGET_LOCATION}" ] ; then
|
if [ "${TARGET_LOCATION}" ] ; then
|
||||||
self_update "${TARGET_LOCATION}"
|
upgrade "${TARGET_LOCATION}"
|
||||||
else
|
else
|
||||||
self_update "$(dirname "$(posix_realpath "${SOURCE}")")"
|
upgrade "$(dirname "$(posix_realpath "${SOURCE}")")"
|
||||||
fi
|
fi
|
||||||
break;;
|
break;;
|
||||||
show)
|
show)
|
||||||
|
Loading…
Reference in New Issue
Block a user