diff --git a/config/homebin/db_backup b/config/homebin/db_backup index 92669d485..a7244f364 100755 --- a/config/homebin/db_backup +++ b/config/homebin/db_backup @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # Create individual SQL files for each database. These files # are imported automatically during an initial provision if @@ -10,7 +10,7 @@ if [ -z "${VVV_LOG+x}" ]; then export VVV_LOG="" fi -trap 'rm -rf $TMPFIFODIR' EXIT; TMPFIFODIR=$(mktemp -d); mkfifo $TMPFIFODIR/dbnames +trap 'rm -rf $TMPFIFODIR' EXIT; TMPFIFODIR=$(mktemp -d); mkfifo "${TMPFIFODIR}/dbnames" source /srv/provision/provision-helpers.sh @@ -21,7 +21,7 @@ gzip=$(get_config_value "general.db_backup.gzip") exclude_list=$(get_config_values "general.db_backup.exclude") vvv_info " * Fetching Database names" -mysql -e 'show databases' | grep -v -F "Database" > $TMPFIFODIR/dbnames & +mysql -e 'show databases' | grep -v -F "Database" > "${TMPFIFODIR}/dbnames" & while read db_name; do # skip these databases [ "${db_name}" == "mysql" ] && vvv_info " - skipped ${db_name}" && continue; @@ -32,7 +32,7 @@ while read db_name; do [ "${db_name}" == "wordpress_unit_tests" ] && vvv_info " - skipped ${db_name}" && continue; skip="false" - for exclude in ${exclude_list[@]}; do + for exclude in "${exclude_list[@]}"; do if [ "${exclude}" == "${db_name}" ]; then skip="true" fi @@ -51,7 +51,7 @@ while read db_name; do fi fi databases+=( "${db_name}" ) -done < $TMPFIFODIR/dbnames +done < "${TMPFIFODIR}/dbnames" ext=".sql" if [[ "${gzip}" == "True" ]]; then @@ -67,7 +67,7 @@ do else mysqldump "${db}" > "/srv/database/backups/${db}.sql"; fi - let "count=count+1" + count=$((count+1)) done vvv_success " * Finished backing up databases to the database/sql/backups folder" diff --git a/config/homebin/db_restore b/config/homebin/db_restore index 0b969cd70..713a2d4d0 100755 --- a/config/homebin/db_restore +++ b/config/homebin/db_restore @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # Restore individual SQL files for each database. . /srv/database/import-sql.sh diff --git a/config/homebin/is_utility_installed b/config/homebin/is_utility_installed index a131fa433..a6be9fc7b 100755 --- a/config/homebin/is_utility_installed +++ b/config/homebin/is_utility_installed @@ -1,8 +1,8 @@ -#!/bin/bash +#!/usr/bin/env bash utilities=$(shyaml get-values "utilities.${1}" 2> /dev/null < "${VVV_CONFIG}") for utility in ${utilities}; do if [[ "${utility}" == "${2}" ]]; then - exit 0 + exit 0 fi done exit 1 diff --git a/config/homebin/makepot b/config/homebin/makepot index 7b9361b17..b113385de 100755 --- a/config/homebin/makepot +++ b/config/homebin/makepot @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash # Convenience script to run makepot.php php /srv/www/wordpress-develop/tools/i18n/makepot.php $1 $2 $3 $4 diff --git a/config/homebin/tideways_off b/config/homebin/tideways_off index bf7ce5c5c..35606cf4e 100755 --- a/config/homebin/tideways_off +++ b/config/homebin/tideways_off @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash switch_php_debugmod none diff --git a/config/homebin/tideways_on b/config/homebin/tideways_on index 88e0d8535..e2ebc0848 100755 --- a/config/homebin/tideways_on +++ b/config/homebin/tideways_on @@ -1,3 +1,3 @@ -#!/bin/bash +#!/usr/bin/env bash switch_php_debugmod tideways diff --git a/config/homebin/vagrant b/config/homebin/vagrant index 6cf4d405b..f851b178a 100755 --- a/config/homebin/vagrant +++ b/config/homebin/vagrant @@ -12,4 +12,4 @@ echo -e "${YELLOW} █░░█░░░░░░▄▀ ${CRESET}" echo -e "${YELLOW}──────────────────────${CRESET}" echo "" echo -e "${PURPLE} ! You're still SSH'd into the VVV virtual machine!${CRESET}" -echo -e "${PURPLE} Run exit and try again${CRESET}" \ No newline at end of file +echo -e "${PURPLE} Run exit and try again${CRESET}" diff --git a/config/homebin/vagrant_destroy b/config/homebin/vagrant_destroy index 8174ee99f..a59152964 100755 --- a/config/homebin/vagrant_destroy +++ b/config/homebin/vagrant_destroy @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # This script is run whenever `vagrant destroy` is used to destroy # the virtual machine. To customize this behavior, include a file @@ -18,9 +18,9 @@ else fi # Check if backups are turned on or off - run_backups=`cat ${VVV_CONFIG} | shyaml -q get-value general.db_backup.enable` + run_backups=$(cat ${VVV_CONFIG} | shyaml -q get-value general.db_backup.enable) if [[ -z "$run_backups" ]]; then - run_backups=`cat ${VVV_CONFIG} | shyaml -q get-value general.db_backup` + run_backups=$(cat ${VVV_CONFIG} | shyaml -q get-value general.db_backup) fi if [[ $run_backups != "False" ]]; then diff --git a/config/homebin/vagrant_halt b/config/homebin/vagrant_halt index ec4241d0b..7d3940cff 100755 --- a/config/homebin/vagrant_halt +++ b/config/homebin/vagrant_halt @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # This script is run whenever `vagrant halt` is used to power off # the virtual machine. To customize this behavior, include a file @@ -18,9 +18,9 @@ else fi # Check if backups are turned on or off - run_backups=`cat ${VVV_CONFIG} | shyaml -q get-value general.db_backup.enable` + run_backups=$(cat ${VVV_CONFIG} | shyaml -q get-value general.db_backup.enable) if [[ -z "$run_backups" ]]; then - run_backups=`cat ${VVV_CONFIG} | shyaml -q get-value general.db_backup` + run_backups=$(cat ${VVV_CONFIG} | shyaml -q get-value general.db_backup) fi if [[ $run_backups != "False" ]]; then diff --git a/config/homebin/vagrant_suspend b/config/homebin/vagrant_suspend index c5fa47e77..e27df0f93 100755 --- a/config/homebin/vagrant_suspend +++ b/config/homebin/vagrant_suspend @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # This script is run whenever `vagrant suspend` is used to suspend # the virtual machine. To customize this behavior, include a file @@ -18,13 +18,13 @@ else fi # Check if backups are turned on or off - run_backups=`cat ${VVV_CONFIG} | shyaml -q get-value general.db_backup.enable` + run_backups=$(cat ${VVV_CONFIG} | shyaml -q get-value general.db_backup.enable) if [[ -z "$run_backups" ]]; then - run_backups=`cat ${VVV_CONFIG} | shyaml -q get-value general.db_backup` + run_backups=$(cat ${VVV_CONFIG} | shyaml -q get-value general.db_backup) fi if [[ $run_backups != "False" ]]; then - /srv/config/homebin/db_backup + /srv/config/homebin/db_backup fi RED="\033[38;5;9m" diff --git a/config/homebin/xdebug_off b/config/homebin/xdebug_off index c469ddbdd..6b0fb1825 100755 --- a/config/homebin/xdebug_off +++ b/config/homebin/xdebug_off @@ -1,3 +1,3 @@ -#!/bin/bash +#!/usr/bin/env bash switch_php_debugmod none diff --git a/config/homebin/xdebug_on b/config/homebin/xdebug_on index e3f9fe7ae..78d5d0db1 100755 --- a/config/homebin/xdebug_on +++ b/config/homebin/xdebug_on @@ -1,3 +1,3 @@ -#!/bin/bash +#!/usr/bin/env bash switch_php_debugmod xdebug diff --git a/provision/core/vvv/provision.sh b/provision/core/vvv/provision.sh index 65c4024a2..b362a41b9 100644 --- a/provision/core/vvv/provision.sh +++ b/provision/core/vvv/provision.sh @@ -105,7 +105,7 @@ export -f shyaml_setup vvv_add_hook after_packages shyaml_setup 0 function vvv_ntp_restart() { - if [ "${VVV_DOCKER}" != 1 ]; then + if [ ! -f /.dockerenv ]; then service ntp restart fi }