install: update docs, help, version output
This commit is contained in:
		
							parent
							
								
									d40639eb59
								
							
						
					
					
						commit
						6eed92b24a
					
				| @ -1,8 +1,6 @@ | ||||
| #!/bin/bash | ||||
| # Easy hledger installation script for POSIX systems. | ||||
| # Uses cabal if installed and stack is not, | ||||
| # or stack, which it will install if needed (or if --force-install-stack is used). | ||||
| # Requires bash and some other POSIX tools. | ||||
| # Easy hledger installation script for POSIX systems, requiring bash | ||||
| # and some other POSIX tools. | ||||
| # 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 | ||||
| @ -10,36 +8,34 @@ set -o pipefail | ||||
| 
 | ||||
| usage() { | ||||
|   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 | ||||
| quickly as possible on any POSIX system, using cabal (if installed and | ||||
| 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: | ||||
| hledger-install.sh [-f|--force-install-stack] [-s|--status] [-v|--verbose] | ||||
|                    [--version] [-h|--help] | ||||
| 
 | ||||
|  curl -sSLO http://hledger.org/hledger-install.sh  # or wget -qO- ... | ||||
|  less hledger-install.sh       # security review | ||||
|  bash [-x] hledger-install.sh  # to see commands being run, add -x | ||||
| This script builds and installs the current release of hledger and addons, | ||||
| on GHC-supporting POSIX system with bash installed, as reliably as possible. | ||||
| 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 | ||||
| (and upgrade it periodically - currently this must be done manually): | ||||
| or the lazy way: | ||||
| 
 | ||||
|  hledger install        # upgrades other hledger tools | ||||
|  hledger install -- -s  # shows installation status | ||||
|  curl -sSL https://hledger.org/hledger-install.sh | bash | ||||
| 
 | ||||
| Note this can require significant time (minutes to hours), memory (~2G), | ||||
| and disk space (megabytes to a gigabyte) depending on your connection, | ||||
| machine and past installations. 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, | ||||
| cf https://github.com/commercialhaskell/stack/issues/3055). | ||||
| Note this can require up to 2G each of free RAM and disk space, | ||||
| and could take between a minute and an hour. | ||||
| You can kill and rerun it without losing progress. | ||||
| 
 | ||||
| To see what hledger tools are currently installed: | ||||
| 
 | ||||
|  bash hledger-install.sh -s | ||||
| 
 | ||||
| Version $HLEDGER_INSTALL_VERSION, installs hledger $HLEDGER_VERSION | ||||
| HERE | ||||
| } | ||||
| #TODO https://github.com/commercialhaskell/stack/issues/3055 https://github.com/haskell/hackage-security/issues/187 | ||||
| @ -926,7 +922,7 @@ if [[ $HELPFLAG ]] ; then | ||||
| fi | ||||
| 
 | ||||
| if [[ $VERSIONFLAG ]] ; then | ||||
|   echo $HLEDGER_INSTALL_TOOL $HLEDGER_INSTALL_VERSION | ||||
|   echo "$HLEDGER_INSTALL_TOOL version $HLEDGER_INSTALL_VERSION, installs hledger $HLEDGER_VERSION" | ||||
|   exit 0 | ||||
| fi | ||||
| 
 | ||||
| @ -939,7 +935,8 @@ else | ||||
|   QUIET="true" | ||||
| 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 | ||||
| # TODO should check ~/.cabal/bin if using cabal | ||||
| @ -960,7 +957,7 @@ quietly_run lsb_release -a | ||||
| 
 | ||||
| # show current installed hledger packages | ||||
| echo | ||||
| echo "Install status before:" | ||||
| echo "Current install status:" | ||||
| print_installed_versions | ||||
| 
 | ||||
| if [[ $STATUSFLAG ]] ; then | ||||
| @ -1007,7 +1004,7 @@ fi | ||||
| 
 | ||||
| if [[ $(cmpver "$(cmd_version hledger-ui 2>/dev/null)" $HLEDGER_UI_VERSION) = 2 ]]; then | ||||
|   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 | ||||
|   echo | ||||
| fi | ||||
| @ -1034,7 +1031,7 @@ fi | ||||
| 
 | ||||
| # show new installation status | ||||
| echo | ||||
| echo "Install status after:" | ||||
| echo "New install status:" | ||||
| print_installed_versions | ||||
| 
 | ||||
| # warn if $HOME/.local/bin isn't in $PATH | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user