mirror of
				https://github.com/jakeswenson/BitBetter.git
				synced 2025-10-31 21:03:25 +00:00 
			
		
		
		
	make update-bitwarden.sh able to run non-interactive
This commit is contained in:
		
							parent
							
								
									7ddf01fdf6
								
							
						
					
					
						commit
						36c1c60b19
					
				|  | @ -1,4 +1,12 @@ | ||||||
| #!/bin/bash | #!/bin/bash | ||||||
|  | ask() | ||||||
|  | { | ||||||
|  |   declare -g $1="$2" | ||||||
|  |   if [ -z "${!1}" ]; then | ||||||
|  |     echo "$3" | ||||||
|  |     read $1 | ||||||
|  |   fi | ||||||
|  | } | ||||||
| 
 | 
 | ||||||
| SCRIPT_BASE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | SCRIPT_BASE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||||||
| BW_VERSION="$(curl --silent https://raw.githubusercontent.com/bitwarden/server/master/scripts/bitwarden.sh | grep 'COREVERSION="' | sed 's/^[^"]*"//; s/".*//')" | BW_VERSION="$(curl --silent https://raw.githubusercontent.com/bitwarden/server/master/scripts/bitwarden.sh | grep 'COREVERSION="' | sed 's/^[^"]*"//; s/".*//')" | ||||||
|  | @ -8,8 +16,8 @@ echo "Starting Bitwarden update, newest server version: $BW_VERSION" | ||||||
| # Default path is the parent directory of the BitBetter location | # Default path is the parent directory of the BitBetter location | ||||||
| BITWARDEN_BASE="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." >/dev/null 2>&1 && pwd )" | BITWARDEN_BASE="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." >/dev/null 2>&1 && pwd )" | ||||||
| 
 | 
 | ||||||
| # Get Bitwarden base from user (or keep default value) | # Get Bitwarden base from user (or keep default value) or use first argument | ||||||
| read -p "Enter Bitwarden base directory [$BITWARDEN_BASE]: " tmpbase | ask tmpbase "$1" "Enter Bitwarden base directory [$BITWARDEN_BASE]: " | ||||||
| BITWARDEN_BASE=${tmpbase:-$BITWARDEN_BASE} | BITWARDEN_BASE=${tmpbase:-$BITWARDEN_BASE} | ||||||
| 
 | 
 | ||||||
| # Check if directory exists and is valid | # Check if directory exists and is valid | ||||||
|  | @ -18,7 +26,7 @@ BITWARDEN_BASE=${tmpbase:-$BITWARDEN_BASE} | ||||||
| 
 | 
 | ||||||
| # Check if user wants to recreate the docker-compose override file | # Check if user wants to recreate the docker-compose override file | ||||||
| RECREATE_OV="y" | RECREATE_OV="y" | ||||||
| read -p "Rebuild docker-compose override? [Y/n]: " tmprecreate | ask tmprecreate "$2" "Rebuild docker-compose override? [Y/n]: " | ||||||
| RECREATE_OV=${tmprecreate:-$RECREATE_OV} | RECREATE_OV=${tmprecreate:-$RECREATE_OV} | ||||||
| 
 | 
 | ||||||
| if [[ $RECREATE_OV =~ ^[Yy]$ ]] | if [[ $RECREATE_OV =~ ^[Yy]$ ]] | ||||||
|  | @ -48,7 +56,7 @@ if [ $retval -ne 0 ]; then | ||||||
|     REBUILD_BB="y" |     REBUILD_BB="y" | ||||||
|     REBUILD_BB_DESCR="[Y/n]" |     REBUILD_BB_DESCR="[Y/n]" | ||||||
| fi | fi | ||||||
| read -p "Rebuild BitBetter images? $REBUILD_BB_DESCR: " tmprebuild | ask tmprebuild "$3" "Rebuild BitBetter images? $REBUILD_BB_DESCR: " | ||||||
| REBUILD_BB=${tmprebuild:-$REBUILD_BB} | REBUILD_BB=${tmprebuild:-$REBUILD_BB} | ||||||
| 
 | 
 | ||||||
| if [[ $REBUILD_BB =~ ^[Yy]$ ]] | if [[ $REBUILD_BB =~ ^[Yy]$ ]] | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user