install: update docs, help, version output
This commit is contained in:
parent
d40639eb59
commit
6eed92b24a
@ -1,8 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Easy hledger installation script for POSIX systems.
|
# Easy hledger installation script for POSIX systems, requiring bash
|
||||||
# Uses cabal if installed and stack is not,
|
# and some other POSIX tools.
|
||||||
# or stack, which it will install if needed (or if --force-install-stack is used).
|
|
||||||
# Requires bash and some other POSIX tools.
|
|
||||||
# This is based on get-stack.sh which is copyright (c) 2015-2017, Stack contributors.
|
# This is based on get-stack.sh which is copyright (c) 2015-2017, Stack contributors.
|
||||||
|
|
||||||
#set -e # causes trouble, https://github.com/simonmichael/hledger/issues/714
|
#set -e # causes trouble, https://github.com/simonmichael/hledger/issues/714
|
||||||
@ -10,36 +8,34 @@ set -o pipefail
|
|||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
cat <<HERE
|
cat <<HERE
|
||||||
hledger-install.sh [-f|--force-install-stack] [-v|--verbose] [-s|--status] [--version] [-h|--help]
|
hledger-install.sh version $HLEDGER_INSTALL_VERSION, installs hledger $HLEDGER_VERSION
|
||||||
|
|
||||||
Installs the current release of hledger and related tools as reliably and
|
hledger-install.sh [-f|--force-install-stack] [-s|--status] [-v|--verbose]
|
||||||
quickly as possible on any POSIX system, using cabal (if installed and
|
[--version] [-h|--help]
|
||||||
stack is not) or stack (installing it when needed or if --force-install-stack is used).
|
|
||||||
With --status, just lists the currently installed hledger tools.
|
|
||||||
Usage:
|
|
||||||
|
|
||||||
curl -sSLO http://hledger.org/hledger-install.sh # or wget -qO- ...
|
This script builds and installs the current release of hledger and addons,
|
||||||
less hledger-install.sh # security review
|
on GHC-supporting POSIX system with bash installed, as reliably as possible.
|
||||||
bash [-x] hledger-install.sh # to see commands being run, add -x
|
If cabal is installed and stack is not, and --force-install-stack is not used,
|
||||||
|
it will use cabal; otherwise it will use stack, installing stack if needed.
|
||||||
|
|
||||||
or if you prefer convenience to security:
|
Run it the security-conscious way:
|
||||||
|
|
||||||
curl -sSL http://hledger.org/hledger-install.sh | bash
|
curl -sSLO https://hledger.org/hledger-install.sh # download
|
||||||
|
less hledger-install.sh # review for malware
|
||||||
|
bash -x hledger-install.sh # run it, showing commands
|
||||||
|
|
||||||
Once hledger is installed, if you keep hledger-install.sh in \$PATH
|
or the lazy way:
|
||||||
(and upgrade it periodically - currently this must be done manually):
|
|
||||||
|
|
||||||
hledger install # upgrades other hledger tools
|
curl -sSL https://hledger.org/hledger-install.sh | bash
|
||||||
hledger install -- -s # shows installation status
|
|
||||||
|
|
||||||
Note this can require significant time (minutes to hours), memory (~2G),
|
Note this can require up to 2G each of free RAM and disk space,
|
||||||
and disk space (megabytes to a gigabyte) depending on your connection,
|
and could take between a minute and an hour.
|
||||||
machine and past installations. You can kill and rerun it without losing progress.
|
You can kill and rerun it without losing progress.
|
||||||
(But note if you ctrl-C too vigorously, it might leave a
|
|
||||||
"hackage-security-lock" directory which you'll need to remove manually,
|
To see what hledger tools are currently installed:
|
||||||
cf https://github.com/commercialhaskell/stack/issues/3055).
|
|
||||||
|
bash hledger-install.sh -s
|
||||||
|
|
||||||
Version $HLEDGER_INSTALL_VERSION, installs hledger $HLEDGER_VERSION
|
|
||||||
HERE
|
HERE
|
||||||
}
|
}
|
||||||
#TODO https://github.com/commercialhaskell/stack/issues/3055 https://github.com/haskell/hackage-security/issues/187
|
#TODO https://github.com/commercialhaskell/stack/issues/3055 https://github.com/haskell/hackage-security/issues/187
|
||||||
@ -926,7 +922,7 @@ if [[ $HELPFLAG ]] ; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $VERSIONFLAG ]] ; then
|
if [[ $VERSIONFLAG ]] ; then
|
||||||
echo $HLEDGER_INSTALL_TOOL $HLEDGER_INSTALL_VERSION
|
echo "$HLEDGER_INSTALL_TOOL version $HLEDGER_INSTALL_VERSION, installs hledger $HLEDGER_VERSION"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -939,7 +935,8 @@ else
|
|||||||
QUIET="true"
|
QUIET="true"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "hledger-install.sh $HLEDGER_INSTALL_VERSION $(date)"
|
date
|
||||||
|
echo "$HLEDGER_INSTALL_TOOL version $HLEDGER_INSTALL_VERSION, installs hledger $HLEDGER_VERSION"
|
||||||
|
|
||||||
# ensure ~/.local/bin/ in PATH
|
# ensure ~/.local/bin/ in PATH
|
||||||
# TODO should check ~/.cabal/bin if using cabal
|
# TODO should check ~/.cabal/bin if using cabal
|
||||||
@ -960,7 +957,7 @@ quietly_run lsb_release -a
|
|||||||
|
|
||||||
# show current installed hledger packages
|
# show current installed hledger packages
|
||||||
echo
|
echo
|
||||||
echo "Install status before:"
|
echo "Current install status:"
|
||||||
print_installed_versions
|
print_installed_versions
|
||||||
|
|
||||||
if [[ $STATUSFLAG ]] ; then
|
if [[ $STATUSFLAG ]] ; then
|
||||||
@ -1007,7 +1004,7 @@ fi
|
|||||||
|
|
||||||
if [[ $(cmpver "$(cmd_version hledger-ui 2>/dev/null)" $HLEDGER_UI_VERSION) = 2 ]]; then
|
if [[ $(cmpver "$(cmd_version hledger-ui 2>/dev/null)" $HLEDGER_UI_VERSION) = 2 ]]; then
|
||||||
echo Installing hledger-ui
|
echo Installing hledger-ui
|
||||||
try_install hledger-ui-$HLEDGER_UI_VERSION hledger-$HLEDGER_VERSION hledger-lib-$HLEDGER_LIB_VERSION $EXTRA_DEPS \
|
try_install hledger-ui-$HLEDGER_UI_VERSION hledger-$HLEDGER_VERSION hledger-lib-$HLEDGER_LIB_VERSION $EXTRA_DEPS \
|
||||||
# brick-X.Y # when hledger-iadd requires a special brick, use the same here to reduce rebuilding
|
# brick-X.Y # when hledger-iadd requires a special brick, use the same here to reduce rebuilding
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
@ -1034,7 +1031,7 @@ fi
|
|||||||
|
|
||||||
# show new installation status
|
# show new installation status
|
||||||
echo
|
echo
|
||||||
echo "Install status after:"
|
echo "New install status:"
|
||||||
print_installed_versions
|
print_installed_versions
|
||||||
|
|
||||||
# warn if $HOME/.local/bin isn't in $PATH
|
# warn if $HOME/.local/bin isn't in $PATH
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user