mirror of
				https://github.com/jakeswenson/BitBetter.git
				synced 2025-10-31 12:53:25 +00:00 
			
		
		
		
	Use absolute path rather than relative path in scripts
This commit is contained in:
		
							parent
							
								
									5d01d3c661
								
							
						
					
					
						commit
						1cac1c3214
					
				|  | @ -3,15 +3,17 @@ | ||||||
| # Check for openssl | # Check for openssl | ||||||
| command -v openssl >/dev/null 2>&1 || { echo >&2 "openssl required but not found.  Aborting."; exit 1; } | command -v openssl >/dev/null 2>&1 || { echo >&2 "openssl required but not found.  Aborting."; exit 1; } | ||||||
| 
 | 
 | ||||||
|  | DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||||||
|  | 
 | ||||||
| # Remove any existing key files | # Remove any existing key files | ||||||
| [ ! -e cert.pem ]  || rm cert.pem | [ ! -e "$DIR/cert.pem" ]  || rm "$DIR/cert.pem" | ||||||
| [ ! -e key.pem ]   || rm key.pem | [ ! -e "$DIR/key.pem" ]   || rm "$DIR/key.pem" | ||||||
| [ ! -e cert.cert ] || rm cert.cert | [ ! -e "$DIR/cert.cert" ] || rm "$DIR/cert.cert" | ||||||
| [ ! -e cert.pfx ]  || rm cert.pfx | [ ! -e "$DIR/cert.pfx" ]  || rm "$DIR/cert.pfx" | ||||||
| 
 | 
 | ||||||
| # Generate new keys | # Generate new keys | ||||||
| openssl	req -x509 -newkey rsa:4096 -keyout .keys/key.pem -out .keys/cert.cert -days 36500 -subj '/CN=www.mydom.com/O=My Company Name LTD./C=US'  -outform DER -passout pass:test | openssl	req -x509 -newkey rsa:4096 -keyout "$DIR/key.pem" -out "$DIR/cert.cert" -days 36500 -subj '/CN=www.mydom.com/O=My Company Name LTD./C=US'  -outform DER -passout pass:test | ||||||
| openssl x509 -inform DER -in .keys/cert.cert -out .keys/cert.pem | openssl x509 -inform DER -in "$DIR/cert.cert" -out "$DIR/cert.pem" | ||||||
| openssl pkcs12 -export -out .keys/cert.pfx -inkey .keys/key.pem -in .keys/cert.pem -passin pass:test -passout pass:test | openssl pkcs12 -export -out "$DIR/cert.pfx" -inkey "$DIR/key.pem" -in "$DIR/cert.pem" -passin pass:test -passout pass:test | ||||||
| 
 | 
 | ||||||
| ls | ls | ||||||
|  |  | ||||||
							
								
								
									
										25
									
								
								build.sh
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								build.sh
									
									
									
									
									
								
							|  | @ -1,24 +1,23 @@ | ||||||
| #!/bin/bash | #!/bin/bash | ||||||
| 
 | 
 | ||||||
|  | DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||||||
|  | 
 | ||||||
| # If there aren't any keys, generate them first. | # If there aren't any keys, generate them first. | ||||||
| [ -e ./.keys/cert.cert ] || ./.keys/generate-keys.sh | [ -e "$DIR/.keys/cert.cert" ] || "$DIR/.keys/generate-keys.sh" | ||||||
| 
 | 
 | ||||||
| [ -e ./src/bitBetter/api/.keys ]  || mkdir ./src/bitBetter/api/.keys | [ -e "$DIR/src/bitBetter/api/.keys" ]  || mkdir "$DIR/src/bitBetter/api/.keys" | ||||||
| [ -e ./src/bitBetter/identity/.keys ]  || mkdir ./src/bitBetter/identity/.keys | [ -e "$DIR/src/bitBetter/identity/.keys" ]  || mkdir "$DIR/src/bitBetter/identity/.keys" | ||||||
| 
 | 
 | ||||||
| cp .keys/cert.cert ./src/bitBetter/api/.keys | cp "$DIR/.keys/cert.cert" "$DIR/src/bitBetter/api/.keys" | ||||||
| cp .keys/cert.cert ./src/bitBetter/identity/.keys | cp "$DIR/.keys/cert.cert" "$DIR/src/bitBetter/identity/.keys" | ||||||
| 
 | 
 | ||||||
| cd ./src/bitBetter | cd "$DIR/src/bitBetter" | ||||||
| 
 | 
 | ||||||
| dotnet restore | dotnet restore | ||||||
| dotnet publish | dotnet publish | ||||||
| 
 | 
 | ||||||
| cp -r bin/ api/ | cp -r ./bin ./api/ | ||||||
| cp -r bin/ identity/ | cp -r ./bin ./identity/ | ||||||
| 
 | 
 | ||||||
| cd ./api | docker build -t bitbetter/api ./api # --squash | ||||||
| docker build --pull . -t bitbetter/api # --squash | docker build -t bitbetter/identity ./identity # --squash | ||||||
| 
 |  | ||||||
| cd ../identity |  | ||||||
| docker build --pull . -t bitbetter/identity # --squash |  | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| 
 | 
 | ||||||
| script_dir=`cd $(dirname $0); pwd` | script_dir=`cd $(dirname $0); pwd` | ||||||
| 
 | 
 | ||||||
| cd $script_dir | cd "$script_dir" | ||||||
| 
 | 
 | ||||||
| dotnet restore | dotnet restore | ||||||
| dotnet publish | dotnet publish | ||||||
|  |  | ||||||
|  | @ -1,16 +1,16 @@ | ||||||
| #!/bin/bash | #!/bin/bash | ||||||
| 
 | 
 | ||||||
| script_dir=`cd $(dirname $0); pwd` | DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||||||
| 
 | 
 | ||||||
| # Grab the absolute path to the default pfx location | # Grab the absolute path to the default pfx location | ||||||
| cert_path=`cd ./.keys; ls -d -1 $PWD/cert.pfx` | cert_path="$DIR/.keys/cert.pfx" | ||||||
| 
 | 
 | ||||||
| if [ "$#" -lt "1" ]; then | if [ "$#" -lt "1" ]; then | ||||||
|     echo "USAGE: $0 <ABSOLUTE PATH TO CERT.PFX> [License Gen args...]" |     echo "USAGE: $0 <ABSOLUTE PATH TO CERT.PFX> [License Gen args...]" | ||||||
|     exit 1 |     exit 1 | ||||||
| elif [ "$#" -ge "2" ]; then | elif [ "$#" -ge "2" ]; then | ||||||
|     # If a cert path is provided manually, override the default |     # If a cert path is provided manually, override the default | ||||||
|     cert_path=$1 |     cert_path="$1" | ||||||
|     shift |     shift | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user