22 Customization

Contents of this section

Apart from editing the /etc/tbackup/Config file and creating directory sets, it also possible to change the (default) behavior of tbackup, trestore, tlist and tguess by placing some files in /etc/tbackup.

22.1 Changing the default values for the parameters.

You can change the default answers for the questions that tbackup asks you by supplying new default values in the configuration file /etc/tbackup/tbackup.dea.

The easiest way of making such a file is to run the command tbackup pars. The pars option changes the behavior of tbackup: after asking for parameters it does not begin with a backup, but in stead writes the supplied parameters to a file.

#tbackup pars
 ^^^^^^^^^^^^
Available choose methods:
   1 one -- one user specified file or directory and below

[etc.]

Verify after write to disk?---> (y/n) [n] y
                                          ^
Make a backup index file ---> (y/n) [y] n
                                        ^
The supplied parameters are recorded in the file /etc/tbackup/allpars.
 
Cleaning up....
#
The file /etc/tbackup/allpars now contains a description of all the answers you gave. Each line contains one parameter setting, the parameters occur in the order in which you answered the questions.
#Result of running tbackup pars.
#
#  Lines are of the form "export < prefix>< parametername>=< value>".
#  Prefixes: dea_  means set default value of parameter .. to ..
#            pre_  means preset parameter .. to ..
#       checkpre_  means preset parameter .. to .. and check if valid.
 
export dea_choosemethod=set
export dea_setname=mystuff
export dea_level=f
export dea_packmethod=afio
export dea_writemethod=floppy
export dea_mnr=0
export dea_mdens=d
export dea_formatalways=n
export dea_verifywrite=y
export dea_makeindexfile=y
The file is actually a shell script. The line
export dea_verifywrite=y
is an instruction to tbackup, that tells it to use y as the default (dea_) answer to the verifywrite question, so that it becomes
Verify after write to disk?---> (y/n) [y]
                                      ^^^ 
In order for tbackup to read these instructions when it starts, you have to copy the contents of /etc/tbackup/allpars to the /etc/tbackup/tbackup.dea (tbackup defaults) file. So just type
cd /etc/tbackup
cp allpars tbackup.dea 
and the parameters you have supplied on running tbackup pars will be used as default values. It usually makes sense to do some further editing on the tbackup.dea file, e.g. to delete the line
export dea_setname=mystuff
so that tbackup does not supply a default directory set name. Sometimes it is useful to combine the results of running tbackup pars several times in one tbackup.dea file.

All the above also goes for the trestore, tlist, tverify, and tguess commands. To change the default parameters of trestore, you need to

trestore pars
 [supply new default parameters]
cd /etc/tbackup
cp allpars trestore.dea
            ^^^^^^^
and optionally delete some lines in the trestore.dea file.

22.2 Presetting parameters.

If you always find yourself giving the same answer to some of the questions tbackup asks, you may want to configure tbackup to skip these questions by `presetting' the answers.

This can be done by editing the tbackup.dea (trestore.dea) file you get by the procedure above.

To preset the answer to the verify after write to disk question to y, simply edit the line

export dea_verifywrite=y
in /etc/tbackup/tbackup.dea to read
export pre_verifywrite=y
       ^^^ 
A pre_ (preset) line instructs tbackup to skip the corresponding question and use the value after the = sign for the parameter.

My own tbackup.dea file is

export pre_mnr=1
export pre_formatalways=n
export pre_verifywrite=n
as I always make my backups with drive 1, and never want to format and verify the disks. (The format and verify settings can of course still be changed with the `options' menu while making a backup.) I don't have any dea_ lines in my tbackup.dea file, as the standard default parameters work fine for me :-)

Again, presetting parameters also works for trestore, tlist and tguess.

22.3 Checked presets.

If you specify an impossible value in a preset, e.g.

export pre_verifywrite=42 
you will get unpredictable results when running tbackup. By default tbackup does not check if preset values are legal, it assumes that you know what you are doing. If you want a preset to be checked for validity, set it with the command
export checkpre_setname=systme
       ^^^^^^^^
A checkpre_ argument is processed in a verbose way that makes it easy to interactively correct it if it is illegal:
Available directory sets:
1    mystuff    # my stuff in the /root directory.
2    system     # system files
3    test       # test set 
Enter set name or number -[preset as]-> systme
No such directory set.
Enter set name or number ---> system
                              ^^^^^^
Checked presets are mainly useful when you run tbackup from another script, and in command line argument scripts.

22.4 Making command line arguments.

If you supply command line arguments (other than pars) to tbackup, e.g

tbackup aaa bbb
or
tbackup -aaa -bbb 

then tbackup will process these arguments by executing the files /etc/tbackup/aaa.arg and /etc/tbackup/bbb.arg before asking any questions. (If these files don't exist you will get an error message.)

These files can contain customized parameter defaults or presets, just like tbackup.dea. For example, there is a file /etc/tbackup/1d.arg which contains

#Argument file (used by `tbackup 1d').
#Backs up directory set to disk 1, double density format.
#Presets various other parameters.
export pre_choosemethod=set
export pre_packmethod=afio
export pre_writemethod=floppy
export pre_mnr=1
export pre_mdens=d
export pre_errcorrect=y
export pre_formatalways=n
export pre_verifywrite=n
export pre_makeindexfile=y
export pre_autoindexname=y
so that typing
tbackup 1d
makes a backup (with methods set, afio, and floppy) to DS/DD disks in drive 1. The pre_ instructions in 1d.arg preset various parameters to their appropriate value.

The standard tbackup installation comes with the 4 preconfigured argument files in /etc/tbackup: 0d.arg, 0h.arg, 1d.arg and 1h.arg. More examples of arguments can be found in /usr/lib/tbackup/examples.

You can make you own argument file by using the command tbackup makearg and editing the .arg file which is created in /etc/tbackup. Again, such .arg files can also be made for trestore, tlist, tverify, and tguess.

The .arg files are read after the /etc/tbackup.dea file (if present) so that pre_ instructions in the argument file take precedence over the pre_ or dea_ instructions in the tbackup.dea file.

You can not `unpreset' a parameter by putting an

export dea_verifywrite=n
line in an .arg file. To turn off a preset made in tbackup.dea you need to add a line reading
unset pre_verifywrite
^^^^^^^^^
to the .arg file.

Next Chapter, Previous Chapter

Table of contents of this chapter, General table of contents

Top of the document, Beginning of this Chapter