Commit 41f6782f authored by Egor Kremnev's avatar Egor Kremnev

fix scripts

parent d1326914
......@@ -3,13 +3,14 @@
set -e
echo "User ${whoami}"
echo "================================"
echo "<===== Run apply-update.sh ====>"
echo "================================"
if [[ "$(id -u)" != "0" ]]; then
echo "This script must be run as root." 1>&2
echo "User ${whoami}"
exit 1
fi
......@@ -67,26 +68,26 @@ chown root: ${PROJECT_ROOT}/.env
cd ${PROJECT_ROOT}
info "# Set environments"
cp ${PROJECT_ROOT}/.env ${APPLICATION_ROOT_PATH}/.env
source .env
env
sed -i '' 's/^#DB_HOST=/DB_HOST=/g' ".env"
sed -i '' 's/^\(DB_HOST=\).*/\1'$([ -n "$DB_HOST_ENV" ] && echo "$DB_HOST_ENV" || echo "$DB_HOST")'/' ".env"
sed -i '' 's/^\(DB_HOST=\).*/\1'$([ -n "$DB_HOST_ENV" ] && echo "$DB_HOST_ENV" || echo "$DB_HOST")'/' ${APPLICATION_ROOT_PATH}/.env
sed -i '' 's/^#DB_PORT=/DB_PORT=/g' ".env"
sed -i '' 's/^\(DB_PORT=\).*/\1'$([ -n "$DB_PORT_ENV" ] && echo "$DB_PORT_ENV" || echo "$DB_PORT")'/' ".env"
sed -i '' 's/^#DB_DATABASE=/DB_DATABASE=/g' ".env"
sed -i '' 's/^\(DB_DATABASE=\).*/\1'$([ -n "$DB_DATABASE_ENV" ] && echo "$DB_DATABASE_ENV" || echo "$DB_DATABASE")'/' ".env"
sed -i '' 's/^\(DB_PORT=\).*/\1'$([ -n "$DB_PORT_ENV" ] && echo "$DB_PORT_ENV" || echo "$DB_PORT")'/' ${APPLICATION_ROOT_PATH}/.env
sed -i '' 's/^#DB_USERNAME=/DB_USERNAME=/g' ".env"
sed -i '' 's/^\(DB_USERNAME=\).*/\1'$([ -n "$DB_USERNAME_ENV" ] && echo "$DB_USERNAME_ENV" || echo "$DB_USERNAME")'/' ".env"
sed -i '' 's/^\(DB_USERNAME=\).*/\1'$([ -n "$DB_USERNAME_ENV" ] && echo "$DB_USERNAME_ENV" || echo "$DB_USERNAME")'/' ${APPLICATION_ROOT_PATH}/.env
sed -i '' 's/^#DB_PASSWORD=/DB_PASSWORD=/g' ".env"
sed -i '' 's/^\(DB_PASSWORD=\).*/\1'$([ -n "$DB_PASSWORD_ENV" ] && echo "$DB_PASSWORD_ENV" || echo "$DB_PASSWORD")'/' ".env"
sed -i '' 's/^\(DB_PASSWORD=\).*/\1'$([ -n "$DB_PASSWORD_ENV" ] && echo "$DB_PASSWORD_ENV" || echo "$DB_PASSWORD")'/' ${APPLICATION_ROOT_PATH}/.env
cat ${APPLICATION_ROOT_PATH}/.env > ${PROJECT_ROOT}/
info "# Create database backup"
mysqldump -u $([ -n "$DB_DATABASE_ENV" ] && echo "$DB_DATABASE_ENV" || echo "$DB_DATABASE") > DB_DUMP_PATH
mysqldump -u ${DB_DATABASE} > DB_DUMP_PATH
info "# Set application key"
php artisan key:generate
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment