Skip to content

Commit

Permalink
Shellcheck fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tomjn committed Sep 18, 2024
1 parent ca011e9 commit 20f2171
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 26 deletions.
12 changes: 6 additions & 6 deletions config/homebin/db_backup
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

Expand All @@ -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 <b>${db_name}</b>" && continue;
Expand All @@ -32,7 +32,7 @@ while read db_name; do
[ "${db_name}" == "wordpress_unit_tests" ] && vvv_info " - skipped <b>${db_name}</b>" && continue;

skip="false"
for exclude in ${exclude_list[@]}; do
for exclude in "${exclude_list[@]}"; do
if [ "${exclude}" == "${db_name}" ]; then
skip="true"
fi
Expand All @@ -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
Expand All @@ -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 <b>database/sql/backups</b><success> folder</success>"
2 changes: 1 addition & 1 deletion config/homebin/db_restore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Restore individual SQL files for each database.
. /srv/database/import-sql.sh
4 changes: 2 additions & 2 deletions config/homebin/is_utility_installed
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion config/homebin/makepot
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion config/homebin/tideways_off
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

switch_php_debugmod none

2 changes: 1 addition & 1 deletion config/homebin/tideways_on
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash
#!/usr/bin/env bash

switch_php_debugmod tideways
2 changes: 1 addition & 1 deletion config/homebin/vagrant
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
echo -e "${PURPLE} Run exit and try again${CRESET}"
6 changes: 3 additions & 3 deletions config/homebin/vagrant_destroy
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions config/homebin/vagrant_halt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions config/homebin/vagrant_suspend
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion config/homebin/xdebug_off
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash
#!/usr/bin/env bash

switch_php_debugmod none
2 changes: 1 addition & 1 deletion config/homebin/xdebug_on
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash
#!/usr/bin/env bash

switch_php_debugmod xdebug
2 changes: 1 addition & 1 deletion provision/core/vvv/provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 20f2171

Please sign in to comment.