install: fix some shellcheck warnings
[ci skip]
This commit is contained in:
		
							parent
							
								
									a8009f1953
								
							
						
					
					
						commit
						cf5f8c1273
					
				| @ -396,7 +396,7 @@ distro_info() { | |||||||
|       if [ -e /etc/arch-release ] ; then |       if [ -e /etc/arch-release ] ; then | ||||||
|         # /etc/arch-release exists but is often empty |         # /etc/arch-release exists but is often empty | ||||||
|         echo "arch;" |         echo "arch;" | ||||||
|       elif [ -e /etc/centos-release ] && grep -q "\<6\>" /etc/centos-release ; then |       elif [ -e /etc/centos-release ] && grep -q "\\<6\\>" /etc/centos-release ; then | ||||||
|         # /etc/centos-release has a non-standard format before version 7 |         # /etc/centos-release has a non-standard format before version 7 | ||||||
|         echo "centos;6" |         echo "centos;6" | ||||||
|       else |       else | ||||||
| @ -745,7 +745,7 @@ trap cleanup_temp_dir EXIT | |||||||
| 
 | 
 | ||||||
| # install stack if needed, or always with --force-install-stack, in $HOME/.local/bin | # install stack if needed, or always with --force-install-stack, in $HOME/.local/bin | ||||||
| ensure_stack() { | ensure_stack() { | ||||||
|   if ! $(has_stack) || [[ "$FORCE_INSTALL_STACK" == "true" ]] ; then |   if ! has_stack || [[ "$FORCE_INSTALL_STACK" == "true" ]] ; then | ||||||
|     echo "Installing stack" |     echo "Installing stack" | ||||||
|     do_os |     do_os | ||||||
|   fi |   fi | ||||||
| @ -785,18 +785,18 @@ print_cmd_version() { | |||||||
| 
 | 
 | ||||||
| # Show the installation status of the $HLEDGER_MAIN_TOOLS and $HLEDGER_OTHER_TOOLS.  | # Show the installation status of the $HLEDGER_MAIN_TOOLS and $HLEDGER_OTHER_TOOLS.  | ||||||
| print_hledger_versions() { | print_hledger_versions() { | ||||||
|   for cmd in $HLEDGER_MAIN_TOOLS $HLEDGER_OTHER_TOOLS $HLEDGER_INSTALL_TOOL ; do print_cmd_version $cmd; done |   for cmd in $HLEDGER_MAIN_TOOLS $HLEDGER_OTHER_TOOLS $HLEDGER_INSTALL_TOOL ; do print_cmd_version "$cmd"; done | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| # Run a command, but first log it with "Trying" prepended. | # Run a command, but first log it with "Trying" prepended. | ||||||
| try_info() { | try_info() { | ||||||
|   echo Trying "$@" |   echo Trying "$@" | ||||||
|   $@ |   "$@" | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| # Run a command if possible, suppressing any error output or non-zero exit code. | # Run a command if possible, suppressing any error output or non-zero exit code. | ||||||
| quietly_run() { | quietly_run() { | ||||||
|   $@ 2>/dev/null || true |   "$@" 2>/dev/null || true | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| # Try to install the executables of the given package(s) to $HOME/.local/bin,  | # Try to install the executables of the given package(s) to $HOME/.local/bin,  | ||||||
| @ -808,10 +808,10 @@ quietly_run() { | |||||||
| # install but also all dependencies which are not in the specified stackage $RESOLVER. | # install but also all dependencies which are not in the specified stackage $RESOLVER. | ||||||
| try_install() { | try_install() { | ||||||
|   (cd  # avoid any project-specific stack/cabal config, install at user level |   (cd  # avoid any project-specific stack/cabal config, install at user level | ||||||
|    (! has_cmd stack && has_cmd cabal && try_info cabal install "$@" --verbose=$CABAL_VERBOSITY ) || |    (! has_cmd stack && has_cmd cabal && try_info cabal install "$@" --verbose="$CABAL_VERBOSITY" ) || | ||||||
|    (ensure_stack && ( |    (ensure_stack && ( | ||||||
|     #(try_info stack install --install-ghc "$@" --verbosity=$STACK_VERBOSITY ) ||        # existing resolver |     #(try_info stack install --install-ghc "$@" --verbosity=$STACK_VERBOSITY ) ||        # existing resolver | ||||||
|     (try_info stack install --install-ghc $RESOLVER "$@" --verbosity=$STACK_VERBOSITY )  # specific resolver |     (try_info stack install --install-ghc $RESOLVER "$@" --verbosity="$STACK_VERBOSITY" )  # specific resolver | ||||||
|     ) |     ) | ||||||
|    ) || |    ) || | ||||||
|    echo Failed to install "$@" |    echo Failed to install "$@" | ||||||
| @ -875,7 +875,7 @@ else | |||||||
|   QUIET="true" |   QUIET="true" | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
| echo "hledger-install.sh $HLEDGER_INSTALL_VERSION `date`" | echo "hledger-install.sh $HLEDGER_INSTALL_VERSION $(date)" | ||||||
| 
 | 
 | ||||||
| # ensure ~/.local/bin/ in PATH | # ensure ~/.local/bin/ in PATH | ||||||
| if ! on_path "$HOME_LOCAL_BIN" ; then | if ! on_path "$HOME_LOCAL_BIN" ; then | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user