From 4cc258e9ac4ad3a219f7b12897cef5b2ad63ba18 Mon Sep 17 00:00:00 2001 From: Daniel <daniel@harvey> Date: Wed, 8 Apr 2020 11:09:44 +0200 Subject: [PATCH] Fixed a few typos and style changes. --- README_SETUP.md | 22 +++++++++++----------- configure | 2 +- tests/test_utils.sh | 19 ++++++++----------- utils/backup.sh | 14 +++++++------- 4 files changed, 27 insertions(+), 30 deletions(-) diff --git a/README_SETUP.md b/README_SETUP.md index 46d4c43..740734a 100644 --- a/README_SETUP.md +++ b/README_SETUP.md @@ -6,18 +6,18 @@ - make ## Create the configuration -* Create an empty `.config` file. For the default values and the meaning of these default - values see [config.defaults](config.defaults). For each parameter that you - want to change, add a corresponding line in your `.config` file. You probably - want to change the passwords. As plain password are stored in the `.config` file, - make sure nobody else can read it. +* Create an empty `.config` file. For the default values and the meaning of + these default values see [config.defaults](config.defaults). For each + parameter that you want to change, add a corresponding line in your `.config` + file. You probably want to change the passwords. As the passwords are stored + unencrypted in the `.config` file, make sure nobody else can read it. * If there is no `mysql-config-editor` (`MySQL 5.5`. and `MariaDB`) then the - user is needs to provide the `MYSQL_USER_PASSWORD`, that is the password of - the `MYSQL_USER`. - * If you are using MariaDB and the `root` database user uses pam authentication, - no pasword string is required. You can set the `MYSQL_USER_PASSWORD` - to an empty string. But you need to be logged in as root for the - installation and upgrade process. + `MYSQL_USER_PASSWORD` must be provided, that is the password of the + `MYSQL_USER`. + * If you are using MariaDB and the `root` database user uses pam + authentication, no pasword string is required. You can set the + `MYSQL_USER_PASSWORD` to an empty string. But you need to be logged in as + root for the installation and upgrade process. ## Setup the SQL database for CaosDB diff --git a/configure b/configure index 3336e74..01ea52d 100755 --- a/configure +++ b/configure @@ -24,6 +24,6 @@ # Do to the new way environment variables are handled and how config files are # read, this file is obsolete -echo "CURRENTLY NOT SUPPORTET" +echo "CURRENTLY NOT SUPPORTED" exit 1 diff --git a/tests/test_utils.sh b/tests/test_utils.sh index e490fa6..f753958 100755 --- a/tests/test_utils.sh +++ b/tests/test_utils.sh @@ -43,19 +43,17 @@ echo -n 'size of database... ' # check size of database num=$(mysql_execute "SELECT COUNT(*) FROM entities" | sed 's/COUNT(\*)//') if [ $num -gt $MAX_ENTITIES ]; then - echo "There are more than $MAX_ENTITIES entities..."\ + failure "There are more than $MAX_ENTITIES entities... " \ "Do not run this on a production instance!" - exit 1 elif [ $num -lt 5 ]; then - echo "There are less than 5 entities..."\ + failure "There are less than 5 entities... " \ "Please use this with a database with some example content!" - exit 1 fi echo '[Ok]' ############################################################################### # Below we create a dump, then run tests, and create a dump again. Afterwards -# the dumps are checked if they are not empty and whether they differ. +# the dumps are checked if they are not empty and whether they differ. # This should make sure that tests interfere somehow with the real database. # This also provides a very basic test that sql dumps work. ############################################################################### @@ -63,8 +61,7 @@ echo '[Ok]' # creating a dump of current db backupdir=$(realpath 'tmp_backup') if [ -e "$backupdir" ]; then - echo "Temporary directory $backupdir already exists. Please remove it" - exit 1 + failure "Temporary directory $backupdir already exists. Please remove it" fi echo -n 'creating initial dump... ' BACKUPDIR=$backupdir $UTILSPATH/backup.sh > /dev/null @@ -90,10 +87,10 @@ done echo '[Ok]' echo -n 'comparing dumps... ' -if [ ! -z "$(diff *)" ]; then - echo $(diff *) - echo "The second dump differs from the first one. This possibly means that tests changed the real database." - exit 1 +if ! diff -q * > /dev/null ; then + diff * + failure "The second dump differs from the first one. This possibly means " \ + "that tests changed the real database." fi echo '[Ok]' rm -r $backupdir diff --git a/utils/backup.sh b/utils/backup.sh index 4fc133c..bdc345c 100755 --- a/utils/backup.sh +++ b/utils/backup.sh @@ -32,7 +32,7 @@ if [ -z "$UTILSPATH" ]; then fi # The directory which the dump is to be stored to. Do not change it here. Use -# the the environment variable instead. +# the environment variable instead. BACKUPDIR="${BACKUPDIR:-../backup}" # Load settings from .config and defaults ##################################### @@ -48,16 +48,16 @@ function backup() { # Assert backup dir mkdir -p "$backupdir" - datastring=$(date -u --rfc-3339=ns | sed 's/ /T/g') - backupfile=${BACKUPDIR}/${DATABASE_NAME}.${datastring}.dump.sql + datestring=$(date -u --rfc-3339=ns | sed 's/ /T/g') + backupfile=${BACKUPDIR}/${DATABASE_NAME}.${datestring}.dump.sql if [ -e "$backupfile" ]; then - failure "dumpfile already exists." + failure "Dumpfile '$backupfile' already exists." fi - echo "Dumping database $database to $backupfile ... " - $MYSQLDUMP_CMD $(get_mysql_args_nodb) --opt --default-character-set=utf8\ - --routines "$database" > "$backupfile" + echo "Dumping database $database to $backupfile ..." + $MYSQLDUMP_CMD $(get_mysql_args_nodb) --opt --default-character-set=utf8 \ + --routines "$database" > "$backupfile" success } -- GitLab