From feed1d8646b9918caae0b4d2698e81f32d2d53a9 Mon Sep 17 00:00:00 2001 From: Kevin MacMartin Date: Wed, 10 Jan 2018 11:20:49 -0500 Subject: [PATCH] Hopefully fix init.sh for macos --- init.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/init.sh b/init.sh index 64321e3..430d366 100755 --- a/init.sh +++ b/init.sh @@ -53,12 +53,6 @@ trap 'error "script killed"' SIGINT SIGQUIT # Check for the --no-artisan argument and set a flag that prevents artisan commands from being run if present [[ -n "$1" && "$1" = '--no-artisan' ]] && no_artisan=1 -[[ ! -f .env ]] && { - msg "Copying ${c_y}.env.example$c_w to ${c_y}.env$c_w with a randomly generated ${c_g}APP_KEY" - sed 's|^APP_KEY=.*|APP_KEY='"$(tr -dc A-Za-z0-9 .env - exit -} - (( ! no_artisan )) && [[ -d vendor ]] && { artisan_down=1 msg "Running: ${c_m}php artisan down" @@ -68,6 +62,15 @@ trap 'error "script killed"' SIGINT SIGQUIT msg "Running: ${c_m}composer installl --no-dev" composer install --no-interaction --no-dev || error "${c_m}composer install --no-interaction --no-dev$c_w exited with an error status" +[[ -f .env ]] && { + while read -r; do + [[ "$REPLY" =~ ^APP_KEY=(.*)$ && -z "${BASH_REMATCH[1]}" ]] && { + msg 'Generating Encryption Key' 'php artisan key:generate' + php artisan key:generate + } + done < .env +} + msg "Running: ${c_m}php artisan route:clear" php artisan route:clear @@ -80,7 +83,7 @@ grep -qe '^CACHE_BUST=' .env || { } msg "Updating ${c_y}CACHE_BUST$c_w variable" -sed -i 's|^CACHE_BUST=.*|CACHE_BUST='"$(tr -dc A-Za-z0-9