pkgBackup - A Perl script for selectively backing up an RPM-based or DEB-based system.
At least one of the following action options must be present:
--build_package_list --scan_pkgfiles --write_archive_manifest --do_backup
--new_archive
--update_package_list --write_archive_manifest --do_backup
When this option is not specified, a previously saved version of the package list is loaded. The program will abort with an error if no such version exists.
When this option is not specified, a previously saved version of the backup list is loaded. The program will abort with an error if no such version exists.
Use this option whenever you have installed new RPM/DEB packages between backups.
Because this option scans the entire filesystem and the entire RPM/DEB package database, it is very load-intensive and takes some time to complete.
--scan_rpms
, write a manifest of files to
backup. This manifest is handed to the --files-from
option of the
archive
action (see below).
One can also specify directories to exclude from and explicitly include in the manifest.
The --do_backup
option and its aliases (see below) imply this option.
--write_archive_manifest
option. Note
that this does not verify the (GNU-tar
, cpio
, etc.) archive itself for
errors; it's for verifying the results of this script.
You may also include the following modifier options (they are not required):
--verbose
option to the archive command called by the --do_backup
action.
Note that you can also specify the name of the configuration file as a plain commandline argument.
--update_package_list
, including implicit ones. Use this with the
--incremental
option to skip the ``Update Package List'' phase and restrict
the backup to modified files only.
--do_backup
to do a full backup. Only affects the --do_backup
option and its aliases. This is the default behavior if the backup archive
doesn't exist.
Use this with the --incremental
option to override its default
(which is to have --do_backup
do an incremental backup).
You may also use the following additional action options (they are not required, but exist for convenience):
They are documented in greater detail in the DESCRIPTION section of the full manpage.
Most backup systems assume that you will be archiving all (or nearly all) of the files on your filesystem to some form of tape drive. This is a reasonable assumption for corporate environments or large servers, but what about the ``home'' Linux user? Most home/hobby users will not have a high-capacity tape jukebox, let alone a single-tape 10Gb tape backup drive. They will usually have a CD-RW drive. Faced with daunting task of backing up 3Gb or more to multiple CDs, these home/hobby users simply ignore the chore of backing up their system.
And why should these users back up their systems? Aside from the contents of ``/home'' and ``/tmp'', little else on the filesystem will have changed since they installed the software from the packages. To compound the problem, users migrating from the Winblows world have long since given up all hope of backing up software configurations. Consider, too, that reinstalling packages takes about as much time as restoring a backup from a CD-R.
Nevertheless, these home & hobby users still should do backups. With current Linux packaging software, there's no reason why they can't.
This Perl script contains a modular set of tools for backing up files on your system:
The aforementioned ``modular set of tools'' are the action options, described in the OPTIONS. Each action has certain dependencies on others. Additionally, the script performs the actions in a specific sequence. The order in which you specify the action options on the commandline has no bearing on their execution order.
This is the order in which the action options execute. Listed with them are the operations that take place as part of that option, or as an alternative, if any:
--build_master_list
Build the Master List
--update_package_list
Read the Master List from disk (written there by previous run of this script). Then, update the Master List.
--scan_rpms
(Also does this if the --build_master_list
option is specified.)
--update_package_list
found any new packages, scan each of them for
modified member files.
--build_master_list
or --update_package_list
was used,
save the Master List to a file.
--write_archive_manifest
/bin/sh
scripts) for files not
requiring full archiving.
--do_backup
Call the archiver. Performs a full backup if --new_archive
was specified.
Otherwise, the backup is incremental.
Presently, the archiver is the GNU tar
program with bzip2
compression.
One can easily use a different archiver by creating a new module and loading
it in place of tarBackupUtils.pm
.
--verify
Verifies against the appropriate --write_archive_manifest
file, based on
the specified archive name.
Each option depends on the successful completion of the previous one. Some have even stronger interdependencies. Specifically:
--build_master_list
requires --scan_rpms
--do_backup
requires --write_tarlists
To make life easier on you, forgetting these requirements doesn't generate an error. Instead, specifying an action option also activates any action options it requires.
Some other action options:
This option implies the --scan_rpms
option. (I.e. it acts as if you
also specified --scan_rpms
, whether you did or not.)
When this option is not specified, a previously saved version of the Master List is loaded. The program will abort with an error if no such version exists.
Because this option scans the entire filesystem and the entire RPM/DEB package database, it is very load-intensive and takes some time to complete.
--build_master_list
. After
the update, the Master List is saved to a file.
This option does nothing when --build_master_list
(or one of its aliases) is
specified.