install: create $HOME/.local/bin if needed, instead of failing
[ci skip]
This commit is contained in:
		
							parent
							
								
									7bbaf18ca4
								
							
						
					
					
						commit
						731a051093
					
				| @ -46,7 +46,7 @@ HERE | |||||||
| HLEDGER_INSTALL_TOOL=hledger-install.sh | HLEDGER_INSTALL_TOOL=hledger-install.sh | ||||||
|   # ^ this script's name (can't use $0 when it's piped into bash) |   # ^ this script's name (can't use $0 when it's piped into bash) | ||||||
| 
 | 
 | ||||||
| HLEDGER_INSTALL_VERSION=20180208 | HLEDGER_INSTALL_VERSION=20180216 | ||||||
| 
 | 
 | ||||||
| RESOLVER=  #"--resolver=nightly" | RESOLVER=  #"--resolver=nightly" | ||||||
|   # ^ You can specify a different stackage snapshot here,  |   # ^ You can specify a different stackage snapshot here,  | ||||||
| @ -532,6 +532,7 @@ install_from_bindist() { | |||||||
| #CHANGED | #CHANGED | ||||||
| #    if ! sudocmd install -c -o 0 -g 0 -m 0755 "$STACK_TEMP_DIR/$1"/*/stack "$USR_LOCAL_BIN/stack"; then | #    if ! sudocmd install -c -o 0 -g 0 -m 0755 "$STACK_TEMP_DIR/$1"/*/stack "$USR_LOCAL_BIN/stack"; then | ||||||
| #      die "Install to $USR_LOCAL_BIN/stack failed" | #      die "Install to $USR_LOCAL_BIN/stack failed" | ||||||
|  |     ensure_home_local_bin | ||||||
|     if ! install -m 0755 "$STACK_TEMP_DIR/$1"/*/stack "$HOME_LOCAL_BIN/stack"; then |     if ! install -m 0755 "$STACK_TEMP_DIR/$1"/*/stack "$HOME_LOCAL_BIN/stack"; then | ||||||
|       die "Install to $HOME_LOCAL_BIN/stack failed" |       die "Install to $HOME_LOCAL_BIN/stack failed" | ||||||
|     fi |     fi | ||||||
| @ -696,6 +697,11 @@ has_cmd() { | |||||||
|   command -v "$1" > /dev/null 2>&1 |   command -v "$1" > /dev/null 2>&1 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | # Ensure that $HOME/.local/bin/ exists, or die. | ||||||
|  | ensure_home_local_bin() { | ||||||
|  |   install -d "$HOME_LOCAL_BIN" || die "Creating $HOME_LOCAL_BIN/ directory failed" | ||||||
|  | } | ||||||
|  | 
 | ||||||
| # Check whether the given path is listed in the PATH environment variable | # Check whether the given path is listed in the PATH environment variable | ||||||
| on_path() { | on_path() { | ||||||
|   echo ":$PATH:" | grep -q :"$1": |   echo ":$PATH:" | grep -q :"$1": | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user