diff options
-rw-r--r-- | .gitignore | 27 | ||||
-rw-r--r-- | Changes | 0 | ||||
-rw-r--r-- | LICENSE (renamed from COPYING) | 0 | ||||
-rw-r--r-- | MANIFEST | 7 | ||||
-rw-r--r-- | Make.rules | 22 | ||||
-rw-r--r-- | Makefile.PL | 26 | ||||
-rw-r--r-- | Makefile.am | 73 | ||||
-rw-r--r-- | backup.in | 144 | ||||
-rw-r--r-- | beam.conf | 297 | ||||
-rw-r--r-- | beam.in | 73 | ||||
-rwxr-xr-x | bootstrap | 3 | ||||
-rwxr-xr-x | cleaner.in | 117 | ||||
-rw-r--r-- | configure.ac | 36 | ||||
-rw-r--r-- | doc/.gitignore | 9 | ||||
-rw-r--r-- | doc/Makefile.am | 55 | ||||
-rw-r--r-- | doc/beam-backup.1in | 219 | ||||
-rw-r--r-- | doc/beam-cleaner.1in | 77 | ||||
-rw-r--r-- | doc/beam-list.1in | 74 | ||||
-rw-r--r-- | doc/beam-module.5in | 278 | ||||
-rw-r--r-- | doc/beam-restore.1in | 143 | ||||
-rw-r--r-- | doc/beam-s3.1in | 87 | ||||
-rw-r--r-- | doc/beam.1in | 146 | ||||
-rw-r--r-- | doc/beam.conf.5in | 537 | ||||
-rw-r--r-- | git2chg.awk | 76 | ||||
-rw-r--r-- | lib/App/Beam/Config.pm | 455 | ||||
-rw-r--r-- | lib/Makefile.am | 1 | ||||
-rw-r--r-- | lib/beam/.gitignore | 1 | ||||
-rw-r--r-- | lib/beam/Makefile.am | 33 | ||||
-rw-r--r-- | lib/beam/common.in | 253 | ||||
-rwxr-xr-x | lib/beam/fs.sh | 148 | ||||
-rwxr-xr-x | lib/beam/ldap.sh | 164 | ||||
-rwxr-xr-x | lib/beam/mysql.sh | 175 | ||||
-rwxr-xr-x | lib/beam/postgres.sh | 102 | ||||
-rw-r--r-- | lib/beam/s3.sh | 105 | ||||
-rw-r--r-- | list.in | 101 | ||||
-rw-r--r-- | restore.in | 165 | ||||
-rw-r--r-- | s3.in | 85 | ||||
-rw-r--r-- | t/config.t | 12 | ||||
-rw-r--r-- | t/f.conf | 6 |
39 files changed, 607 insertions, 3725 deletions
@@ -1,29 +1,12 @@ *~ .deps .emacs* -.libs -ABOUT-NLS -ChangeLog -INSTALL -Makefile -Makefile.in TAGS -aclocal.m4 -autom4te.cache -beam -beam.sh -build-aux -cleaner.sh -config.h -config.h.in -config.log -config.status -configure core -list.sh -backup.sh -restore.sh -s3.sh -build.sed *.tar.* tmp +/MYMETA.json +/MYMETA.yml +Makefile +/blib +/pm_to_blib diff --git a/MANIFEST b/MANIFEST new file mode 100644 index 0000000..211c165 --- /dev/null +++ b/MANIFEST @@ -0,0 +1,7 @@ +Changes +LICENSE +MANIFEST +Makefile.PL +README +lib/App/Beam/Config.pm + diff --git a/Make.rules b/Make.rules deleted file mode 100644 index cafa879..0000000 --- a/Make.rules +++ /dev/null @@ -1,22 +0,0 @@ -# This file is part of BEAM -# Copyright (C) 2012-2014 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/>. - -.in.sh: - $(AM_V_GEN)sed -f $(top_builddir)/build.sed $< > $@ -.1in.1: - $(AM_V_GEN)sed -f $(top_builddir)/build.sed $< > $@ -.5in.5: - $(AM_V_GEN)sed -f $(top_builddir)/build.sed $< > $@ diff --git a/Makefile.PL b/Makefile.PL new file mode 100644 index 0000000..80f5548 --- /dev/null +++ b/Makefile.PL @@ -0,0 +1,26 @@ +use strict; +use ExtUtils::MakeMaker; +use Module::Metadata; + +WriteMakefile(NAME => 'App::Beam', + VERSION => '1.6.90', + AUTHOR => 'Sergey Poznyakoff <gray@gnu.org>', + LICENSE => 'gpl_3', + ABSTRACT => 'Backup tool', +# EXE_FILES => [ 'beam' ], + MIN_PERL_VERSION => 5.006, + META_MERGE => { + 'meta-spec' => { version => 2 }, + resources => { + repository => { + type => 'git', + url => 'git://git.gnu.org.ua/beam.git', + web => 'http://git.gnu.org.ua/cgit/beam.git/', + }, + }, + provides => Module::Metadata->provides(version => '1.4', + dir => 'lib') + } + ); + + diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index 551f7b2..0000000 --- a/Makefile.am +++ /dev/null @@ -1,73 +0,0 @@ -# This file is part of BEAM -# Copyright (C) 2012-2014 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/>. -SUBDIRS=. lib doc -if COND_S3MOUNT - S3MOUNT=s3 - S3MOUNT_SH=s3.sh -endif -noinst_SCRIPTS=build.sed backup.sh restore.sh cleaner.sh list.sh $(S3MOUNT_SH) -bin_SCRIPTS=beam -CLEANFILES=beam beam.sh backup.sh restore.sh cleaner.sh list.sh $(S3MOUNT_SH) -install-exec-hook: - test -z "$(DESTDIR)$(libexecdir)" || \ - $(mkdir_p) "$(DESTDIR)$(libexecdir)"; \ - for file in backup restore cleaner list $(S3MOUNT); \ - do \ - ${INSTALL} $(top_builddir)/$$file.sh \ - $(DESTDIR)$(libexecdir)/beam-$$file; \ - done -install-data-hook: - test -z "$(DESTDIR)$(sysconfdir)" || \ - $(mkdir_p) "$(DESTDIR)$(sysconfdir)"; \ - if test -f $(DESTDIR)$(sysconfdir)/beam.conf; then :; else \ - ${INSTALL} -m 644 $(top_srcdir)/beam.conf $(DESTDIR)$(sysconfdir);\ - fi -uninstall-hook: - for file in backup restore cleaner list $(S3MOUNT); \ - do \ - rm -f "$(DESTDIR)$(libexecdir)/beam-$$file"; \ - done -beam.sh backup.sh restore.sh cleaner.sh list.sh $(S3MOUNT_SH): build.sed -EXTRA_DIST=beam.in backup.in restore.in beam.conf cleaner.in list.in s3.in -distuninstallcheck_listfiles=find $(DESTDIR)$(prefix) -type f -not -wholename '$(DESTDIR)$(sysconfdir)/beam.conf' - -$(top_builddir)/build.sed: Makefile - $(AM_V_GEN){ \ - echo 's|@''SYSCONFDIR''@|${sysconfdir}|g';\ - echo 's|@''LIBDIR''@|${libdir}|g'; \ - echo 's|@''BINDIR''@|${bindir}|g'; \ - echo 's|@''LIBEXECDIR''@|${libexecdir}|g'; \ - echo 's|@''LOCALSTATEDIR''@|${localstatedir}|g'; \ - echo 's|@''DATAROOTDIR''@|${datarootdir}|g'; \ - echo 's|@''PACKAGE_BUGREPORT''@|$(PACKAGE_BUGREPORT)|g'; \ - echo 's|@''PACKAGE_NAME''@|$(PACKAGE_NAME)|g';\ - echo 's|@''PACKAGE_STRING''@|$(PACKAGE_STRING)|g';\ - echo 's|@''PACKAGE_TARNAME''@|$(PACKAGE_STRING)|g';\ - echo 's|@''PACKAGE_URL''@|$(PACKAGE_URL)|g';\ - echo 's|@''PACKAGE_VERSION''@|$(PACKAGE_VERSION)|g';\ - } > $(top_builddir)/build.sed -DISTCLEANFILES=build.sed backup.sh restore.sh list.sh -include $(top_srcdir)/Make.rules - -.PHONY: ChangeLog -ChangeLog: - $(AM_V_GEN)if test -d .git; then \ - git log --pretty='format:%ct %an <%ae>%n%n%s%n%n%b%n' | \ - awk -f $(top_srcdir)/git2chg.awk > ChangeLog.tmp; \ - cmp ChangeLog ChangeLog.tmp > /dev/null 2>&1 || \ - mv ChangeLog.tmp ChangeLog; \ - rm -f ChangeLog.tmp; \ - fi diff --git a/backup.in b/backup.in deleted file mode 100644 index 477b839..0000000 --- a/backup.in +++ /dev/null @@ -1,144 +0,0 @@ -#! /bin/sh -# This file is part of BEAM -# Copyright (C) 2012-2014 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/>. - -libdir=@LIBDIR@/beam -set -e -. $libdir/common.sh -set +e -ts=`date +%Y%m%d`; -week=`date +%U` - -if [ "$1" = "--wtf" ]; then - wtf $(basename $0) create a backup - exit 0 -fi - -load_config -taroptions="-c -Hpax $backup_tar_options $backup_rsh_command" - -########################################################### -# Global variables -########################################################### - -# Set it to "-v" to make script verbose -if [ -n "$backup_verbose" ]; then - verbose=-v -else - verbose= -fi -# Set it to "echo" to initiate dry-run mode. -unset dry_run - -# Number of tar errors detected during the run -tarerror=0 - -level=0 -round=0 - -########################################################### -# Utility functions -########################################################### - -help() { - cat <<EOF -usage: $0 [OPTIONS] -makes incremental backup of that system - -OPTIONS: - - -v, --verbose increase verbosity - -l, --logfile FILE log to FILE (default $backup_logfile) - -n, --dry-run do nothing, print what would have been done - -N, --no-logfile log to stderr - -L, --level N create incremental dump level N - -R, --round N mark archives with incremental round N - --week N force using week number N instead of the current one - -h, --help produce this help list - -Report bugs to <@PACKAGE_BUGREPORT@> -EOF - exit 0 -} - -########################################################### -# Main -########################################################### - -while [ $# -ne 0 ] -do - case $1 in - -v|--verbose) verbose="$verbose -v";; - -l|--logfile) shift; backup_logfile=$1;; - -n|--dry-run) dry_run=echo; backup_logfile=;; - -N|--no-logfile) backup_logfile=;; - -h|--help) help;; - -V|--version) print_version;; - -L|--level) shift; level=$1;; - -R|--round) shift; round=$1;; - --week) shift; week=$1;; - *) echo >&2 "$0: unrecognized option $1"; exit 1;; - esac - shift -done - -backup() { - logit "started" - - runhook prologue_hook - trap "runhook epilogue_hook" EXIT INT QUIT TERM - - if test -n "$backup_retain_interval" && - test $backup_retain_interval -gt 0; then - @LIBEXECDIR@/beam-cleaner --retain $backup_retain_interval $verbose \ - ${dry_run+--dry-run} --suffix $backup_suffix $backup_archive_dir - @LIBEXECDIR@/beam-cleaner --retain $backup_retain_interval $verbose \ - ${dry_run+--dry-run} --suffix .db $backup_snapshot_dir - fi - - for item in $backup_items - do - eval type=\$${item}_type - ${type}_backup $item - done - - trap - EXIT INT QUIT TERM - runhook epilogue_hook - - logit "finished" -} - -umask ${backup_umask:-077} -prologue_hook="beam_lock $prologue_hook" - -if [ -n "$backup_logfile" ]; then - runhook openlog_hook - exec >>$backup_logfile - exec 2>&1 -fi -if [ -z "$backup_notify_email" ]; then - backup -else - report=$backup_snapshot_dir/report.$$ - touch $report - backup 2>&1 | tee $report - mail_report $report - rm $report -fi - - -# finis coronat opus - @@ -1,17 +1,3 @@ -# -*- shell-script -*- -# This is a sample config file for the backup system. Tailor it to your -# needs and remove the line below: -echo >&2 "$0: WARNING: using default configuration boilerplate" - -# This file is essentially a shell script defining variables used by -# the backup scripts. For a detailed information about it, see beam.conf(5) -# To debug the configuration, run "beam backup --dry-run" and -# "beam restore --dry-run". -# For a detailed descriptions of these commands, see beam(1). - -PATH=/usr/sbin:$PATH -export PATH - ########################################################################## # Hooks ########################################################################## @@ -25,195 +11,104 @@ export PATH # Commands listed in openlog_hook are run before opening the logfile. The # most common use for this hook is to rotate an oversized logfile prior to # opening it. -# -# Beam's default hook is beam_logrotate, which uses logrotate(8) to manage -# the log file. -openlog_hook=beam_logrotate -# Additional configuration for logrotate can be supplied in the -# backup_logrotate_conf variable. -backup_logrotate_conf="weekly -rotate 4 -" +[hook openlog] + command = beam_logrotate + # The prologue_hook is a list of commands to run before starting backup -# (or restore). -prologue_hook= +# (or restore). +[hook prologue] + command = # The epilogue_hook is a list of commands to run when the backup # (or restore) finishes. -epilogue_hook= - -########################################################################## -# Archivation setup -########################################################################## - -# Interval in weeks during which old backups and snapshots are retained. -# If zero or empty, backups are retained forever. -backup_retain_interval= - -# Directory for temporary files -backup_tmp_dir=/tmp - -########################################################################## -# S3 configuration. -########################################################################## - -# To use S3 as the backup storage, define this variable to the name of the -# bucket to keep backups in. -backup_bucket_name= - -# Mountpoint for the raw bucket. -backup_mp_s3backer=/mnt/s3backer -# Mountpoint for the actual file system. -backup_mp_s3=/mnt/s3 - -# Additional options to pass to s3backer. The use of --vhost option -# is advised if your bucket is located outside of the US region. -backup_s3backer_options="--vhost" - -# Additional options to pass to mount(8) -backup_s3_mount_options= - -########################################################################## -# Tar setup. -# -# Tar setup variables configure invocation of tar. -# -########################################################################## - -# Any additional options to pass to tar. Do not place tar operation -# switches (as -c, -t, etc.) here! These will be added automatically -# by appropriate scripts, depending on the operation being performed. -# -# By default this variable is empty (no additional options). -# -# In this example it is used to request bzip2 compression: -backup_tar_options="-j" - -# Suffix for archive files. -# Default is "tar" -# -backup_suffix="tar.bz2" - -# Directory where archive files are to be located. It's OK to specify -# a remote directory here, e.g. 10.10.0.1:/export/backup -# -# This variable must be set. Whatever directory it points to must already -# exist, the backup script won't create it. -# -# The only exception to this is when backup_bucket_name is defined. In -# that case, if backup_archive_dir is empty, it is assigned to the value -# of backup_mp_s3 variable. This directory will be created, if needed. -backup_archive_dir=/var/backups - -# Directory where to store snapshot files. The files will be named as -# their archive counterparts, with the suffix ".db". -# -# This variable must be set -backup_snapshot_dir=/var/lib/backups - -# Set this variable to a non-empty value if you wish backup procedures to -# be verbose. -backup_verbose= - -########################################################################## -# Backup items. -# -# Backup items are symbolic names that identify abstract objects that -# need to be backed up (or restored). These must be valid shell variable -# names. For each backup item <name>, this configuration file defines a -# set of variables which determine what files to backup and what methods -# to use for that. Each such variable is named <name>_<variable>, where -# <name> is the item name, and <variable> is the variable name. The set -# of variables needed depends on the type of each particular item. -# -########################################################################## - -# The following are sample entries. Be sure to edit them - -# Define the list of items to back up. -# This variable must be set. -backup_items="dbdump system" - -# For each item in $backup_items, at least its type (variable <item>_type) -# must be declared. Item type determines the mechanism used to back up -# and restore it. Valid item types are: -# -# fs back up a file system -# postgres back up a postgres database -# mysql back up a mysql database -# ldap back up an LDAP database -# -# You may define additional types, if you need. To do so, create an executable -# file named <type>.sh in the directory @LIBDIR@/beam. -# - -# Dump Postgres database "mydb". -# The <item>_database is the only variable required by type "postgres". -dbdump_type=postgres -dbdump_database="mydb" - -# Back up directories in the file system. -# The "fs" type requires at least to variables: -# -# <item>_dir specifies the directory (usually, but not necessarily a mount -# point), under which the directories and files to be backed up are located. -# -# <item>_files specifies a list of directories and/or files in that directory. - -system_type=fs -system_dir="/" -system_files="etc var/spool" - - -########################################################################## -# Mail notification setup. -# -# Apart from usual logging, backup reports can be sent via email. To -# enable this, define the variable "backup_notify_email" to the list -# of emails that should receive the reports. Separate multiple addresses -# with commas. -# -# A set of variables is provided to customize report headers and contents. -########################################################################## - -# Comma-separated list of emails to send backup reports to. If emply, -# mail notifications are not sent. -backup_notify_email= - -# Sender email address. Backup reports will appear to be sent from this -# address. The default value is root@$(hostname). -# If set, this variable must contain a single email address, without -# personal part or comments, e.g. -# backup_sender_email=root@example.com -backup_sender_email= - -# You can supply personal part of the sender email using this variable. -# The personal part will be enclosed in double quotes and prepended to -# the value of $backup_sender_email to form a valid RFC-2822 "From" header. -# For example, if you have: -# backup_sender_email=root@example.com -# backup_sender_personal="Automatic backup report" -# you will see the following in the report headers: -# From: "Automatic backup report" <root@example.com> -backup_sender_personal= - -# Supply any additional headers for the report message. By default, the -# following headers are generated: -# From, To, Subject, X-Beam-Items, X-Beam-Round and X-Beam-Level. -# The three X- headers contain the backed up items (as set in the -# backup_items variable), backup round and backup level numbers, -# correspondingly. -# -# To supply multiple headers, delimit them with a single newline character. -backup_report_headers= - -# The value of this variable is output before the actual report. -backup_report_intro= - -# The value of this variable is added at the end of the report. -backup_report_signature= +[hook epilogue] + command = + +[core] + # Interval in weeks during which old backups and snapshots are + # retained. + # If zero or empty, backups are retained forever. + retain-interval = + # Directory for temporary files + tempdir = /tmp + # Set to On, if you wish backup procedures to be verbose. + verbose = On + # List of items to backup + items = dbdump system + +[tar] + # Thes variables configure invocation of tar. + + # Any additional options to pass to tar. Do not place tar operation + # switches (as -c, -t, etc.) here! These will be added automatically + # by appropriate scripts, depending on the operation being performed. + # + # By default this variable is empty (no additional options). + # + options = -j + + # Suffix for archive files. + # Default is "tar" + # + suffix = tar.bz2 + + # Directory where archive files are to be located. It's OK to specify + # a remote directory here, e.g. 10.10.0.1:/export/backup + # + # This variable must be set. Whatever directory it points to must + # already exist, the backup script won't create it. + archive-dir = /var/backups + + # Directory where to store snapshot files. The files will be named as + # their archive counterparts, with the suffix ".db". + # + # This variable must be set + snapshot-dir = /var/lib/backups + +[item dbdump] + type = postgres + database = mydb + +[item system] + type = fs + directory = / + files = etc var/spool + +[report] + # Comma-separated list of emails to send backup reports to. If emply, + # mail notifications are not sent. + email = + + # Sender email address. Backup reports will appear to be sent from + # this address. The default value is root@$(hostname). + # If set, this variable must contain a single email address, without + # personal part or comments, e.g. + sender = + + # You can supply personal part of the sender email using this variable. + # The personal part will be enclosed in double quotes and prepended to + # the value of $backup_sender_email to form a valid RFC-2822 "From" + # header. + # For example, if you have: + # sender = root@example.com + # sender-personal = Automatic backup report + # you will see the following in the report headers: + # From: "Automatic backup report" <root@example.com> + sender-personal = + + # Supply additional header for the report message. By default, + # the following headers are generated: + # From, To, Subject, X-Beam-Items, X-Beam-Round and X-Beam-Level. + # The three X- headers contain the backed up items (as set in the + # backup_items variable), backup round and backup level numbers, + # correspondingly. + # + # Multiple headers statements are OK + header = X-My-Info: ok + + # Any text to be output before the actual report. + intro = + + # Text to be added at the end of the report. + signature = -# Reports are sent using this program. If not set, it defaults to -# /usr/sbin/sendmail -oi -t -F $backup_sender_email -# The generated report is piped to the standard input of this program. -backup_mailer_program= diff --git a/beam.in b/beam.in deleted file mode 100644 index 7281a18..0000000 --- a/beam.in +++ /dev/null @@ -1,73 +0,0 @@ -#! /bin/sh -# This file is part of BEAM -# Copyright (C) 2012-2014 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/>. - -libdir=@LIBDIR@/beam -set -e -. $libdir/common.sh -set +e - -help() { - cat <<EOT -usage: beam COMMAND [OPTIONS] [ITEM [ITEM...]] - -COMMANDS are: -EOT - for cmd in @LIBEXECDIR@/beam-* - do - test -x $cmd && $cmd --wtf - done - wtf help display help page for a particular command - echo "" - echo "Report bugs to <@PACKAGE_BUGREPORT@>" - exit 0 -} - -while [ $# -ne 0 ] -do - case $1 in - -h|--help) help;; - -V|--version) print_version;; - --) shift; break;; - -*) echo >&2 "$0: unrecognized option $1"; exit 1;; - *) break;; - esac - shift -done - -if [ $# -eq 0 ]; then - error "command not specified" - abend 1 "try $0 --help for more details" -fi - -if [ $1 = "help" ]; then - shift - if [ $# -eq 0 ]; then - man 1 beam - else - man 1 beam-$1 - fi - exit $? -fi - -if [ -x @LIBEXECDIR@/beam-$1 ]; then - cmd=@LIBEXECDIR@/beam-$1 - shift - $cmd $@ -else - error "unknown command" - abend 1 "try $0 --help for more details" -fi diff --git a/bootstrap b/bootstrap deleted file mode 100755 index 263737c..0000000 --- a/bootstrap +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -# Run this file to bootstrap a checked-out version of sources. -autoreconf -f -i -s diff --git a/cleaner.in b/cleaner.in deleted file mode 100755 index 1db87c1..0000000 --- a/cleaner.in +++ /dev/null @@ -1,117 +0,0 @@ -#! /bin/sh -# This file is part of BEAM -# Copyright (C) 2012-2014 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/>. - -libdir=@LIBDIR@/beam -set -e -. $libdir/common.sh -set +e - -dir= -suffix= -retainweeks=3 -dry_run= -verbose=: - -help() { - cat <<EOF -usage: $0 [OPTIONS] DIR -cleans up old backup files in DIR - -OPTIONS are: - -s, --suffix SUF consider only file names ending in SUF - -r, --retain N retain N last weeks of backups (default $retainweeks) - -v, --verbose verbosely list what is being done - -n, --dry-run do nothing, print what would have been done - -h, --help print this help list - -EOF - exit 0 -} - -while [ $# -ne 0 ] -do - case $1 in - -s|--suffix) shift; suffix=$1;; - -r|--retain) shift; retainweeks=$1;; - -v|--verbose) ver |