aboutsummaryrefslogtreecommitdiff
path: root/restore.in
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2014-03-19 07:44:16 +0200
committerSergey Poznyakoff <gray@gnu.org>2014-03-19 07:44:16 +0200
commit22cddd5c61d150584a065c1a5e6963e8e95a43cb (patch)
tree86859e8dc93677226d668cd20a71f805d99181eb /restore.in
parent10d30373c6fdf0dd23f16251fa2302c18b7eef97 (diff)
downloadbeam-22cddd5c61d150584a065c1a5e6963e8e95a43cb.tar.gz
beam-22cddd5c61d150584a065c1a5e6963e8e95a43cb.tar.bz2
Use uniform indentation, add missing copyleft headers, update years.
Diffstat (limited to 'restore.in')
-rw-r--r--restore.in104
1 files changed, 52 insertions, 52 deletions
diff --git a/restore.in b/restore.in
index c1dc0c6..8618e2d 100644
--- a/restore.in
+++ b/restore.in
@@ -21,8 +21,8 @@ set -e
set +e
if [ "$1" = "--wtf" ]; then
- wtf $(basename $0) create a backup
- exit 0
+ wtf $(basename $0) create a backup
+ exit 0
fi
load_config
@@ -37,16 +37,16 @@ listonly=
confirm=1
getyn() {
- echo -n "$0:" $* " [Y/n]? "
- read REPLY
- case $REPLY in
- ''|y*|Y*) REPLY=y;;
- *) REPLY=n;;
- esac
+ echo -n "$0:" $* " [Y/n]? "
+ read REPLY
+ case $REPLY in
+ ''|y*|Y*) REPLY=y;;
+ *) REPLY=n;;
+ esac
}
help() {
- cat <<EOT
+ cat <<EOT
usage: restore [OPTIONS] [ITEM [ITEM...]]
restores this system from a backup
@@ -66,34 +66,34 @@ Valid ITEMs are: $backup_items
Report bugs to <@PACKAGE_BUGREPORT@>
EOT
- exit 0
+ 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
+ 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"
+ taroptions="$taroptions -x"
else
- taroptions="$taroptions -t"
+ taroptions="$taroptions -t"
fi
# Collect items to be restored.
@@ -102,9 +102,9 @@ items=$*
test -z "$items" && items="$backup_items"
if [ -n "$logfile" ]; then
- confirm=0
- exec >>$logfile
- exec 2>&1
+ confirm=0
+ exec >>$logfile
+ exec 2>&1
fi
runhook prologue_hook
@@ -112,32 +112,32 @@ 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
+ 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 \
+ 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"
+ 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 \
+ 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"
+ 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"
@@ -145,16 +145,16 @@ 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
+ 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
+ eval type=\$${item}_type
+ ${type}_restore $item
done
trap - EXIT INT QUIT TERM

Return to:

Send suggestions and report system problems to the System administrator.