From 652e003f07209e0bbe28a3a9c82e18fcc88da085 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <henrik@trineo.org> Date: Tue, 24 Mar 2020 10:29:59 +0100 Subject: [PATCH] MAINT: moved helper scripts to utils folder --- patches/utils/patch_header.sh | 4 ++-- utils/backup.sh | 11 +++++------ utils.sh => utils/helpers.sh | 0 load_settings.sh => utils/load_settings.sh | 4 ++-- 4 files changed, 9 insertions(+), 10 deletions(-) rename utils.sh => utils/helpers.sh (100%) rename load_settings.sh => utils/load_settings.sh (95%) diff --git a/patches/utils/patch_header.sh b/patches/utils/patch_header.sh index d02f9f9..53a5d57 100644 --- a/patches/utils/patch_header.sh +++ b/patches/utils/patch_header.sh @@ -23,8 +23,8 @@ # #header for patch scripts -. ../../load_settings.sh -. ../../utils.sh +. ../../utils/load_settings.sh +. ../../utils/helpers.sh USAGE="$1 [ --env=ENV_FILE ] [ --patch=PATCH ] [ --backupdir=BACKUPDIR ]\n\n" CMD_OPTIONS=$(cat <<EOF diff --git a/utils/backup.sh b/utils/backup.sh index ff67143..72c9c7e 100755 --- a/utils/backup.sh +++ b/utils/backup.sh @@ -58,12 +58,11 @@ backup: EOF ) -# Config and command line parameter loading ################################### +# Load settings from .config and defaults ##################################### +. ../load_settings.sh -. ../.config - -# load useful stuff - parses the commandline parameters and so on... -. ../patches/utils/patch_header.sh +# load useful functions ####################################################### +. helpers.sh function backup() { NARG_NAME="$1" @@ -75,7 +74,7 @@ function backup() { failure "dumpfile already exists." fi echo "Dumping database $NARG_NAME to $NARG_FILE ... " - $CMD_MYSQL_DUMP $MYSQL_CONNECTION_NO_DB $* --opt --default-character-set=utf8 --routines \ + $MYSQLDUMP_CMD $MYSQL_CONNECTION_NO_DB $* --opt --default-character-set=utf8 --routines \ "$NARG_NAME" > "$NARG_FILE" if [[ "$YAML" == "true" ]] ; then diff --git a/utils.sh b/utils/helpers.sh similarity index 100% rename from utils.sh rename to utils/helpers.sh diff --git a/load_settings.sh b/utils/load_settings.sh similarity index 95% rename from load_settings.sh rename to utils/load_settings.sh index d26b296..461e3ee 100644 --- a/load_settings.sh +++ b/utils/load_settings.sh @@ -18,8 +18,8 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <https://www.gnu.org/licenses/>. -[[ -n "config.defaults" ]] && source "config.defaults" -[[ -n ".config" ]] && source ".config" +[[ -n "../config.defaults" ]] && source "../config.defaults" +[[ -n "../.config" ]] && source "../.config" [[ -n "$ENV_FILE" ]] && source "$ENV_FILE" if [[ -z "$DATABASE_NAME" && -z "$MYSQL_CONNECTION" ]] -- GitLab