diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Makefile.am | 2 | ||||
-rw-r--r-- | lib/backup/Makefile.am | 15 | ||||
-rw-r--r-- | lib/beam/.gitignore (renamed from lib/backup/.gitignore) | 0 | ||||
-rw-r--r-- | lib/beam/Makefile.am | 31 | ||||
-rw-r--r-- | lib/beam/common.in (renamed from lib/backup/common.in) | 41 | ||||
-rwxr-xr-x | lib/beam/fs.sh (renamed from lib/backup/fs.sh) | 15 | ||||
-rw-r--r-- | lib/beam/mysql.sh (renamed from lib/backup/mysql.sh) | 15 | ||||
-rwxr-xr-x | lib/beam/postgres.sh (renamed from lib/backup/postgres.sh) | 15 | ||||
-rw-r--r-- | lib/beam/s3.sh (renamed from lib/backup/s3.sh) | 24 |
9 files changed, 129 insertions, 29 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am index b26ee9a..20a50e8 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1 +1 @@ -SUBDIRS=backup
\ No newline at end of file +SUBDIRS=beam diff --git a/lib/backup/Makefile.am b/lib/backup/Makefile.am deleted file mode 100644 index d1f687d..0000000 --- a/lib/backup/Makefile.am +++ /dev/null @@ -1,15 +0,0 @@ -libbackupdir=$(libdir)/backup -libbackup_SCRIPTS=\ - common.sh\ - s3.sh\ - fs.sh\ - mysql.sh\ - postgres.sh -EXTRA_DIST=\ - common.in\ - s3.sh\ - fs.sh\ - mysql.sh\ - postgres.sh -DISTCLEANFILES=common.sh -include $(top_srcdir)/Make.rules diff --git a/lib/backup/.gitignore b/lib/beam/.gitignore index 5621a6e..5621a6e 100644 --- a/lib/backup/.gitignore +++ b/lib/beam/.gitignore diff --git a/lib/beam/Makefile.am b/lib/beam/Makefile.am new file mode 100644 index 0000000..d490acb --- /dev/null +++ b/lib/beam/Makefile.am @@ -0,0 +1,31 @@ +# This file is part of BEAM +# Copyright (C) 2012 Sergey Poznyakoff +# +# BEAM 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 3, or (at your option) +# any later version. +# +# BEAM 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 BEAM. If not, see <http://www.gnu.org/licenses/>. + +libbackupdir=$(libdir)/beam +libbackup_SCRIPTS=\ + common.sh\ + s3.sh\ + fs.sh\ + mysql.sh\ + postgres.sh +EXTRA_DIST=\ + common.in\ + s3.sh\ + fs.sh\ + mysql.sh\ + postgres.sh +DISTCLEANFILES=common.sh +include $(top_srcdir)/Make.rules diff --git a/lib/backup/common.in b/lib/beam/common.in index 11cb2d0..49b41eb 100644 --- a/lib/backup/common.in +++ b/lib/beam/common.in @@ -1,4 +1,19 @@ #! /bin/bash +# This file is part of BEAM +# Copyright (C) 2012 Sergey Poznyakoff +# +# BEAM 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 3, or (at your option) +# any later version. +# +# BEAM 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 BEAM. If not, see <http://www.gnu.org/licenses/>. # Force C locale LC_ALL=C @@ -44,11 +59,11 @@ tarcode() { load_config() { local delayed_exit - test -z "$BACKUP_CONFIG" && BACKUP_CONFIG=@SYSCONFDIR@/backup.conf - if [ -r $BACKUP_CONFIG ]; then - . $BACKUP_CONFIG + test -z "$BEAM_CONFIG" && BEAM_CONFIG=@SYSCONFDIR@/beam.conf + if [ -r $BEAM_CONFIG ]; then + . $BEAM_CONFIG else - abend 1 "configuration file $BACKUP_CONFIG does not exist or is unreadable" + abend 1 "configuration file $BEAM_CONFIG does not exist or is unreadable" fi if [ -z "$backup_items" ]; then @@ -85,7 +100,7 @@ $type" tar_suffix=${backup_suffix:-.tar} if [ -n "$backup_bucket_name" ]; then - . @LIBDIR@/backup/s3.sh + . @LIBDIR@/beam/s3.sh prologue_hook="$prologue_hook s3_mount" fi } @@ -101,12 +116,20 @@ runhook() { } print_version() { - cat <<EOF -$0 (@PACKAGE_NAME@) @PACKAGE_VERSION@ + name=$(basename $0) + cat <<EOF +$name (@PACKAGE_NAME@) @PACKAGE_VERSION@ Copyright (C) 2012 Sergey Poznyakoff License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. EOF - exit 0 -}
\ No newline at end of file + exit 0 +} + +wtf() { + l=`echo "${1#beam-}"|sed "s|.|.|g"` + s=$(echo " " | sed "s|$l|${1#beam-}|") + shift + echo " $s $@" +} diff --git a/lib/backup/fs.sh b/lib/beam/fs.sh index 2ac9ad1..6d7d4c7 100755 --- a/lib/backup/fs.sh +++ b/lib/beam/fs.sh @@ -1,4 +1,19 @@ #! /bin/bash +# This file is part of BEAM +# Copyright (C) 2012 Sergey Poznyakoff +# +# BEAM 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 3, or (at your option) +# any later version. +# +# BEAM 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 BEAM. If not, see <http://www.gnu.org/licenses/>. # initdb item # Initializes snapshot for the given basename. diff --git a/lib/backup/mysql.sh b/lib/beam/mysql.sh index 5538ea8..c33adb0 100644 --- a/lib/backup/mysql.sh +++ b/lib/beam/mysql.sh @@ -1,4 +1,19 @@ #! /bin/bash +# This file is part of BEAM +# Copyright (C) 2012 Sergey Poznyakoff +# +# BEAM 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 3, or (at your option) +# any later version. +# +# BEAM 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 BEAM. If not, see <http://www.gnu.org/licenses/>. # mysql_check item mysql_check() { diff --git a/lib/backup/postgres.sh b/lib/beam/postgres.sh index f233615..0072da6 100755 --- a/lib/backup/postgres.sh +++ b/lib/beam/postgres.sh @@ -1,4 +1,19 @@ #! /bin/bash +# This file is part of BEAM +# Copyright (C) 2012 Sergey Poznyakoff +# +# BEAM 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 3, or (at your option) +# any later version. +# +# BEAM 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 BEAM. If not, see <http://www.gnu.org/licenses/>. # postgres_check item postgres_check() { diff --git a/lib/backup/s3.sh b/lib/beam/s3.sh index e463e76..5f7235c 100644 --- a/lib/backup/s3.sh +++ b/lib/beam/s3.sh @@ -1,3 +1,19 @@ +# This file is part of BEAM -*- shell-script -*- +# Copyright (C) 2012 Sergey Poznyakoff +# +# BEAM 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 3, or (at your option) +# any later version. +# +# BEAM 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 BEAM. If not, see <http://www.gnu.org/licenses/>. + # The configuration variable "backup_bucket_name" must contain the name # of the s3 bucket to use. @@ -21,7 +37,7 @@ s3_mount() { set -- $(mount -tfuse.s3backer | awk '/https?:\/\/'$backup_bucket_name'/ { print $3 }') if test -z "$1"; then - $dry_run s3backer --accessFile=/root/.s3backer_passwd --vhost \ + $dry_run s3backer $backup_s3backer_options \ $backup_bucket_name $backup_mp_s3backer || abend 1 "unable to mount $backup_bucket_name" umount_list="$backup_mp_s3backer" @@ -31,9 +47,9 @@ s3_mount() { set -- $(mount | grep "^${backup_mp_s3backer}/file" | awk '{ print $3 }') if test -z "$1"; then case $(basename $0) in - restore) mountopt=",ro";; - backup) mountopt=",rw,data=writeback";; - s3mount) ;; + beam-restore|restore) mountopt=",ro";; + beam-backup|backup) mountopt=",rw,data=writeback";; + beam-s3) ;; *) error "called as $0: assuming default mount options" esac # NOTE: For ext4 add the journal_async_commit option. |