blob: 1452a9dcf2e978d995b97c2f1777d61a5edfc9fe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
#! /bin/sh
# 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/>.
libdir=@LIBDIR@/beam
set -e
. $libdir/common.sh
set +e
if [ "$1" = "--wtf" ]; then
wtf $(basename $0) list what is included in backups
exit 0
fi
help() {
cat <<EOF
usage: $0
list what is included in backups
OPTIONS:
-l, --number produce a numbered list
-h, --help produce this help list
-V, --version print program version
Report bugs to <@PACKAGE_BUGREPORT@>
EOF
exit 0
}
###########################################################
# Main
###########################################################
numbered_list=
while [ $# -ne 0 ]
do
case $1 in
-l|--number) numbered_list=1;;
-h|--help) help;;
-V|--version) print_version;;
*) echo >&2 "$0: unrecognized option $1"; exit 1;;
esac
shift
done
load_config
if [ -z "$backup_items" ]; then
echo "Nothing is being backed up"
fi
delayed_exit=
loaded_types=
if test -n "$numbered_list"; then
n=0
fi
prefix=
for item in $backup_items
do
eval type=\$${item}_type
if [ -z "$type" ]; then
error "${item}_type not set"
delayed_exit=1
continue
fi
if echo "$loaded_types" | grep -wq $type; then
:
elif [ -x $libdir/${type}.sh ]; then
. $libdir/${type}.sh || delayed_exit=1
loaded_types="$loaded_files
$type"
else
error "$libdir/${type}.sh not found"
delayed_exit=1
fi
if test -n "$numbered_list"; then
n=$((n + 1))
prefix="$n. "
fi
${type}_list $item "$prefix" || delayed_exit=1
done
test -n "$delayed_exit" && abend 1 "aborting"
exit 0
|