diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..cbb3a13
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+*.rpm
+*.log
+*spec-20*
+*.tar.gz
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..035ef59
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,21 @@
+# Makefile for source rpm: smeserver-automysqlbackup
+# $Id: Makefile,v 1.1 2021/01/28 14:22:52 brianr Exp $
+NAME := smeserver-automysqlbackup
+SPECFILE = $(firstword $(wildcard *.spec))
+
+define find-makefile-common
+for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
+endef
+
+MAKEFILE_COMMON := $(shell $(find-makefile-common))
+
+ifeq ($(MAKEFILE_COMMON),)
+# attept a checkout
+define checkout-makefile-common
+test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
+endef
+
+MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
+endif
+
+include $(MAKEFILE_COMMON)
diff --git a/README.md b/README.md
index 1d68d50..7256799 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,15 @@
-# smeserver-automysqlbackup
+# smeserver-automysqlbackup
-SMEServer Koozali developed git repo for smeserver-automysqlbackup smecontribs
\ No newline at end of file
+SMEServer Koozali developed git repo for smeserver-automysqlbackup smecontribs
+
+## Wiki
+
https://wiki.koozali.org/AutoMysqlBackup
+
+## Bugzilla
+Show list of outstanding bugs: [here](https://bugs.koozali.org/buglist.cgi?component=smeserver-automysqlbackup&product=SME%20Contribs&query_format=advanced&limit=0&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=CONFIRMED)
+
+## Description
+
+
*This description has been generated by an LLM AI system and cannot be relied on to be fully correct.*
+*Once it has been checked, then this comment will be deleted*
+
diff --git a/additional/CHANGELOG.git b/additional/CHANGELOG.git
new file mode 100644
index 0000000..c08ffd1
--- /dev/null
+++ b/additional/CHANGELOG.git
@@ -0,0 +1,35 @@
+commit a024bf4f004ba017718344b0a9eb7b5ed0156421
+Author: Stephane de Labrusse
+Date: Sun Aug 17 22:32:37 2014 +0200
+
+ added my own patch against --events warning
+
+commit e71becc50d7cee6c379d0438043e48809d0ed246
+Author: Stephane de Labrusse
+Date: Sun May 18 11:47:58 2014 +0200
+
+ added all files to git
+
+commit da5aba0ea2abe63fd34f45f4c29889be5859721c
+Author: Stephane de Labrusse
+Date: Mon Mar 31 18:19:09 2014 +0200
+
+ #renamed: smeserver-automysqlbackup-3.0.RC6.spec -> smeserver-automysqlbackup.spec
+
+commit 7d8485b7130ceb8715fa07a457656f5582537f81
+Author: Stephane de Labrusse
+Date: Sat Mar 29 20:35:41 2014 +0100
+
+ added .gitignore to empty folders
+
+commit c9af02fe9f5e9f28d8b5e9a3e2aa4b451e6c0d7d
+Author: Stephane de Labrusse
+Date: Fri Mar 28 20:53:16 2014 +0100
+
+ initial release
+
+commit 47c18db2cbc36a505b03759e4ced97acce9face7
+Author: Stéphane de Labrusse
+Date: Fri Mar 28 07:47:25 2014 -0700
+
+ Initial commit
diff --git a/additional/README.md b/additional/README.md
new file mode 100644
index 0000000..d92b616
--- /dev/null
+++ b/additional/README.md
@@ -0,0 +1,2 @@
+smeserver-automysqlbackup
+=========================
diff --git a/additional/smeserver-automysqlbackup.spec b/additional/smeserver-automysqlbackup.spec
new file mode 100644
index 0000000..a429021
--- /dev/null
+++ b/additional/smeserver-automysqlbackup.spec
@@ -0,0 +1,133 @@
+%define name smeserver-automysqlbackup
+%define version 3.0.RC6
+%define release 4
+%define rpmver 3.0.RC6
+
+
+Summary: automysqlbackup is a script to backup your msql database on sme8
+Name: %{name}
+Version: %{version}
+Release: %{release}%{?dist}
+License: GPL
+Group: /Web/Application
+Source: %{name}-%{version}.tar.gz
+URL: http://sourceforge.net/projects/automysqlbackup/
+BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot
+BuildArchitectures: noarch
+Requires: e-smith-base, e-smith-release >= 8
+Requires: pax
+Requires: automysqlbackup
+BuildRequires: e-smith-devtools
+
+%description
+This RPM is an unofficial addon for the SME Server 8.x.
+The target audience is the Linux/E-smith administrator
+who wants to backup their mysql databases with an automatic way.
+This script is based on automysqlbackup V3.0
+
+
+
+%changelog
+* Sun Aug 17 2014 Stephane de Labrusse 3.0.RC6-4
+- added my own patch against the --events warning
+--Warning: Skipping the data of table mysql.event. Specify the --events option explicitly.
+
+* Sun Oct 27 2013 Stephane de Labrusse 3.0.RC6.3
+- split the contrib in two versions smeserver-automysqlbackup and automysqlbackup
+* Mon Apr 22 2013 Stephane de Labrusse
+- [3.0.RC6] version Based on automysqlbackup V3.0 RC6
+* Mon Apr 08 2013 Stephane de Labrusse
+- [0.01] Initial version Based on automysqlbackup V3.0 RC6
+
+%prep
+rm -rf $RPM_BUILD_ROOT
+
+%setup
+
+%build
+
+%install
+/bin/rm -rf $RPM_BUILD_ROOT
+(cd root ;/usr/bin/find . -depth -print | /bin/cpio -dump $RPM_BUILD_ROOT)
+/bin/rm -f %{name}-%{version}-filelist
+/sbin/e-smith/genfilelist $RPM_BUILD_ROOT > %{name}-%{version}-filelist
+
+
+%files -f %{name}-%{version}-filelist
+
+%defattr(-,root,root)
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%pre
+
+%post
+SMEDB=automysqlbackup
+MYSQLUSER=backupuser
+# Expland template
+/etc/e-smith/events/actions/initialize-default-databases
+
+echo "========================================================================================="
+echo " Your Databases are saved in /root/backup/db "
+echo " only Root can access to these folders"
+echo " a mail is send to Admin for all logs "
+echo " "
+echo " Configuration file is /etc/automysqlbackup/myserver.conf"
+echo " "
+echo " For a manual play you can use directly"
+echo " automysqlbackup /etc/automysqlbackup/myserver.conf "
+echo " else backups are done every night at 04H00 AM with /etc/cron.daily/runmysqlbackup"
+echo "========================================================================================="
+echo " RESTORING"
+echo " In a root terminal"
+echo " cd /root/backup/db/ and choose your backup"
+echo " gunzip file-name.sql.gz"
+echo " Next you will need to use the mysql client to restore the DB from the sql file."
+echo " mysql database < /path/file.sql"
+echo " NOTE: Make sure you use < and not > in the above command because you are piping the file.sql"
+echo " to mysql and not the other way around"
+echo "========================================================================================="
+echo " Some db configuration for handle this contrib"
+echo " Mailcontent (stdout/log/files/quiet)"
+echo " # What would you like to be mailed to you?"
+echo " # - log : send only log file (default)"
+echo " # - files : send log file and sql files as attachments (see docs)"
+echo " #- stdout : will simply output the log to the screen if run manually."
+echo " #- quiet : Only send logs if an error occurs to the MAILADDR."
+echo " Sizemail=8000 (bytes)"
+echo " Mailto=root (or any other user@domaine.com)"
+echo " Backupdir=path to the folder where mysql files are saved"
+echo " "
+echo " ex: config setprop automysqlbackup Mailcontent files"
+echo "========================================================================================="
+
+
+
+#create backupuser and give rights
+MYSQLPASS=$(/sbin/e-smith/config getprop $SMEDB DbPassword)
+mysql -e " GRANT EVENT,SELECT,LOCK TABLES ON *.* TO $MYSQLUSER@'localhost' "
+mysql -u root -e "SET PASSWORD FOR $MYSQLUSER@localhost = PASSWORD( '$MYSQLPASS' ) "
+mysqladmin flush-privileges
+/etc/rc.d/init.d/mysql.init start
+
+#protect the backup folder
+chmod -R 700 /root/backup/db
+
+%preun
+%postun
+if [ $1 = 0 ] ; then
+SMEDB=automysqlbackup
+MYSQLUSER=backupuser
+echo "======================================================================="
+echo " delete mysql user and revoque all permissions"
+# This section deletes backupuser
+mysql -u root -e "REVOKE ALL PRIVILEGES ON *.* FROM '$MYSQLUSER'@'localhost';"
+mysql -u root -e "DROP USER $MYSQLUSER@localhost;"
+echo " "
+# Delete custom template fragment
+echo " delete db configuration automysqlbackup"
+echo "======================================================================="
+
+/sbin/e-smith/config delete $SMEDB
+fi
diff --git a/contriborbase b/contriborbase
new file mode 100644
index 0000000..9b7fd51
--- /dev/null
+++ b/contriborbase
@@ -0,0 +1 @@
+contribs10
diff --git a/createlinks b/createlinks
new file mode 100644
index 0000000..48d23ce
--- /dev/null
+++ b/createlinks
@@ -0,0 +1,53 @@
+#!/usr/bin/perl -w
+
+use esmith::Build::CreateLinks qw(:all);
+
+####################
+# links to add
+
+# templates to expand
+
+foreach (qw(
+ /etc/cron.d/runmysqlbackup
+ /etc/automysqlbackup/mysql57.conf
+ /etc/automysqlbackup/mymaria.conf
+ /etc/automysqlbackup/mymaria101.conf
+ /etc/automysqlbackup/mymaria102.conf
+ /etc/automysqlbackup/mymaria103.conf
+ /etc/automysqlbackup/mymaria105.conf
+ /etc/e-smith/sql/init/automysqlbackup
+ /etc/e-smith/sql/init57/automysqlbackup
+ /etc/e-smith/sql/init101/automysqlbackup
+ /etc/e-smith/sql/init102/automysqlbackup
+ /etc/e-smith/sql/init103/automysqlbackup
+ /etc/e-smith/sql/init105/automysqlbackup
+ ))
+{
+ templates2events(
+ "$_", qw(
+ smeserver-automysqlbackup-update
+ console-save
+ bootstrap-console-save
+ )
+ );
+}
+
+# Not required I think
+
+# add action /etc/e-smith/events/actions/automysqlbackup to automysqlbackup-update bootstrap-console-save
+#foreach my $event (qw( smeserver-automysqlbackup-update
+# bootstrap-console-save))
+# {
+# event_link("automysqlbackup", $event, "15");
+#}
+
+# add mysql.init restart to automysqlbackup-update
+foreach my $event (qw( smeserver-automysqlbackup-update))
+ {
+ safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/mysql.init");
+ safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/mariadb57-mysql.init");
+ safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/mariadb101-mysql.init");
+ safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/mariadb102-mysql.init");
+ safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/mariadb103-mysql.init");
+ safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/mariadb105-mysql.init");
+}
diff --git a/root/etc/automysqlbackup/automysqlbackup.conf b/root/etc/automysqlbackup/automysqlbackup.conf
new file mode 100644
index 0000000..33812ff
--- /dev/null
+++ b/root/etc/automysqlbackup/automysqlbackup.conf
@@ -0,0 +1,261 @@
+#version=3.0_rc2
+# DONT'T REMOVE THE PREVIOUS VERSION LINE!
+#
+# Uncomment to change the default values (shown after =)
+# WARNING:
+# This is not true for UMASK, CONFIG_prebackup and CONFIG_postbackup!!!
+#
+# Default values are stored in the script itself. Declarations in
+# /etc/automysqlbackup/automysqlbackup.conf will overwrite them. The
+# declarations in here will supersede all other.
+
+# Edit $PATH if mysql and mysqldump are not located in /usr/local/bin:/usr/bin:/bin:/usr/local/mysql/bin
+#PATH=${PATH}:FULL_PATH_TO_YOUR_DIR_CONTAINING_MYSQL:FULL_PATH_TO_YOUR_DIR_CONTAINING_MYSQLDUMP
+
+# Basic Settings
+
+# Username to access the MySQL server e.g. dbuser
+#CONFIG_mysql_dump_username='root'
+
+# Password to access the MySQL server e.g. password
+#CONFIG_mysql_dump_password=''
+
+# Host name (or IP address) of MySQL server e.g localhost
+#CONFIG_mysql_dump_host='localhost'
+
+# "Friendly" host name of MySQL server to be used in email log
+# if unset or empty (default) will use CONFIG_mysql_dump_host instead
+#CONFIG_mysql_dump_host_friendly=''
+
+# Backup directory location e.g /backups
+#CONFIG_backup_dir='/var/backup/db'
+
+# This is practically a moot point, since there is a fallback to the compression
+# functions without multicore support in the case that the multicore versions aren't
+# present in the system. Of course, if you have the latter installed, but don't want
+# to use them, just choose no here.
+# pigz -> gzip
+# pbzip2 -> bzip2
+#CONFIG_multicore='yes'
+
+# Number of threads (= occupied cores) you want to use. You should - for the sake
+# of the stability of your system - not choose more than (#number of cores - 1).
+# Especially if the script is run in background by cron and the rest of your system
+# has already heavy load, setting this too high, might crash your system. Assuming
+# all systems have at least some sort of HyperThreading, the default is 2 threads.
+# If you wish to let pigz and pbzip2 autodetect or use their standards, set it to
+# 'auto'.
+#CONFIG_multicore_threads=2
+
+# Databases to backup
+
+# List of databases for Daily/Weekly Backup e.g. ( 'DB1' 'DB2' 'DB3' ... )
+# set to (), i.e. empty, if you want to backup all databases
+#CONFIG_db_names=()
+# You can use
+#declare -a MDBNAMES=( "${DBNAMES[@]}" 'added entry1' 'added entry2' ... )
+# INSTEAD to copy the contents of $DBNAMES and add further entries (optional).
+
+# List of databases for Monthly Backups.
+# set to (), i.e. empty, if you want to backup all databases
+#CONFIG_db_month_names=()
+
+# List of DBNAMES to EXLUCDE if DBNAMES is empty, i.e. ().
+#CONFIG_db_exclude=( 'information_schema' )
+
+# List of tables to exclude, in the form db_name.table_name
+# You may use wildcards for the table names, i.e. 'mydb.a*' selects all tables starting with an 'a'.
+# However we only offer the wildcard '*', matching everything that could appear, which translates to the
+# '%' wildcard in mysql.
+#CONFIG_table_exclude=()
+
+
+# Advanced Settings
+
+# Rotation Settings
+
+# Which day do you want monthly backups? (01 to 31)
+# If the chosen day is greater than the last day of the month, it will be done
+# on the last day of the month.
+# Set to 0 to disable monthly backups.
+#CONFIG_do_monthly="01"
+
+# Which day do you want weekly backups? (1 to 7 where 1 is Monday)
+# Set to 0 to disable weekly backups.
+#CONFIG_do_weekly="5"
+
+# Set rotation of daily backups. VALUE*24hours
+# If you want to keep only today's backups, you could choose 1, i.e. everything older than 24hours will be removed.
+#CONFIG_rotation_daily=6
+
+# Set rotation for weekly backups. VALUE*24hours
+#CONFIG_rotation_weekly=35
+
+# Set rotation for monthly backups. VALUE*24hours
+#CONFIG_rotation_monthly=150
+
+
+# Server Connection Settings
+
+# Set the port for the mysql connection
+#CONFIG_mysql_dump_port=3306
+
+# Compress communications between backup server and MySQL server?
+#CONFIG_mysql_dump_commcomp='no'
+
+# Use ssl encryption with mysqldump?
+#CONFIG_mysql_dump_usessl='yes'
+
+# For connections to localhost. Sometimes the Unix socket file must be specified.
+#CONFIG_mysql_dump_socket=''
+
+# The maximum size of the buffer for client/server communication. e.g. 16MB (maximum is 1GB)
+#CONFIG_mysql_dump_max_allowed_packet=''
+
+# This option sends a START TRANSACTION SQL statement to the server before dumping data. It is useful only with
+# transactional tables such as InnoDB, because then it dumps the consistent state of the database at the time
+# when BEGIN was issued without blocking any applications.
+#
+# When using this option, you should keep in mind that only InnoDB tables are dumped in a consistent state. For
+# example, any MyISAM or MEMORY tables dumped while using this option may still change state.
+#
+# While a --single-transaction dump is in process, to ensure a valid dump file (correct table contents and
+# binary log coordinates), no other connection should use the following statements: ALTER TABLE, CREATE TABLE,
+# DROP TABLE, RENAME TABLE, TRUNCATE TABLE. A consistent read is not isolated from those statements, so use of
+# them on a table to be dumped can cause the SELECT that is performed by mysqldump to retrieve the table
+# contents to obtain incorrect contents or fail.
+#CONFIG_mysql_dump_single_transaction='no'
+
+# http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html#option_mysqldump_master-data
+# --master-data[=value]
+# Use this option to dump a master replication server to produce a dump file that can be used to set up another
+# server as a slave of the master. It causes the dump output to include a CHANGE MASTER TO statement that indicates
+# the binary log coordinates (file name and position) of the dumped server. These are the master server coordinates
+# from which the slave should start replicating after you load the dump file into the slave.
+#
+# If the option value is 2, the CHANGE MASTER TO statement is written as an SQL comment, and thus is informative only;
+# it has no effect when the dump file is reloaded. If the option value is 1, the statement is not written as a comment
+# and takes effect when the dump file is reloaded. If no option value is specified, the default value is 1.
+#
+# This option requires the RELOAD privilege and the binary log must be enabled.
+#
+# The --master-data option automatically turns off --lock-tables. It also turns on --lock-all-tables, unless
+# --single-transaction also is specified, in which case, a global read lock is acquired only for a short time at the
+# beginning of the dump (see the description for --single-transaction). In all cases, any action on logs happens at
+# the exact moment of the dump.
+# ==================================================================================================================
+# possible values are 1 and 2, which correspond with the values from mysqldump
+# VARIABLE= , i.e. no value, turns it off (default)
+#
+#CONFIG_mysql_dump_master_data=
+
+# Included stored routines (procedures and functions) for the dumped databases in the output. Use of this option
+# requires the SELECT privilege for the mysql.proc table. The output generated by using --routines contains
+# CREATE PROCEDURE and CREATE FUNCTION statements to re-create the routines. However, these statements do not
+# include attributes such as the routine creation and modification timestamps. This means that when the routines
+# are reloaded, they will be created with the timestamps equal to the reload time.
+#
+# If you require routines to be re-created with their original timestamp attributes, do not use --routines. Instead,
+# dump and reload the contents of the mysql.proc table directly, using a MySQL account that has appropriate privileges
+# for the mysql database.
+#
+# This option was added in MySQL 5.0.13. Before that, stored routines are not dumped. Routine DEFINER values are not
+# dumped until MySQL 5.0.20. This means that before 5.0.20, when routines are reloaded, they will be created with the
+# definer set to the reloading user. If you require routines to be re-created with their original definer, dump and
+# load the contents of the mysql.proc table directly as described earlier.
+#
+#CONFIG_mysql_dump_full_schema='yes'
+
+# Backup status of table(s) in textfile. This is very helpful when restoring backups, since it gives an idea, what changed
+# in the meantime.
+#CONFIG_mysql_dump_dbstatus='yes'
+
+# Backup dump settings
+
+# Include CREATE DATABASE in backup?
+#CONFIG_mysql_dump_create_database='no'
+
+# Separate backup directory and file for each DB? (yes or no)
+#CONFIG_mysql_dump_use_separate_dirs='yes'
+
+# Choose Compression type. (gzip or bzip2)
+#CONFIG_mysql_dump_compression='gzip'
+
+# Store an additional copy of the latest backup to a standard
+# location so it can be downloaded by third party scripts.
+#CONFIG_mysql_dump_latest='no'
+
+# Remove all date and time information from the filenames in the latest folder.
+# Runs, if activated, once after the backups are completed. Practically it just finds all files in the latest folder
+# and removes the date and time information from the filenames (if present).
+#CONFIG_mysql_dump_latest_clean_filenames='no'
+
+# Create differential backups. Master backups are created weekly at #$CONFIG_do_weekly weekday. Between master backups,
+# diff is used to create differential backups relative to the latest master backup. In the Manifest file, you find the
+# following structure
+# $filename md5sum $md5sum diff_id $diff_id rel_id $rel_id
+# where each field is separated by the tabular character '\t'. The entries with $ at the beginning mean the actual values,
+# while the others are just for readability. The diff_id is the id of the differential or master backup which is also in
+# the filename after the last _ and before the suffixes begin, i.e. .diff, .sql and extensions. It is used to relate
+# differential backups to master backups. The master backups have 0 as $rel_id and are thereby identifiable. Differential
+# backups have the id of the corresponding master backup as $rel_id.
+#
+# To ensure that master backups are kept long enough, the value of $CONFIG_rotation_daily is set to a minimum of 21 days.
+#
+#CONFIG_mysql_dump_differential='no'
+
+
+# Notification setup
+
+# What would you like to be mailed to you?
+# - log : send only log file
+# - files : send log file and sql files as attachments (see docs)
+# - stdout : will simply output the log to the screen if run manually.
+# - quiet : Only send logs if an error occurs to the MAILADDR.
+#CONFIG_mailcontent='stdout'
+
+# Set the maximum allowed email size in k. (4000 = approx 5MB email [see docs])
+#CONFIG_mail_maxattsize=4000
+
+# Allow packing of files with tar and splitting it in pieces of CONFIG_mail_maxattsize.
+#CONFIG_mail_splitandtar='yes'
+
+# Use uuencode instead of mutt. WARNING: Not all email clients work well with uuencoded attachments.
+#CONFIG_mail_use_uuencoded_attachments='no'
+
+# Email Address to send mail to? (user@domain.com)
+#CONFIG_mail_address='root'
+
+
+# Encryption
+
+# Do you wish to encrypt your backups using openssl?
+#CONFIG_encrypt='no'
+
+# Choose a password to encrypt the backups.
+#CONFIG_encrypt_password='password0123'
+
+# Other
+
+# Backup local files, i.e. maybe you would like to backup your my.cnf (mysql server configuration), etc.
+# These files will be tar'ed, depending on your compression option CONFIG_mysql_dump_compression compressed and
+# depending on the option CONFIG_encrypt encrypted.
+#
+# Note: This could also have been accomplished with CONFIG_prebackup or CONFIG_postbackup.
+#CONFIG_backup_local_files=()
+
+# Command to run before backups (uncomment to use)
+#CONFIG_prebackup="/etc/mysql-backup-pre"
+
+# Command run after backups (uncomment to use)
+#CONFIG_postbackup="/etc/mysql-backup-post"
+
+# Uncomment to activate! This will give folders rwx------
+# and files rw------- permissions.
+#umask 0077
+
+# dry-run, i.e. show what you are gonna do without actually doing it
+# inactive: =0 or commented out
+# active: uncommented AND =1
+#CONFIG_dryrun=1
+
diff --git a/root/etc/e-smith/db/configuration/defaults/automysqlbackup/Backup_local_files b/root/etc/e-smith/db/configuration/defaults/automysqlbackup/Backup_local_files
new file mode 100644
index 0000000..e69de29
diff --git a/root/etc/e-smith/db/configuration/defaults/automysqlbackup/Backupdir b/root/etc/e-smith/db/configuration/defaults/automysqlbackup/Backupdir
new file mode 100644
index 0000000..0634091
--- /dev/null
+++ b/root/etc/e-smith/db/configuration/defaults/automysqlbackup/Backupdir
@@ -0,0 +1 @@
+/root/backup/db
diff --git a/root/etc/e-smith/db/configuration/defaults/automysqlbackup/Dbencrypt_password b/root/etc/e-smith/db/configuration/defaults/automysqlbackup/Dbencrypt_password
new file mode 100644
index 0000000..cfc9590
--- /dev/null
+++ b/root/etc/e-smith/db/configuration/defaults/automysqlbackup/Dbencrypt_password
@@ -0,0 +1 @@
+01234567899876543210
diff --git a/root/etc/e-smith/db/configuration/defaults/automysqlbackup/Encrypt b/root/etc/e-smith/db/configuration/defaults/automysqlbackup/Encrypt
new file mode 100644
index 0000000..7ecb56e
--- /dev/null
+++ b/root/etc/e-smith/db/configuration/defaults/automysqlbackup/Encrypt
@@ -0,0 +1 @@
+no
diff --git a/root/etc/e-smith/db/configuration/defaults/automysqlbackup/Hour b/root/etc/e-smith/db/configuration/defaults/automysqlbackup/Hour
new file mode 100644
index 0000000..b8626c4
--- /dev/null
+++ b/root/etc/e-smith/db/configuration/defaults/automysqlbackup/Hour
@@ -0,0 +1 @@
+4
diff --git a/root/etc/e-smith/db/configuration/defaults/automysqlbackup/Mailcontent b/root/etc/e-smith/db/configuration/defaults/automysqlbackup/Mailcontent
new file mode 100644
index 0000000..6bfe6b1
--- /dev/null
+++ b/root/etc/e-smith/db/configuration/defaults/automysqlbackup/Mailcontent
@@ -0,0 +1 @@
+log
diff --git a/root/etc/e-smith/db/configuration/defaults/automysqlbackup/Mailto b/root/etc/e-smith/db/configuration/defaults/automysqlbackup/Mailto
new file mode 100644
index 0000000..d8649da
--- /dev/null
+++ b/root/etc/e-smith/db/configuration/defaults/automysqlbackup/Mailto
@@ -0,0 +1 @@
+root
diff --git a/root/etc/e-smith/db/configuration/defaults/automysqlbackup/Minute b/root/etc/e-smith/db/configuration/defaults/automysqlbackup/Minute
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/root/etc/e-smith/db/configuration/defaults/automysqlbackup/Minute
@@ -0,0 +1 @@
+1
diff --git a/root/etc/e-smith/db/configuration/defaults/automysqlbackup/Sizemail b/root/etc/e-smith/db/configuration/defaults/automysqlbackup/Sizemail
new file mode 100644
index 0000000..e002b36
--- /dev/null
+++ b/root/etc/e-smith/db/configuration/defaults/automysqlbackup/Sizemail
@@ -0,0 +1 @@
+8000
diff --git a/root/etc/e-smith/db/configuration/defaults/automysqlbackup/type b/root/etc/e-smith/db/configuration/defaults/automysqlbackup/type
new file mode 100644
index 0000000..24e1098
--- /dev/null
+++ b/root/etc/e-smith/db/configuration/defaults/automysqlbackup/type
@@ -0,0 +1 @@
+service
diff --git a/root/etc/e-smith/db/configuration/migrate/85automysqlbackup b/root/etc/e-smith/db/configuration/migrate/85automysqlbackup
new file mode 100644
index 0000000..71798a4
--- /dev/null
+++ b/root/etc/e-smith/db/configuration/migrate/85automysqlbackup
@@ -0,0 +1,17 @@
+{
+
+my $rec = $DB->get('automysqlbackup') || $DB->new_record('automysqlbackup', { type => 'webapp' });
+my $pw = $rec->prop('DbPassword');
+
+if (not $pw){
+ $pw = `/usr/bin/openssl rand -base64 60 | tr -c -d '[:graph:]'`;
+ chomp($pw);
+ $rec->set_prop('DbPassword', $pw);
+}
+
+# if mysql53 exists; ie before tidying the contrib : there is no mysql53 on SME, 5.1 or 5.5
+#delete Mymaria Mysql53 Mysql55 Mysql57; so we use the default as hardcoded in scripts
+if ( defined $rec->prop('Mysql53') ){
+ $rec->delete_prop($_) for ( qw(Mymaria Mysql53 Mysql55 Mysql57) );
+}
+}
diff --git a/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init/automysqlbackup b/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init/automysqlbackup
new file mode 100644
index 0000000..940dcf3
--- /dev/null
+++ b/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init/automysqlbackup
@@ -0,0 +1 @@
+PERMS=0750
diff --git a/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init101/automysqlbackup b/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init101/automysqlbackup
new file mode 100644
index 0000000..940dcf3
--- /dev/null
+++ b/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init101/automysqlbackup
@@ -0,0 +1 @@
+PERMS=0750
diff --git a/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init102/automysqlbackup b/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init102/automysqlbackup
new file mode 100644
index 0000000..940dcf3
--- /dev/null
+++ b/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init102/automysqlbackup
@@ -0,0 +1 @@
+PERMS=0750
diff --git a/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init103/automysqlbackup b/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init103/automysqlbackup
new file mode 100644
index 0000000..940dcf3
--- /dev/null
+++ b/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init103/automysqlbackup
@@ -0,0 +1 @@
+PERMS=0750
diff --git a/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init105/automysqlbackup b/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init105/automysqlbackup
new file mode 100644
index 0000000..940dcf3
--- /dev/null
+++ b/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init105/automysqlbackup
@@ -0,0 +1 @@
+PERMS=0750
diff --git a/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init55/automysqlbackup b/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init55/automysqlbackup
new file mode 100644
index 0000000..940dcf3
--- /dev/null
+++ b/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init55/automysqlbackup
@@ -0,0 +1 @@
+PERMS=0750
diff --git a/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init57/automysqlbackup b/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init57/automysqlbackup
new file mode 100644
index 0000000..940dcf3
--- /dev/null
+++ b/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init57/automysqlbackup
@@ -0,0 +1 @@
+PERMS=0750
diff --git a/root/etc/e-smith/templates/etc/automysqlbackup/mymaria.conf/10start b/root/etc/e-smith/templates/etc/automysqlbackup/mymaria.conf/10start
new file mode 100644
index 0000000..b23b68f
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/automysqlbackup/mymaria.conf/10start
@@ -0,0 +1,31 @@
+{
+my $mymaria = ${'mariadb'}{'status'} || 'disabled';
+my $myauto = ${'automysqlbackup'}{'Mymaria'} || 'enabled';
+our $status = ( $mymaria eq 'enabled' && $myauto eq 'enabled' ) ? 'enabled' : 'disabled';
+my $debug = ${'automysqlbackup'}{'debug'} || 'disabled';
+
+if ($status eq 'enabled') {
+$OUT .= <<'_EOF';
+#version=3.0_RC6
+# DON'T REMOVE THE PREVIOUS VERSION LINE!
+CONFIG_mysql_dump_username='backupuser'
+CONFIG_mysql_dump_password=$PWDMYSQL
+CONFIG_mysql_dump_host_friendly=$SYSTEMNAME
+CONFIG_mysql_dump_create_database='yes'
+_EOF
+
+if ($debug eq 'enabled') {
+ $OUT .= "# Debug enabled\n";
+ $OUT .= "CONFIG_debug=\'1\'\n";
+}
+
+}
+else {
+$OUT .= "#version=3.0_RC6\n";
+$OUT .= "# DON'T REMOVE THE PREVIOUS VERSION LINE!\n";
+$OUT .= "# Automysqlbackup disabled\n";
+$OUT .= "# To enable:";
+$OUT .= "# config setprop automysqlbackup Mymaria enabled\n";
+$OUT .= "# signal-event automysqlbackup-update\n";
+}
+}
diff --git a/root/etc/e-smith/templates/etc/automysqlbackup/mymaria.conf/20db b/root/etc/e-smith/templates/etc/automysqlbackup/mymaria.conf/20db
new file mode 100644
index 0000000..a6c5bc0
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/automysqlbackup/mymaria.conf/20db
@@ -0,0 +1,12 @@
+{
+if ($status eq 'enabled') {
+$OUT .= <<'_EOF';
+# DB Specific
+CONFIG_backup_dir=${BACKUPDIR}_mymaria
+CONFIG_mysql_dump_full_schema='no'
+CONFIG_db_exclude=( 'performance_schema' 'information_schema' 'sys' )
+CONFIG_mysql_dump_socket='/var/lib/mysql/mysql.sock'
+# End
+_EOF
+}
+}
diff --git a/root/etc/e-smith/templates/etc/automysqlbackup/mymaria.conf/30end b/root/etc/e-smith/templates/etc/automysqlbackup/mymaria.conf/30end
new file mode 100644
index 0000000..1dede84
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/automysqlbackup/mymaria.conf/30end
@@ -0,0 +1,14 @@
+{
+if ($status eq 'enabled') {
+$OUT .= <<'_EOF';
+CONFIG_mailcontent=$MAILCONTENT
+CONFIG_mail_maxattsize=$SIZEMAIL
+CONFIG_mail_splitandtar='yes'
+CONFIG_mail_address=$MAILTO
+CONFIG_encrypt=$ENCRYPT
+CONFIG_encrypt_password=$DBENCRYPT_PASSWORD
+CONFIG_backup_local_files=($BACKUP_LOCAL_FILES)
+umask 0077
+_EOF
+}
+}
diff --git a/root/etc/e-smith/templates/etc/automysqlbackup/mymaria101.conf/10start b/root/etc/e-smith/templates/etc/automysqlbackup/mymaria101.conf/10start
new file mode 100644
index 0000000..3ac2b48
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/automysqlbackup/mymaria101.conf/10start
@@ -0,0 +1,31 @@
+{
+my $mymaria = ${'mariadb101-mariadb'}{'status'} || 'disabled';
+my $myauto = ${'automysqlbackup'}{'Mymaria101'} || 'enabled';
+our $status = ( $mymaria eq 'enabled' && $myauto eq 'enabled' ) ? 'enabled' : 'disabled';
+my $debug = ${'automysqlbackup'}{'debug'} || 'disabled';
+
+if ($status eq 'enabled') {
+$OUT .= <<'_EOF';
+#version=3.0_RC6
+# DON'T REMOVE THE PREVIOUS VERSION LINE!
+CONFIG_mysql_dump_username='backupuser'
+CONFIG_mysql_dump_password=$PWDMYSQL
+CONFIG_mysql_dump_host_friendly=$SYSTEMNAME
+CONFIG_mysql_dump_create_database='yes'
+_EOF
+
+if ($debug eq 'enabled') {
+ $OUT .= "# Debug enabled\n";
+ $OUT .= "CONFIG_debug=\'1\'\n";
+}
+
+}
+else {
+$OUT .= "#version=3.0_RC6\n";
+$OUT .= "# DON'T REMOVE THE PREVIOUS VERSION LINE!\n";
+$OUT .= "# Automysqlbackup disabled\n";
+$OUT .= "# To enable:\n";
+$OUT .= "# config setprop automysqlbackup Mymaria101 enabled\n";
+$OUT .= "# signal-event automysqlbackup-update\n";
+}
+}
diff --git a/root/etc/e-smith/templates/etc/automysqlbackup/mymaria101.conf/20db b/root/etc/e-smith/templates/etc/automysqlbackup/mymaria101.conf/20db
new file mode 100644
index 0000000..0f8d97f
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/automysqlbackup/mymaria101.conf/20db
@@ -0,0 +1,12 @@
+{
+if ($status eq 'enabled') {
+$OUT .= <<'_EOF';
+# DB Specific
+CONFIG_backup_dir=${BACKUPDIR}_mymaria_101
+CONFIG_mysql_dump_full_schema='no'
+CONFIG_db_exclude=( 'performance_schema' 'information_schema' 'sys' )
+CONFIG_mysql_dump_socket='/var/lib/mysql/mariadb101.sock'
+# End
+_EOF
+}
+}
diff --git a/root/etc/e-smith/templates/etc/automysqlbackup/mymaria101.conf/30end b/root/etc/e-smith/templates/etc/automysqlbackup/mymaria101.conf/30end
new file mode 100644
index 0000000..1dede84
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/automysqlbackup/mymaria101.conf/30end
@@ -0,0 +1,14 @@
+{
+if ($status eq 'enabled') {
+$OUT .= <<'_EOF';
+CONFIG_mailcontent=$MAILCONTENT
+CONFIG_mail_maxattsize=$SIZEMAIL
+CONFIG_mail_splitandtar='yes'
+CONFIG_mail_address=$MAILTO
+CONFIG_encrypt=$ENCRYPT
+CONFIG_encrypt_password=$DBENCRYPT_PASSWORD
+CONFIG_backup_local_files=($BACKUP_LOCAL_FILES)
+umask 0077
+_EOF
+}
+}
diff --git a/root/etc/e-smith/templates/etc/automysqlbackup/mymaria102.conf/10start b/root/etc/e-smith/templates/etc/automysqlbackup/mymaria102.conf/10start
new file mode 100644
index 0000000..75fe6df
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/automysqlbackup/mymaria102.conf/10start
@@ -0,0 +1,31 @@
+{
+my $mymaria = ${'mariadb102-mariadb'}{'status'} || 'disabled';
+my $myauto = ${'automysqlbackup'}{'Mymaria102'} || 'enabled';
+our $status = ( $mymaria eq 'enabled' && $myauto eq 'enabled' ) ? 'enabled' : 'disabled';
+my $debug = ${'automysqlbackup'}{'debug'} || 'disabled';
+
+if ($status eq 'enabled') {
+$OUT .= <<'_EOF';
+#version=3.0_RC6
+# DON'T REMOVE THE PREVIOUS VERSION LINE!
+CONFIG_mysql_dump_username='backupuser'
+CONFIG_mysql_dump_password=$PWDMYSQL
+CONFIG_mysql_dump_host_friendly=$SYSTEMNAME
+CONFIG_mysql_dump_create_database='yes'
+_EOF
+
+if ($debug eq 'enabled') {
+ $OUT .= "# Debug enabled\n";
+ $OUT .= "CONFIG_debug=\'1\'\n";
+}
+
+}
+else {
+$OUT .= "#version=3.0_RC6\n";
+$OUT .= "# DON'T REMOVE THE PREVIOUS VERSION LINE!\n";
+$OUT .= "# Automysqlbackup disabled\n";
+$OUT .= "# To enable:\n";
+$OUT .= "# config setprop automysqlbackup Mymaria102 enabled\n";
+$OUT .= "# signal-event automysqlbackup-update\n";
+}
+}
diff --git a/root/etc/e-smith/templates/etc/automysqlbackup/mymaria102.conf/20db b/root/etc/e-smith/templates/etc/automysqlbackup/mymaria102.conf/20db
new file mode 100644
index 0000000..894f0e1
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/automysqlbackup/mymaria102.conf/20db
@@ -0,0 +1,12 @@
+{
+if ($status eq 'enabled') {
+$OUT .= <<'_EOF';
+# DB Specific
+CONFIG_backup_dir=${BACKUPDIR}_mymaria_102
+CONFIG_mysql_dump_full_schema='no'
+CONFIG_db_exclude=( 'performance_schema' 'information_schema' 'sys' )
+CONFIG_mysql_dump_socket='/var/lib/mysql/mariadb102.sock'
+# End
+_EOF
+}
+}
diff --git a/root/etc/e-smith/templates/etc/automysqlbackup/mymaria102.conf/30end b/root/etc/e-smith/templates/etc/automysqlbackup/mymaria102.conf/30end
new file mode 100644
index 0000000..1dede84
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/automysqlbackup/mymaria102.conf/30end
@@ -0,0 +1,14 @@
+{
+if ($status eq 'enabled') {
+$OUT .= <<'_EOF';
+CONFIG_mailcontent=$MAILCONTENT
+CONFIG_mail_maxattsize=$SIZEMAIL
+CONFIG_mail_splitandtar='yes'
+CONFIG_mail_address=$MAILTO
+CONFIG_encrypt=$ENCRYPT
+CONFIG_encrypt_password=$DBENCRYPT_PASSWORD
+CONFIG_backup_local_files=($BACKUP_LOCAL_FILES)
+umask 0077
+_EOF
+}
+}
diff --git a/root/etc/e-smith/templates/etc/automysqlbackup/mymaria103.conf/10start b/root/etc/e-smith/templates/etc/automysqlbackup/mymaria103.conf/10start
new file mode 100644
index 0000000..1c13436
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/automysqlbackup/mymaria103.conf/10start
@@ -0,0 +1,31 @@
+{
+my $mymaria = ${'mariadb103-mariadb'}{'status'} || 'disabled';
+my $myauto = ${'automysqlbackup'}{'Mymaria103'} || 'enabled';
+our $status = ( $mymaria eq 'enabled' && $myauto eq 'enabled' ) ? 'enabled' : 'disabled';
+my $debug = ${'automysqlbackup'}{'debug'} || 'disabled';
+
+if ($status eq 'enabled') {
+$OUT .= <<'_EOF';
+#version=3.0_RC6
+# DON'T REMOVE THE PREVIOUS VERSION LINE!
+CONFIG_mysql_dump_username='backupuser'
+CONFIG_mysql_dump_password=$PWDMYSQL
+CONFIG_mysql_dump_host_friendly=$SYSTEMNAME
+CONFIG_mysql_dump_create_database='yes'
+_EOF
+
+if ($debug eq 'enabled') {
+ $OUT .= "# Debug enabled\n";
+ $OUT .= "CONFIG_debug=\'1\'\n";
+}
+
+}
+else {
+$OUT .= "#version=3.0_RC6\n";
+$OUT .= "# DON'T REMOVE THE PREVIOUS VERSION LINE!\n";
+$OUT .= "# Automysqlbackup disabled\n";
+$OUT .= "# To enable:\n";
+$OUT .= "# config setprop automysqlbackup Mymaria103 enabled\n";
+$OUT .= "# signal-event automysqlbackup-update\n";
+}
+}
diff --git a/root/etc/e-smith/templates/etc/automysqlbackup/mymaria103.conf/20db b/root/etc/e-smith/templates/etc/automysqlbackup/mymaria103.conf/20db
new file mode 100644
index 0000000..c47fe35
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/automysqlbackup/mymaria103.conf/20db
@@ -0,0 +1,12 @@
+{
+if ($status eq 'enabled') {
+$OUT .= <<'_EOF';
+# DB Specific
+CONFIG_backup_dir=${BACKUPDIR}_mymaria_103
+CONFIG_mysql_dump_full_schema='no'
+CONFIG_db_exclude=( 'performance_schema' 'information_schema' 'sys' )
+CONFIG_mysql_dump_socket='/var/lib/mysql/mariadb103.sock'
+# End
+_EOF
+}
+}
diff --git a/root/etc/e-smith/templates/etc/automysqlbackup/mymaria103.conf/30end b/root/etc/e-smith/templates/etc/automysqlbackup/mymaria103.conf/30end
new file mode 100644
index 0000000..1dede84
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/automysqlbackup/mymaria103.conf/30end
@@ -0,0 +1,14 @@
+{
+if ($status eq 'enabled') {
+$OUT .= <<'_EOF';
+CONFIG_mailcontent=$MAILCONTENT
+CONFIG_mail_maxattsize=$SIZEMAIL
+CONFIG_mail_splitandtar='yes'
+CONFIG_mail_address=$MAILTO
+CONFIG_encrypt=$ENCRYPT
+CONFIG_encrypt_password=$DBENCRYPT_PASSWORD
+CONFIG_backup_local_files=($BACKUP_LOCAL_FILES)
+umask 0077
+_EOF
+}
+}
diff --git a/root/etc/e-smith/templates/etc/automysqlbackup/mymaria105.conf/10start b/root/etc/e-smith/templates/etc/automysqlbackup/mymaria105.conf/10start
new file mode 100644
index 0000000..a63ec09
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/automysqlbackup/mymaria105.conf/10start
@@ -0,0 +1,31 @@
+{
+my $mymaria = ${'mariadb105-mariadb'}{'status'} || 'disabled';
+my $myauto = ${'automysqlbackup'}{'Mymaria105'} || 'enabled';
+our $status = ( $mymaria eq 'enabled' && $myauto eq 'enabled' ) ? 'enabled' : 'disabled';
+my $debug = ${'automysqlbackup'}{'debug'} || 'disabled';
+
+if ($status eq 'enabled') {
+$OUT .= <<'_EOF';
+#version=3.0_RC6
+# DON'T REMOVE THE PREVIOUS VERSION LINE!
+CONFIG_mysql_dump_username='backupuser'
+CONFIG_mysql_dump_password=$PWDMYSQL
+CONFIG_mysql_dump_host_friendly=$SYSTEMNAME
+CONFIG_mysql_dump_create_database='yes'
+_EOF
+
+if ($debug eq 'enabled') {
+ $OUT .= "# Debug enabled\n";
+ $OUT .= "CONFIG_debug=\'1\'\n";
+}
+
+}
+else {
+$OUT .= "#version=3.0_RC6\n";
+$OUT .= "# DON'T REMOVE THE PREVIOUS VERSION LINE!\n";
+$OUT .= "# Automysqlbackup disabled\n";
+$OUT .= "# To enable:\n";
+$OUT .= "# config setprop automysqlbackup Mymaria105 enabled\n";
+$OUT .= "# signal-event automysqlbackup-update\n";
+}
+}
diff --git a/root/etc/e-smith/templates/etc/automysqlbackup/mymaria105.conf/20db b/root/etc/e-smith/templates/etc/automysqlbackup/mymaria105.conf/20db
new file mode 100644
index 0000000..f5b08ac
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/automysqlbackup/mymaria105.conf/20db
@@ -0,0 +1,12 @@
+{
+if ($status eq 'enabled') {
+$OUT .= <<'_EOF';
+# DB Specific
+CONFIG_backup_dir=${BACKUPDIR}_mymaria_105
+CONFIG_mysql_dump_full_schema='no'
+CONFIG_db_exclude=( 'performance_schema' 'information_schema' 'sys' )
+CONFIG_mysql_dump_socket='/var/lib/mysql/mariadb105.sock'
+# End
+_EOF
+}
+}
diff --git a/root/etc/e-smith/templates/etc/automysqlbackup/mymaria105.conf/30end b/root/etc/e-smith/templates/etc/automysqlbackup/mymaria105.conf/30end
new file mode 100644
index 0000000..1dede84
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/automysqlbackup/mymaria105.conf/30end
@@ -0,0 +1,14 @@
+{
+if ($status eq 'enabled') {
+$OUT .= <<'_EOF';
+CONFIG_mailcontent=$MAILCONTENT
+CONFIG_mail_maxattsize=$SIZEMAIL
+CONFIG_mail_splitandtar='yes'
+CONFIG_mail_address=$MAILTO
+CONFIG_encrypt=$ENCRYPT
+CONFIG_encrypt_password=$DBENCRYPT_PASSWORD
+CONFIG_backup_local_files=($BACKUP_LOCAL_FILES)
+umask 0077
+_EOF
+}
+}
diff --git a/root/etc/e-smith/templates/etc/automysqlbackup/mysql57.conf/10start b/root/etc/e-smith/templates/etc/automysqlbackup/mysql57.conf/10start
new file mode 100644
index 0000000..3bca8e0
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/automysqlbackup/mysql57.conf/10start
@@ -0,0 +1,31 @@
+{
+my $my57 = ${'mysql57-mysqld'}{'status'} || 'disabled';
+my $myauto = ${'automysqlbackup'}{'Mysql57'} || 'enabled';
+our $status = ( $my57 eq 'enabled' && $myauto eq 'enabled' ) ? 'enabled' : 'disabled';
+my $debug = ${'automysqlbackup'}{'debug'} || 'disabled';
+
+if ($status eq 'enabled') {
+$OUT .= <<'_EOF';
+#version=3.0_RC6
+# DON'T REMOVE THE PREVIOUS VERSION LINE!
+CONFIG_mysql_dump_username='backupuser'
+CONFIG_mysql_dump_password=$PWDMYSQL
+CONFIG_mysql_dump_host_friendly=$SYSTEMNAME
+CONFIG_mysql_dump_create_database='yes'
+_EOF
+
+if ($debug eq 'enabled') {
+ $OUT .= "# Debug enabled\n";
+ $OUT .= "CONFIG_debug=\'1\'\n";
+}
+
+}
+else {
+$OUT .= "#version=3.0_RC6\n";
+$OUT .= "# DON'T REMOVE THE PREVIOUS VERSION LINE!\n";
+$OUT .= "# Automysqlbackup disabled\n";
+$OUT .= "# To enable:\n";
+$OUT .= "# config setprop automysqlbackup Mysql57 enabled\n";
+$OUT .= "# signal-event automysqlbackup-update\n";
+}
+}
diff --git a/root/etc/e-smith/templates/etc/automysqlbackup/mysql57.conf/20db b/root/etc/e-smith/templates/etc/automysqlbackup/mysql57.conf/20db
new file mode 100644
index 0000000..97d6abe
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/automysqlbackup/mysql57.conf/20db
@@ -0,0 +1,12 @@
+{
+if ($status eq 'enabled') {
+$OUT .= <<'_EOF';
+# DB Specific
+CONFIG_backup_dir=${BACKUPDIR}_mysql57
+CONFIG_mysql_dump_full_schema='no'
+CONFIG_db_exclude=( 'information_schema' 'performance_schema' 'sys' )
+CONFIG_mysql_dump_socket='/var/lib/mysql/mysql57.sock'
+# End
+_EOF
+}
+}
diff --git a/root/etc/e-smith/templates/etc/automysqlbackup/mysql57.conf/30end b/root/etc/e-smith/templates/etc/automysqlbackup/mysql57.conf/30end
new file mode 100644
index 0000000..1dede84
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/automysqlbackup/mysql57.conf/30end
@@ -0,0 +1,14 @@
+{
+if ($status eq 'enabled') {
+$OUT .= <<'_EOF';
+CONFIG_mailcontent=$MAILCONTENT
+CONFIG_mail_maxattsize=$SIZEMAIL
+CONFIG_mail_splitandtar='yes'
+CONFIG_mail_address=$MAILTO
+CONFIG_encrypt=$ENCRYPT
+CONFIG_encrypt_password=$DBENCRYPT_PASSWORD
+CONFIG_backup_local_files=($BACKUP_LOCAL_FILES)
+umask 0077
+_EOF
+}
+}
diff --git a/root/etc/e-smith/templates/etc/cron.d/runmysqlbackup/10base b/root/etc/e-smith/templates/etc/cron.d/runmysqlbackup/10base
new file mode 100644
index 0000000..15c3b3e
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/cron.d/runmysqlbackup/10base
@@ -0,0 +1,33 @@
+{
+
+my $mymaria = ${'mariadb'}{'status'} || 'disabled';
+$mymaria = ( ( ( ${'automysqlbackup'}{'Mymaria'} || 'enabled' ) eq "enabled" ) and ( $mymaria eq "enabled") ) ? "enabled" : "disabled";
+my $my57 = ${'mysql57-mysqld'}{'status'} || 'disabled';
+$my57 = ( ( ( ${'automysqlbackup'}{'Mysql57'} || 'enabled' ) eq "enabled" ) and ( $my57 eq "enabled" ) ) ? "enabled" : "disabled";
+
+my $my101 = ${'mariadb101-mariadb'}{'status'} || 'disabled';
+$my101 = ( ( ( ${'automysqlbackup'}{'Mymaria101'} || 'enabled' ) eq "enabled" ) and ( $my101 eq "enabled" ) ) ? "enabled" : "disabled";
+my $my102 = ${'mariadb102-mariadb'}{'status'} || 'disabled';
+$my102 = ( ( ( ${'automysqlbackup'}{'Mymaria102'} || 'enabled' ) eq "enabled" ) and ( $my102 eq "enabled" ) ) ? "enabled" : "disabled";
+my $my103 = ${'mariadb103-mariadb'}{'status'} || 'disabled';
+$my103 = ( ( ( ${'automysqlbackup'}{'Mymaria101'} || 'enabled' ) eq "enabled" ) and ( $my103 eq "enabled" ) ) ? "enabled" : "disabled";
+my $my105 = ${'mariadb105-mariadb'}{'status'} || 'disabled';
+$my105 = ( ( ( ${'automysqlbackup'}{'Mymaria105'} || 'enabled' ) eq "enabled" ) and ( $my105 eq "enabled" ) ) ? "enabled" : "disabled";
+
+#return '' unless $mymymaria eq 'enabled';
+
+my $minutes= ${'automysqlbackup'}{'Minute'}||'1';
+my $hours= ${'automysqlbackup'}{'Hour'}||'3';
+$OUT = "$minutes $hours * * * root ";
+
+$OUT .= "/sbin/e-smith/runmysqlbackup -bc /etc/automysqlbackup/mymaria.conf > /dev/null ; " if $mymaria eq "enabled";
+$OUT .= "/sbin/e-smith/runmysqlbackup -bc /etc/automysqlbackup/mysql57.conf > /dev/null ; " if $my57 eq "enabled";
+$OUT .= "/sbin/e-smith/runmysqlbackup -bc /etc/automysqlbackup/mymaria101.conf > /dev/null ; " if $my101 eq "enabled";
+$OUT .= "/sbin/e-smith/runmysqlbackup -bc /etc/automysqlbackup/mymaria102.conf > /dev/null ; " if $my102 eq "enabled";
+$OUT .= "/sbin/e-smith/runmysqlbackup -bc /etc/automysqlbackup/mymaria103.conf > /dev/null ; " if $my103 eq "enabled";
+$OUT .= "/sbin/e-smith/runmysqlbackup -bc /etc/automysqlbackup/mymaria105.conf > /dev/null ; " if $my105 eq "enabled";
+
+$OUT .= "\n";
+
+}
+
diff --git a/root/etc/e-smith/templates/etc/e-smith/sql/init/automysqlbackup b/root/etc/e-smith/templates/etc/e-smith/sql/init/automysqlbackup
new file mode 100644
index 0000000..50ee06d
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/e-smith/sql/init/automysqlbackup
@@ -0,0 +1,37 @@
+{
+my $user = $automysqlbackup{'DbUser'} || 'backupuser';
+my $pass = $automysqlbackup{'DbPassword'} || 'automysqlbackup';
+my $status = ${'mysql.init'}{'status'} || 'disabled';
+
+$OUT = "#! /bin/sh
+";
+
+if ( "$status" eq "enabled" ) {
+
+$OUT .= <<"END";
+HOME="/root/";
+/usr/bin/mysql --socket=/var/lib/mysql/mysql.sock </dev/null
+
+DB=$(/sbin/e-smith/db configuration getprop automysqlbackup Backupdir)
+
+if [ -z "$DB" ]; then
+ DB="/root/backup/db";
+fi
+
+if [[ "$DB" =~ "^/root/backup" ]] || [[ "$DB" =~ "^/home/e-smith/db/" ]] ; then
+ chown root:root $DB$2 -R
+ find $DB$2 -type f -exec chmod 400 {} \;
+ find $DB$2 -type d -exec chmod 700 {} \;
+fi
diff --git a/root/usr/share/doc/automysqlbackup/LICENCE b/root/usr/share/doc/automysqlbackup/LICENCE
new file mode 100644
index 0000000..d159169
--- /dev/null
+++ b/root/usr/share/doc/automysqlbackup/LICENCE
@@ -0,0 +1,339 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ , 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/root/usr/share/doc/automysqlbackup/README b/root/usr/share/doc/automysqlbackup/README
new file mode 100644
index 0000000..ec1f7b1
--- /dev/null
+++ b/root/usr/share/doc/automysqlbackup/README
@@ -0,0 +1,210 @@
+AutomysqlBackup
+-------------------------
+.. INDEX
+-------------------------
+Disclaimer
+Install
+Usage
+Configuration Options
+Encryption
+Backup rotation
+Restoring
+
+
+
+.. DISCLAIMER
+-------------------------
+I take no resposibility for any data loss or corruption when using this script.
+This script will not help in the event of a hard drive crash. If a copy of the
+backup has not been stored offline or on another PC. You should copy your backups
+offline regularly for best protection.
+
+Happy backing up...
+
+
+
+.. INSTALL
+-------------------------
+Extract the package into a directory. If you are reading this you have probably done
+this already.
+
+To install the Automysqlbackup the easy way.
+1. Run the install.sh script.
+2. Edit the /etc/automysqlbackup/myserver.conf file to customise your settings.
+3. See usage section.
+
+To install it manually (the hard way).
+1. Create the /etc/automysqlbackup directory.
+2. Copy in the automysqlbackup.conf file.
+3. Copy the automysqlbackup file to /usr/local/bin and make executable.
+4. cp /etc/automysqlbackup/automysqlbackup.conf /etc/automysqlbackup/myserver.conf
+5. Edit the /etc/automysqlbackup/myserver.conf file to customise your settings.
+6. See usage section.
+
+
+
+.. USAGE
+-------------------------
+
+Automysqlbackup can be run a number of ways, you can choose which is best for you.
+
+1. Create a script as below called runmysqlbackup using the lines below:
+
+#~~~~ Copy From Below Here ~~~~
+#!/bin/sh
+
+/usr/local/bin/automysqlbackup /etc/automysqlbackup/myserver.conf
+
+chown root.root /var/backup/db* -R
+find /var/backup/db* -type f -exec chmod 400 {} \;
+find /var/backup/db* -type d -exec chmod 700 {} \;
+
+#~~~~~ Copy To Above Here ~~~~
+
+2. Save it to a suitable location or copy it to your /etc/cron.daily folder.
+
+3. Make it executable, i.e. chmod +x /etc/cron.daily/runmysqlbackup.
+
+
+The backup can be run from the command line simply by running the following command.
+
+ automysqlbackup /etc/automysqlbackup/myserver.conf
+
+If you don't supply an argument for automysqlbackup, the default configuration
+in the program automysqlbackup will be used unless a global file
+
+ CONFIG_configfile="/etc/automysqlbackup/automysqlbackup.conf"
+
+exists.
+
+You can just copy the supplied automysqlbackup.conf as many times as you want
+and use for separate configurations, i.e. for example different mysql servers.
+
+!!! NEW !!!
+----------
+As of version 3.0 we have added differential backups using the program diff. In an
+effort to make the reconstruction of the full archives more user friendly, we
+added new functionality to the script. Therefore, while preserving the old syntax,
+we created options for the script, so that the new functions can be accessed.
+
+Usage automysqlbackup options -cblh
+-c CONFIG_FILE Specify optional config file.
+-b Use backup method.
+-l List manifest entries.
+-h Show this help.
+
+If you use these options, you have to specify everything according to them and can't
+mix the old syntax with the new one. Example:
+
+before (still valid!):
+
+ >> automysqlbackup "myconfig.conf"
+
+now:
+
+ >> automysqlbackup -c "myconfig.conf" -b
+
+which is equivalent to
+
+ >> automysqlbackup -bc "myconfig.conf"
+
+or in English: The order of the options doesn't matter, however those options expecting
+arguments, have to be placed right before the argument (as seen above).
+
+The option '-l' (List manifest entries) finds all Manifest files in your configuration
+directory (you need to specify your optional config file - otherwise a fallback will be
+used: global config file -> program internal default options). It then filters from which
+databases these are and presents you with a list (you can select more than one!) of them.
+Once you have chosen, you will be given a list of Manifest files, from which you choose
+again and after that from which you choose differential files. When you have completed
+all your selections, a list of selected differential files will be shown. You may then
+choose what you want to be done with/to those files. At the moment the options are:
+- create full backup out of differential one
+- remove the differential backup and its Manifest entry.
+
+
+.. CONFIGURATION OPTIONS
+-------------------------
+
+!! "automysqlbackup" program contains a default configuration that should not be changed:
+
+The global config file which overwrites the default configuration is located here
+"/etc/automysqlbackup/automysqlbackup.conf" by default.
+
+Please take a look at the supplied "automysqlbackup.conf" for information about the configuration options.
+
+Default configuration
+CONFIG_configfile="/etc/automysqlbackup/automysqlbackup.conf"
+CONFIG_backup_dir='/var/backup/db'
+CONFIG_do_monthly="01"
+CONFIG_do_weekly="5"
+CONFIG_rotation_daily=6
+CONFIG_rotation_weekly=35
+CONFIG_rotation_monthly=150
+CONFIG_mysql_dump_usessl='yes'
+CONFIG_mysql_dump_username='root'
+CONFIG_mysql_dump_password=''
+CONFIG_mysql_dump_host='localhost'
+CONFIG_mysql_dump_socket=''
+CONFIG_mysql_dump_create_database='no'
+CONFIG_mysql_dump_use_separate_dirs='yes'
+CONFIG_mysql_dump_compression='gzip'
+CONFIG_mysql_dump_commcomp='no'
+CONFIG_mysql_dump_latest='no'
+CONFIG_mysql_dump_max_allowed_packet=''
+CONFIG_db_names=()
+CONFIG_db_month_names=()
+CONFIG_db_exclude=( 'information_schema' )
+CONFIG_mailcontent='log'
+CONFIG_mail_maxattsize=4000
+CONFIG_mail_address='root'
+CONFIG_encrypt='no'
+CONFIG_encrypt_password='password0123'
+
+!! automysqlbackup (the shell program) accepts one parameter, the filename of a configuration file. The entries in there will
+supersede all others.
+
+Please take a look at the supplied "automysqlbackup.conf" for information about the configuration options.
+
+
+
+.. ENCRYPTION
+-------------------------
+
+To decrypt run (replace bz2 with gz if using gzip):
+
+openssl enc -aes-256-cbc -d -in encrypted_file_name(ex: *.enc.bz2) -out outputfilename.bz2 -pass pass:PASSWORD-USED-TO-ENCRYPT
+
+
+
+.. BACKUP ROTATION
+-------------------------
+
+Daily Backups are rotated weekly.
+Weekly Backups are run on fridays, unless otherwise specified via CONFIG_do_weekly.
+Weekly Backups are rotated on a 5 week cycle, unless otherwise specified via CONFIG_rotation_weekly.
+Monthly Backups are run on the 1st of the month, unless otherwise specified via CONFIG_do_monthly.
+Monthly Backups are rotated on a 5 month cycle, unless otherwise specified via CONFIG_rotation_monthly.
+
+Suggestion: It may be a good idea to copy monthly backups offline or to another server.
+
+
+
+.. RESTORING
+-------------------------
+
+Firstly you will need to uncompress the backup file and decrypt it if encryption was used (see encryption section).
+
+eg.
+gunzip file.gz (or bunzip2 file.bz2)
+
+Next you will need to use the mysql client to restore the DB from the sql file.
+
+eg.
+ mysql --user=username --pass=password --host=dbserver database < /path/file.sql
+or
+ mysql --user=username --pass=password --host=dbserver -e "source /path/file.sql" database
+
+NOTE: Make sure you use "<" and not ">" in the above command because you are piping the file.sql to mysql and not the other way
+around.
+
diff --git a/smeserver-automysqlbackup.spec b/smeserver-automysqlbackup.spec
new file mode 100644
index 0000000..27a4f7f
--- /dev/null
+++ b/smeserver-automysqlbackup.spec
@@ -0,0 +1,209 @@
+%define name smeserver-automysqlbackup
+%define version 3.0.RC6
+%define release 33
+%define rpmver 3.0.RC6
+
+epoch: 2
+Summary: automysqlbackup is a script to backup your msql database on sme8
+Name: %{name}
+Version: %{version}
+Release: %{release}%{?dist}
+License: GPL
+Group: /Web/Application
+Source: %{name}-%{version}.tar.xz
+URL: http://sourceforge.net/projects/automysqlbackup/
+BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot
+BuildArchitectures: noarch
+Requires: e-smith-base, e-smith-release >= 10
+Requires: pax
+Requires: automysqlbackup >= 3.0.RC6-8
+BuildRequires: e-smith-devtools
+
+%description
+This RPM is an unofficial addon for the SME Server 10.x.
+The target audience is the Linux/E-smith administrator
+who wants to backup their mysql databases with an automatic way.
+This script is based on automysqlbackup V3.0
+
+%changelog
+* Sat Sep 07 2024 cvs2git.sh aka Brian Read 3.0.RC6-33.sme
+- Roll up patches and move to git repo [SME: 12338]
+
+* Sat Sep 07 2024 BogusDateBot
+- Eliminated rpmbuild "bogus date" warnings due to inconsistent weekday,
+ by assuming the date is correct and changing the weekday.
+
+* Wed Jun 14 2023 John Crisp 3.0.RC6-32.sme
+- Add create_database to backups
+
+* Tue Oct 04 2022 John Crisp 3.0.RC6-31.sme
+- Remove myserver.conf template expansion as template no longer exists
+
+* Mon Aug 22 2022 John Crisp 3.0.RC6-30.sme
+- Forgot to change the version on the Changelog line below
+
+* Mon Aug 22 2022 John Crisp 3.0.RC6-29.sme
+- Bump automysqlbackup requires
+
+* Mon Aug 15 2022 John Crisp 3.0.RC6-28.sme
+- Add debug patch to conf files
+
+* Mon Aug 15 2022 John Crisp 3.0.RC6-27.sme
+- Modify cron line again to add -bc option [SME: 11970]
+- Modify runmysqlbackup to add option and conf input from cron
+
+* Mon Aug 08 2022 John Crisp 3.0.RC6-26.sme
+- Change cron directories to match templates [SME:11970]
+
+* Mon Aug 08 2022 John Crisp 3.0.RC6-25.sme
+- Change rc2 to RC6 in config templates [SME:11970]
+- Fix DONT'T typo
+
+* Tue Jun 07 2022 John Crisp 3.0.RC6-24.sme
+- Update cron [SME:11970]
+- Fix SQL in Maria 105
+- Remove automysql event and leave just smeserver-automysqlbackup-update
+- Fix some createlinks
+- Modify inits - but still leaves log errors if version not installed
+
+* Tue Jun 07 2022 John Crisp 3.0.RC6-23.sme
+- Modify backup directory names [SME: 11970]
+
+* Tue May 31 2022 John Crisp 3.0.RC6-22.sme
+- Fix more typos in templates [SME: 11970]
+
+* Tue May 31 2022 John Crisp 3.0.RC6-21.sme
+- Fix typos in templates [SME: 11970]
+
+* Mon May 30 2022 John Crisp 3.0.RC6-20.sme
+- Correct template names [SME: 11970]
+- Add enable instructions
+
+* Mon May 09 2022 John Crisp 3.0.RC6-19.sme
+- Add Maria DB 10.x support [SME: 11970]
+- Requires Koozali SME Server v10.x
+
+* Sat Jun 05 2021 Terry Fage 3.0.RC6-18.sme
+- mariadb should not backup information_schema [SME: 11622]
+
+* Fri Apr 16 2021 Jean-Philippe Pialasse 3.0.RC6-17.sme
+- fix automysql freeze server on reboot after post-upgrade event [SME: 11561]
+
+* Mon Oct 19 2020 Brian Read 3.0-RC6-16.sme
+- Initial Import to SME10 tree [SME: 11042]
+- Update-MySQL-Init-for-Mariadb
+
+* Sun Sep 22 2019 Jean-Philipe Pialasse 3.0.RC6-15.sme
+- fix multiple cause of error noise and performance [SME: 10806]
+ * avoid parallel run of all backups, cron template rewritten
+ * avoid multiple parallel or repeated chmod and chown
+ * protect from undesired chmod or chown
+ * consistent use of status for cron and conf templates
+ * create backup user for mysql, mysql55 and mysql57 (Maria to do)
+ * update mysql53 use to mysql51 as variable
+ * migrate fragment to remove Mysql55 Mysql57 Mymaria Mysql53 if Mysql53 exist
+ * remove default value in db for Mysql55 Mysql57 Mymaria Mysql53
+ * default as enabled in fragments for all automysql My* properties
+- create default user in dbs [SME: 10808]
+- tidy spec file
+
+* Mon Nov 26 2018 John Crisp 3.0.RC6-11.sme
+- fix runmysqlscript to allow for change in Backupdir key [SME: 10655]
+
+* Mon Nov 26 2018 John Crisp 3.0.RC6-10.sme
+- fix runmysqlbackup to allow for new databases [SME: 10654]
+
+* Fri Jul 06 2018 John Crisp 3.0.RC6-9.sme
+- Template configuration files
+- run automysqlbackup per conf directly from cron rather than runmysqlbackup
+- Add extra DB keys for mysql53, mysql55, mysql57
+
+* Sun Apr 02 2017 stephane de Labrusse 3.0.RC6-8.sme
+- Added smeserver-automysqlbackup-AdjustableCronJob.patch
+- The time to run the Job is adjustable
+
+* Wed Sep 16 2015 stephane de Labrusse 3.0.RC6-6.sme
+- Added 'epoch: 2'
+
+* Sat Aug 22 2015 stephane de Labrusse 3.0.RC6-5.sme
+- Initial release to contribs9
+
+* Sun Aug 17 2014 Stephane de Labrusse 3.0.RC6-4
+- added my own patch against the --events warning
+--Warning: Skipping the data of table mysql.event. Specify the --events option explicitly.
+
+* Sun Oct 27 2013 Stephane de Labrusse 3.0.RC6.3
+- split the contrib in two versions smeserver-automysqlbackup and automysqlbackup
+* Mon Apr 22 2013 Stephane de Labrusse
+- [3.0.RC6] version Based on automysqlbackup V3.0 RC6
+* Mon Apr 08 2013 Stephane de Labrusse
+- [0.01] Initial version Based on automysqlbackup V3.0 RC6
+
+%prep
+rm -rf $RPM_BUILD_ROOT
+
+%setup
+
+%build
+perl createlinks
+find . \( -name .gitinclude -o -name .gitignore \) -print0 | \
+ xargs -0 rm -f
+
+%install
+/bin/rm -rf $RPM_BUILD_ROOT
+(cd root ;/usr/bin/find . -depth -print | /bin/cpio -dump $RPM_BUILD_ROOT)
+/bin/rm -f %{name}-%{version}-filelist
+/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \
+--file /sbin/e-smith/runmysqlbackup 'attr(0750,root,root)' \
+--dir /root/backup 'attr(0700,root,root)' \
+--dir /root/backup/db 'attr(0700,root,root)' \
+--dir /root/backup/db/daily 'attr(0700,root,root)' \
+--dir /root/backup/db/fullschema 'attr(0700,root,root)' \
+--dir /root/backup/db/latest 'attr(0700,root,root)' \
+--dir /root/backup/db/monthly 'attr(0700,root,root)' \
+--dir /root/backup/db/status 'attr(0700,root,root)' \
+--dir /root/backup/db/tmp 'attr(0700,root,root)' \
+--dir /root/backup/db/weekly 'attr(0700,root,root)' \
+> %{name}-%{version}-filelist
+
+
+%files -f %{name}-%{version}-filelist
+
+%defattr(-,root,root)
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%pre
+
+%post
+#protect the backup folder
+chmod -R 700 /root/backup
+echo "======================================================================="
+echo " "
+echo " To update your templates please run"
+echo " 'signal-event smeserver-automysqlbackup-update'"
+echo " "
+echo "======================================================================="
+
+%preun
+%postun
+if [ $1 = 0 ] ; then
+SMEDB=automysqlbackup
+MYSQLUSER=backupuser
+echo "======================================================================="
+echo " "
+echo " delete mysql user and revoke all permissions"
+# This section deletes backupuser for the standard DB
+mysql -u root -e "REVOKE ALL PRIVILEGES ON *.* FROM '$MYSQLUSER'@'localhost';"
+mysql -u root -e "DROP USER $MYSQLUSER@localhost;"
+echo " "
+echo "Do that for each DB - e.g mysq55, mysql57, mariadb101, maria105 etc"
+echo " "
+# Delete custom template fragment
+echo " Deleting configuration automysqlbackup"
+echo " "
+echo "======================================================================="
+
+/sbin/e-smith/config delete $SMEDB
+fi