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
|
||||
|
||||
# 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
|
||||
set Set currently active GHC version
|
||||
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
|
||||
install-cabal Install cabal-install
|
||||
debug-info Print debug info (e.g. detected system/distro)
|
||||
@ -245,16 +245,16 @@ DISCUSSION:
|
||||
exit 1
|
||||
}
|
||||
|
||||
# @FUNCTION: self_update_usage
|
||||
# @FUNCTION: upgrade_usage
|
||||
# @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.
|
||||
self_update_usage() {
|
||||
(>&2 echo "ghcup-self-update
|
||||
upgrade_usage() {
|
||||
(>&2 echo "ghcup-upgrade
|
||||
Update the ghcup script in-place
|
||||
|
||||
USAGE:
|
||||
${SCRIPT} self-update [FLAGS] [TARGET-LOCATION]
|
||||
${SCRIPT} upgrade [FLAGS] [TARGET-LOCATION]
|
||||
|
||||
FLAGS:
|
||||
-h, --help Prints help information
|
||||
@ -657,7 +657,7 @@ check_meta_file_version() {
|
||||
}" "$1")
|
||||
|
||||
if [ "${mymetavar}" != "$2" ] ; then
|
||||
die "Unsupported meta file format, run: ghcup self-update"
|
||||
die "Unsupported meta file format, run: ${SCRIPT} upgrade"
|
||||
fi
|
||||
|
||||
unset mymetavar
|
||||
@ -1035,7 +1035,7 @@ install_ghc() {
|
||||
warning_message "Consider running: ghcup rm ${myghcver}"
|
||||
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
|
||||
@ -1092,17 +1092,17 @@ set_ghc() {
|
||||
|
||||
|
||||
|
||||
################################
|
||||
#--[ Subcommand self-update ]--#
|
||||
################################
|
||||
############################
|
||||
#--[ Subcommand upgrade ]--#
|
||||
############################
|
||||
|
||||
|
||||
# @FUNCTION: self_update
|
||||
# @FUNCTION: upgrade
|
||||
# @USAGE: <install-location>
|
||||
# @DESCRIPTION:
|
||||
# Downloads the latest version of this script and places it into
|
||||
# the given directory.
|
||||
self_update() {
|
||||
upgrade() {
|
||||
target_location=$1
|
||||
|
||||
[ -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}/ghc-${myghcver}" ] && rm -r "${tmp_dir}/ghc-${myghcver}"
|
||||
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."
|
||||
}
|
||||
|
||||
@ -1571,19 +1571,19 @@ if ! is_sourced ; then
|
||||
[ "${GHC_VER}" ] || set_usage
|
||||
set_ghc "${GHC_VER}"
|
||||
break;;
|
||||
self-update)
|
||||
upgrade)
|
||||
shift 1
|
||||
while [ $# -gt 0 ] ; do
|
||||
case $1 in
|
||||
-h|--help) self_update_usage;;
|
||||
-h|--help) upgrade_usage;;
|
||||
*) TARGET_LOCATION=$1
|
||||
break;;
|
||||
esac
|
||||
done
|
||||
if [ "${TARGET_LOCATION}" ] ; then
|
||||
self_update "${TARGET_LOCATION}"
|
||||
upgrade "${TARGET_LOCATION}"
|
||||
else
|
||||
self_update "$(dirname "$(posix_realpath "${SOURCE}")")"
|
||||
upgrade "$(dirname "$(posix_realpath "${SOURCE}")")"
|
||||
fi
|
||||
break;;
|
||||
show)
|
||||
|
Loading…
Reference in New Issue
Block a user