#!/bin/sh
set -e    # Exit immediately if a command exits with a non-zero status


# backup configuration and other files which need to be reinstalled,
# after reinstalling linux, before we can restore from tape.


FLOPPY=/floppy  # floppy mount point
FILENAME=n.tgz  # name of archive file to be written to floppy


echo
echo
echo insert config files floppy and press enter
read REPLY
set -x  # echo all commands
mount $FLOPPY
cd /
tar --create --no-recursion --blocking-factor=1 --file=- \
  dos/autoexec.bat \
  dos/config.sys \
  dos/os/linux/2419 \
  dos/os/linux/lm.bat \
  dos/os/linux/loadlin.exe \
  etc/bashrc \
  etc/conf.modules \
  etc/exports \
  etc/fstab \
  etc/gpm \
  etc/host.conf \
  etc/hosts \
  etc/hosts.allow \
  etc/hosts.deny \
  etc/inittab \
  etc/linux \
  etc/profile \
  etc/rc.d/rc \
  etc/rc.d/rc.local \
  etc/rc.d/rc.sysinit \
  etc/resolv.conf \
  root/Paranoidbackup/all/config \
  root/Paranoidbackup/all/mdti/config \
  root/Paranoidbackup/all/mdti/start \
  root/Paranoidbackup/paranoidbackup.pl \
  root/Paranoidbackup/pbui \
  root/Paranoidbackup/kxarc \
  root/Paranoidbackup/config_defaults \
  root/Paranoidbackup/config_kxarc \
  root/Paranoidbackup/mdti.drive.pl \
  p/pbui \
    | gzip -9 > $FLOPPY/$FILENAME
umount $FLOPPY

exit




The purpose of doing backups is so that you can do restores if your hard
drive crashes. Unfortunately, some files must be restored before you can
do a restore with Paranoid Backup. These files include the Paranoid Backup
program files, configuration files, modules, devices, a custom kernel,
etc. These files should be saved somewhere where they can be restored
easily, like onto a floppy disk; that is what this shell script is
supposed to do.

Take a piece of paper and write out the instructions for restoring, and
store the piece of paper with the restore files floppy. Or write the
instructions on the label of the floppy. For example:
reformat and repartition hard drive
reinstall linux
insert config files floppy
cd /
mount -t auto /dev/fd0 /floppy
tar -xzf /floppy/n.tgz
umount /floppy
pbui   (select restore)

If Paranoid Backup is part of your Linux distribution, then you can skip the
commands to restore the configuration files, because those commands are
built into pbui. However, if Paranoid Backup is not part of your Linux
distribution, then you will not be able to use pbui until after you have
restored your configuration files; therefore you will not be able to use
pbui to restore your configuration files.

Note that in the example for restoring the configuration files, I gave the
mount command both the device and mount point. That is because mount may be
unable to get the mount information from /etc/fstab, because /etc/fstab may
have been lost in the hard drive crash and probably has not been restored
yet.

The list of configuration files is right below the tar command above. You do
know that a backslash at the end of a line means line continuation, don't
you? The list which I am distributing with Paranoid Backup is the list which
I actually use. You will probably have to edit this list.

In general, you should include any of the Paranoid Backup files which you
have changed, like all/config and all/mdti/config. You do not need to
include all/directory_exclude and all/include_exclude because these files
are not used in a restore. You may need to include devices or modules for
your tape driver. If you are using the tape devices and modules included
with your linux distribution, you do not need to include them because they
will be reinstalled when you reinstall linux. But if you have upgraded or
customized your tape driver, then you probably need to include modules, and
maybe devices, and maybe your custom kernel. If you created /dev/tape as a
link to your tape device, then you probably need to include /dev/tape.
If you are using kerneld to load modules automatically, and have put
tape driver parameters into /etc/conf.modules, then you probably need to
include /etc/conf.modules. You may want to include /etc/fstab also. If
your network is involved in your backups, you should include your network
configuration files also.

If Paranoid Backup is not part of your linux distribution, then you are
going to have to reinstall Paranoid Backup before you can do a restore.
Probably it will be easier to include the Paranoid Backup files with the
config files; then you can restore Paranoid Backup and its config files at
the same time. You do not need to include all the Paranoid Backup files,
just the ones used in a restore; and the rest of the Paranoid Backup files
can be restored with everything else. You need paranoidbackup.pl, the mdti
server, the archive program, pbui, and all config files referenced by the
main config file. You should also include paranoidbackup.text; it is not
needed but it includes some suggestions on what to do if you have trouble
restoring.

You could also include all/mdti/index. If you include all/mdti/index, you
should remember to backup configuration files every time the index changes,
and remember the index changes every backup. You do not need to include the
index if your server is able to recreate the index from the disks/tapes. The
tape server included with Paranoid Backup can recreate the index; the disk
server can not. The drive server does not use all/mdti/index.

Whenever you make changes to the configuration of Paranoid Backup, you
should backup the config files. However, if the old configuration will work
for a restore, then you do not have to backup the new configuration; after
the hard drive crashes you can restore the old configuration, do a restore,
and the restore should restore the new configuration.

Since these files are backed up seperately, you could exclude them from
regular backups. However, these files probably do not take up much space, so
it may not be worth the trouble to exclude them. Also, you might not
remember to backup these files when you change one of the Paranoid Backup
configuration files; in this case if you did NOT exclude these files, then
if your hard drive crashes, you can still restore the old versions of these
files, do the regular restore with the old versions, and the regular restore
will restore the new versions of these files. That is assuming both versions
work.
