mirror of
				https://github.com/jakeswenson/BitBetter.git
				synced 2025-10-31 12:53: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 | ||||
| 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 )" | ||||
| 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 | ||||
| BITWARDEN_BASE="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." >/dev/null 2>&1 && pwd )" | ||||
| 
 | ||||
| # Get Bitwarden base from user (or keep default value) | ||||
| read -p "Enter Bitwarden base directory [$BITWARDEN_BASE]: " tmpbase | ||||
| # Get Bitwarden base from user (or keep default value) or use first argument | ||||
| ask tmpbase "$1" "Enter Bitwarden base directory [$BITWARDEN_BASE]: " | ||||
| BITWARDEN_BASE=${tmpbase:-$BITWARDEN_BASE} | ||||
| 
 | ||||
| # 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 | ||||
| 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} | ||||
| 
 | ||||
| if [[ $RECREATE_OV =~ ^[Yy]$ ]] | ||||
|  | @ -48,7 +56,7 @@ if [ $retval -ne 0 ]; then | |||
|     REBUILD_BB="y" | ||||
|     REBUILD_BB_DESCR="[Y/n]" | ||||
| fi | ||||
| read -p "Rebuild BitBetter images? $REBUILD_BB_DESCR: " tmprebuild | ||||
| ask tmprebuild "$3" "Rebuild BitBetter images? $REBUILD_BB_DESCR: " | ||||
| REBUILD_BB=${tmprebuild:-$REBUILD_BB} | ||||
| 
 | ||||
| if [[ $REBUILD_BB =~ ^[Yy]$ ]] | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user