Commit dbec7c8c authored by Egor Kremnev's avatar Egor Kremnev

fix scripts

parent d72b4878
#!/usr/bin/env bash #!/usr/bin/env bash
# shellcheck disable=SC2086 # shellcheck disable=SC2086
set -e
echo "================================" echo "================================"
echo "<===== Run apply-update.sh ====>" echo "<===== Run apply-update.sh ====>"
echo "================================" echo "================================"
if [[ "$(id -u)" != "0" ]]; then if [[ "$(id -u)" != "0" ]]; then
echo "This script must be run as root." 1>&2 echo "This script must be run as root." 1>&2
echo "User ${whoami}" echo "User ${whoami}"
exit 1 exit 1
fi fi
set -e
INSTANCE_NAME=${1} INSTANCE_NAME=${1}
LATEST_ARTIFACT_NAME=${2} LATEST_ARTIFACT_NAME=${2}
APPLICATION_ROOT_PATH=${3} APPLICATION_ROOT_PATH=${3}
...@@ -31,11 +32,11 @@ STASH_DB_DIR=/tmp/db/ ...@@ -31,11 +32,11 @@ STASH_DB_DIR=/tmp/db/
STASH_DB_PATH=${STASH_DB_DIR}database.${INSTANCE_NAME}.sqlite STASH_DB_PATH=${STASH_DB_DIR}database.${INSTANCE_NAME}.sqlite
info() { info() {
echo -e "\e[33m[Info] \e[33m$1 \e[39m $(for i in {12..21} ; do echo -en "\e[33;1;${i}m.\e[0m" ; done ; echo)" echo -e "\e[33m[Info] \e[33m$1 \e[39m $(for i in {12..21} ; do echo -en "\e[33;1;${i}m.\e[0m" ; done ; echo)"
} }
success() { success() {
echo -e "\e[32m[Success] \e[32m $1 \e[39m $(for i in {12..21} ; do echo -en "\e[32;1;${i}m.\e[0m" ; done ; echo)" echo -e "\e[32m[Success] \e[32m $1 \e[39m $(for i in {12..21} ; do echo -en "\e[32;1;${i}m.\e[0m" ; done ; echo)"
} }
cd ${APPLICATION_ROOT_PATH} cd ${APPLICATION_ROOT_PATH}
...@@ -44,8 +45,8 @@ mkdir -p ${STASH_DB_DIR} ...@@ -44,8 +45,8 @@ mkdir -p ${STASH_DB_DIR}
info "# Creating backup" info "# Creating backup"
if [[ -f ${DB_PATH} ]]; then if [[ -f ${DB_PATH} ]]; then
info "# Put db to temporary stash" info "# Put db to temporary stash"
cp ${DB_PATH} ${STASH_DB_PATH} cp ${DB_PATH} ${STASH_DB_PATH}
fi fi
mkdir -p ${BACKUP_DIR_PATH} mkdir -p ${BACKUP_DIR_PATH}
......
...@@ -46,5 +46,5 @@ php artisan dusk:chrome-driver ...@@ -46,5 +46,5 @@ php artisan dusk:chrome-driver
nohup bash -c "php artisan serve --env=dusk --port=4343 2>&1 &" && sleep 5 nohup bash -c "php artisan serve --env=dusk --port=4343 2>&1 &" && sleep 5
php artisan dusk php artisan dusk
rm -rf database/database.*.sqlite
success "Completed testing!" success "Completed testing!"
...@@ -11,11 +11,11 @@ VERSION=${2} ...@@ -11,11 +11,11 @@ VERSION=${2}
ENV_NAME=.env.example ENV_NAME=.env.example
info() { info() {
echo -e "\e[33m[Info] \e[33m$1 \e[39m" echo -e "\e[33m[Info] \e[33m$1 \e[39m"
} }
success() { success() {
echo -e "\e[32m[Success] \e[32m $1 \e[39m" echo -e "\e[32m[Success] \e[32m $1 \e[39m"
} }
info "Build version #${VERSION}" info "Build version #${VERSION}"
info "./build.sh starts here..." info "./build.sh starts here..."
......
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