aboutsummaryrefslogtreecommitdiff
path: root/restore.in
diff options
context:
space:
mode:
Diffstat (limited to 'restore.in')
-rw-r--r--restore.in165
1 files changed, 0 insertions, 165 deletions
diff --git a/restore.in b/restore.in
deleted file mode 100644
index 8618e2d..0000000
--- a/restore.in
+++ /dev/null
@@ -1,165 +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
-
-if [ "$1" = "--wtf" ]; then
- wtf $(basename $0) create a backup
- exit 0
-fi
-
-load_config
-taroptions="$backup_tar_options $backup_rsh_command"
-
-# Options
-root=/
-verbose=
-logfile=
-dry_run=
-listonly=
-confirm=1
-
-getyn() {
- echo -n "$0:" $* " [Y/n]? "
- read REPLY
- case $REPLY in
- ''|y*|Y*) REPLY=y;;
- *) REPLY=n;;
- esac
-}
-
-help() {
- cat <<EOT
-usage: restore [OPTIONS] [ITEM [ITEM...]]
-restores this system from a backup
-
-OPTIONS:
- -c, --confirm do not ask for confirmation; run straight into restoring
- -C, --directory DIR restore into directory DIR instead of $root
- -v, --verbose increase verbosity
- -n, --dry-run do nothing, print what would have been done
- -t, --list list archives, instead of extracting
- -l, --logfile FILE log to FILE
- -L, --level N set incremental dump level to stop at
- -R, --round N use archives from incremental round N
- -W, --week N use archives from week N
- -h, --help produce this help list
-
-Valid ITEMs are: $backup_items
-
-Report bugs to <@PACKAGE_BUGREPORT@>
-EOT
- exit 0
-}
-
-while [ $# -ne 0 ]
-do
- case $1 in
- -C|--directory) shift; root=$1;;
- -c|--confirm) confirm=0;;
- -v|--verbose) verbose="$verbose -v";;
- -t|--list) listonly=1;;
- -l|--logfile) shift; logfile=$1; confirm=0;;
- -n|--dry-run) dry_run=echo;;
- -h|--help) help;;
- -V|--version) print_version;;
- -L|--level) shift; level=$1;;
- -R|--round) shift; round=$1;;
- -W|--week) shift; week=$1;;
- --) shift; break;;
- -*) echo >&2 "$0: unrecognized option $1"; exit 1;;
- *) break;;
- esac
- shift
-done
-
-if [ -z "$listonly" ]; then
- taroptions="$taroptions -x"
-else
- taroptions="$taroptions -t"
-fi
-
-# Collect items to be restored.
-items=$*
-
-test -z "$items" && items="$backup_items"
-
-if [ -n "$logfile" ]; then
- confirm=0
- exec >>$logfile
- exec 2>&1
-fi
-
-runhook prologue_hook
-trap "runhook epilogue_hook" EXIT INT QUIT TERM
-
-# Guess missing values
-if [ -z "$week" ]; then
- hour=$(date +%H)
- if [ $hour -gt 6 ]; then
- week=$(date +%U)
- else
- week=$(date -d yesterday +%U)
- fi
-fi
-
-if [ -z "$round" ]; then
- round=$(beam_exec find $backup_local_archive_dir \
- -regex '.*-'$week'-[0-9][0-9]*-[0-9][0-9]*\..*' \
- -printf '%f\\n' |
- sed 's/.*-'$week'-\([0-9][0-9]*\)-[0-9][0-9]*\..*/\1/' |
- sort +0 -1 |
- tail -1)
- test -z "$round" && abend 1 "cannot determine last round number"
-fi
-
-if [ -z "$level" ]; then
- level=$(beam_exec find $backup_local_archive_dir \
- -regex '.*-'$week-$round'-[0-9][0-9]*\..*' \
- -printf '%f\\n' |
- sed 's/.*-'$week-$round'-\([0-9][0-9]*\)\..*/\1/' |
- sort +0 -1 |
- tail -1)
- test -z "$level" && abend 1 "cannot determine last level number"
-fi
-
-echo "$0: target root directory $root"
-echo "$0: items to be restored: $items"
-echo "$0: restoring from week $week, round $round, level $level"
-
-if [ $confirm -ne 0 ]; then
- getyn "Do you wish to proceed"
- test $REPLY = "n" && exit 0
-fi
-
-logit "started"
-
-for item in $items
-do
- eval type=\$${item}_type
- ${type}_restore $item
-done
-
-trap - EXIT INT QUIT TERM
-runhook epilogue_hook
-
-logit "finished"
-
-

Return to:

Send suggestions and report system problems to the System administrator.