This file is indexed.

/usr/bin/vbackup-wizard is in vbackup 1.0.1-1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
#!/bin/bash
#
# Copyright (C) 2006-2012 Stefanos Harhalakis
#
# This file is part of vbackup.
#
# vbackup 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 of the License, or
# (at your option) any later version.
#
# vbackup 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 vbackup  If not, see <http://www.gnu.org/licenses/>.
#
# $Id$
#
# A helper wizard for creating initial configuration
#

prefix="/usr"
datarootdir="${prefix}/share"
datadir="${datarootdir}"
myhelperdir="${datarootdir}/vbackup/helpers"

. $myhelperdir/common

do_version_head()
{
	cat << _END
$PACKAGE_NAME v$PACKAGE_VERSION
_END
}

do_version_bugreport()
{
	cat << _END
Report bugs to $PACKAGE_BUGREPORT
_END
}

# Show version and copyright information
do_version()
{
	cat << _END
$PACKAGE_NAME v$PACKAGE_VERSION Copyright (c) 2006-2012 Harhalakis Stefanos \
$PACKAGE_BUGREPORT

    This program 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 of the License, or
    (at your option) any later version.

    This program 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.

Report bugs to $PACKAGE_BUGREPORT

_END
}

# Show generic help
do_help()
{
	do_version_head
	cat << _END
Usage:
	vbackup-wizard
		Perform basic vbackup(8) configuration.

     or vbackup --help
                To get this help
_END
	do_version_bugreport
	exit 0
}

get_vbackup_conf()
{
	[ -z "$1" ] && h_fatal 1 "WTF? BUG!"
	(

	RET=""
	while [ -z "$RET" ] ; do
		h_ask_str \
"vbackup stores all backups under a common directory prefix. Please enter a
prefix where all backups will be placed under. Be carefull not to use a path
that is been backed up or you will create a backup paradox.

The best place to store backups is an external disk or a remote directory that
is localy mounted" \
			"Where to place backups?"
	done
	DESTDIR0="$RET/%D1%-%L%"
	
	cat << _KOKO > "$1"
# Per backup global configuration file
#
# This file holds per-backup configuration options

# A directory where backups will be stored
# All other DESTDIR directives are relative to this one
DESTDIR0=$DESTDIR0

# Compress backups? (yes/no)
COMPRESS="yes"

_KOKO
	)
}

do_run()
{
	h_ask_txt \
"Welcome to vbackup initial configuration wizard.
Your configuration files will be stored under:
$myconfdir

You'll now be asked a series of questions.
Default answers will be shown in brackets. You can accept them by pressing
enter."

	read -rp "Press enter to continue..." a

	cd "$wizdir"

	# We will need stdin
	exec 9<&0

	# Create a temporary directory
	T=`mktemp -d`
	if [ -z "$T" ] ; then
		h_fatal 1 "Failed to create temporary directory!"
	fi

	mkdir "$T/cfg"
	mkdir "$T/enabled"

	# Ask a name for the backup
	h_ask_str \
"You can have unlimited number of backup stategies. Each strategy must have a
unique name that will be used to distinguish it. It is possible to have a
blank strategy name which is fine for most cases and serves as the default." \
		"Enter the backup strategy name" \
		""
	STRATEGY="$RET"
	DESTBASE="$myconfdir/backup.$STRATEGY"
	RCDIR="rc.${STRATEGY}.d"
	RCD="$myconfdir/$RCDIR"
	# Check if it exists
	if [ -e "${DESTBASE}0" ] || [ -e "${DESTBASE}5}" ] ||
		[ -e "$RCD" ] ; then
		# Find a free dirname to move it to
		TNAME="$myconfdir/old"
		CNT=0
		while [ -e "$TNAME" ] ; do
			let CNT+=1
			TNAME="$myconfdir/old$CNT"
		done

		if ! h_ask_yesno \
"A backup strategy with that name already exists. I can move the existing
strategy to $TNAME. You will have to delete it yourself if it is not needed
any more" \
			"Do you want to move the existing strategy out of the way?" \
			"y" ; then
			h_msg 0 \
"
Re-run this wizard to start over
"

			# Remove tmp dir
			rm -rf "$T"

			exit 1
		fi

		if ! mkdir "$TNAME" ; then
			h_msg 2 "Failed to create directory $TNAME"
			rm -rf "$T"
			exit 1
		fi

		mv "${DESTBASE}0" "$TNAME"
		mv "${DESTBASE}5" "$TNAME"
		mv "$RCD" "$TNAME"
	fi

	# Run the wizards
	while read -r fn ; do
		(
		. "$fn"

		CFG="$T/cfg/$PRI-$NAME"

		ASK_NEXT="ENABLE"
		while ! [ -z "$ASK_NEXT" ] ; do
			w_do_ask "$ASK_NEXT"
			R="$?"
		done

		# Prepend an explanatory line
		(echo "# Auto-created - See sample.$NAME for information"
		 test -f "$CFG" && cat "$CFG" ) > "$CFG.new"
		mv -f "$CFG.new" "$CFG"

		# Keep the state of enabled methods
		# Remove this config file if not needed
		if [ "$R" = "0" ] ; then
			touch "$T/enabled/$NAME"
		else
			rm -f "$CFG"
		fi
		) <&9
	done < <( $GFIND . -maxdepth 1 \( -type f -or -type l \) -name '*-*' |\
			sort)

	# Get a temporary file
	T2=`mktemp -p /tmp/`

	# Create configuration
	while read -r fn ; do
		(
		MULTI=""

		. "$fn"

		if ! test -f "$T/enabled/$NAME" ; then
			exit
		fi

		CFG="$T/cfg/$PRI-$NAME"

		# Empty the file
		: > $T2

		# Get config
		w_get_config > $T2

		if ! [ -s "$T2" ] ; then
			rm -f "$T2"
			continue
		fi

		# Create the rc.d entry
		DCFG="$T/final/rc.d"
		test -d "$DCFG" || mkdir -p "$DCFG"

		TNAME="$PRI-$NAME.$NAME"
		cat $T2 > "$DCFG/$TNAME"
		) <&9
	done < <( $GFIND . -maxdepth 1 \( -type f -or -type l \) -name '*-*' |\
			sort)

	# Create vbackup.conf
	get_vbackup_conf "$T2"
	DCFG="$T/final/rc.d"
	cp "$T2" "$DCFG/vbackup.conf"

	# Move configuration to final directory
	DCFG="$T/final/rc.d"
	mv "$DCFG" "$RCD"

	if ! -z "$STRATEGY" ; then
		STRATEGY="$STRATEGY "
	fi

	h_ask_txt \
"Done! You can now create level 0 backups by running:

# vbackup ${STRATEGY}0

and level 5 backups by running:

# vbackup ${STRATEGY}5

Level 5 backups are incremental backups. This means that they only store
differences from the last level 0 backup. This is only possible for filesystem
backups. For all other cases where an incremental backup is not possible (like
database backups) a full backup will be made. To restore a level 5 backup you
also have to have the level 0 backup. This means that you may only delete
older same-level backups.

All configuration options are placed under $myconfdir
If you want to further customize the backup procedure you will have to have
a look at the documentation. All configuration options are documented at
plugin help screens and in the sample configuration files. You can get a list
of available plugins by running:

# vbackup --list

You can get further information about each plugin by running

# vbackup --help <plugin name>

After using vbackup feel free to send feedback to v13@v13.gr
Since this is work-in-progress, this will greatly affect the way vbackup
is developed and what new features will be available in the near future." | more
}

case "$1" in
	--help)
		do_help
		;;
	-*)
		do_help
		;;
	*)
		do_run "$1"
		;;
esac