PARCpkgu
Some shells procedure to help saving and restoring
existing files
for package under Solaris.
Use at your own risk!
:-)
All comments are welcome: chouanard@parc.xerox.com
. Flame to /dev/null
Introduction:
This package contains in fact one shell script installed under /usr/bin/PARCpkgu.
It defined some shells function which can be called at the installation
or remove time of other packages. These functions provide a simple way
to deal with the deletion or replacement of some existing, and handle the
backup and restoration of these file at the install or remove step.
It's just a tools to spend less time on the real packages :-)
See the SECclean
package sources for an example on how to use PARCpkgu.
Here is a quick description of the different procedure defined in this
shell script.
How to use it?
If you want to use these tools in a package, don't forget to make a dependency
on PARCpkgu and to start each shell script of this package (postinstall,
postremove, preremove ...) by a
. /usr/bin/PARCpkgu
to define these procedures!
If you need to get some debug help, create a file names /var/tmp/PARCpkgu.
The execution of /usr/bin/PARCpkgu will do a 'set -x' to enable a more
verbose output!
Install_file( <pathname>);
The argument is the pathname of the file to be installed. A corresponding
file, with a name prefixed by "${PKGINST}_" must have been defined in the
prototype file.
Called in the postinstall script. Will move the file prefixed
by "${PKGINST}_" to its real name and installf it.
It will also keep a copy of it, so that at the pre-remove phase of
this package, Cmp_and_backup_file()
can see if the file has been modify by the user and save it.
Install_RC_file( <pathname>
<list of multiple pathname>);
The first argument is the pathname of the file to be installed. A corresponding
file, with a name prefixed by "${PKGINST}_" must have been defined in the
prototype file.
The list of pathname correspond to all the symlink we have to create,
which will be the Start or Stop script under /etc/rc?.d/
Called in the postinstall script. Will move the file prefixed
by "${PKGINST}_" to its real name and installf it. Then will create a sym
link to it from each pathname defined in the list of pathname.
It will also keep a copy of it, so that at the pre-remove phase of
this package, Cmp_and_backup_file()
can see if the file has been modify by the user and save it.
Cmp_and_backup_file(<pathname>);
The argument is a file which have been installed by the package.
Called by the pre-remove script to backup any change the user may have
done to some file own by the package, so that these changes are not lost.
It will, if this file has change from the version installed by Install_file()
, save the modified file.
Backup_user_file(<pathname>
<dirname>);INTERNAL
The first argument is the name of the file to backup.
The second argument is the directory where the backup should be done.
INTERNAL Called
by Cmp_and_backup_file()
and Save_and_move_file()
<pathname> is moved to <dirname>/<pathname>
Disable_RC(<pathname of a
link> <name of a init file under /etc/init.d>); INTERNAL
The first argument if a link under /etc/rc?.d/ which correspond to a startup
or kill script we want to disable. INTERNAL
Always called only by Disable_Init()
Will delete the first argument after it stored all the
information regarding its membership to any package so that the de-install
step can restore it
Disable_Init(<name of a
init file under /etc/init.d>);
The argument is the name of an init file (Under /etc/init.d/) that we want
to disable.
Called in the postinstall script for all the init file we want to disable.
It will call, for each link found from /etc/rc?.d/ to itself, Disable_RC()
which will delete the call to it properly.
Save_and_move_file( <pathname>);
The argument is the file we want to backup, remove from the existing package
it belongs to and delete.
Called in the postinstall script for all the files we want to delete
and for all the files we want to replace. If we want to replace it, it
is called before Install_file()
Will backup the exiting file using Backup_user_file()
which will move away the file, and also store all the information regarding
its membership to any package so that the de-install step can restore it
as it was.
Restore_RC();
No arguments.
Called in postremove. Will restore all the link to the init scripts
which were disable by Disable_Init() and their
membership to existing package.
Restore_file(<pathname>);
The argument is the pathname to a file previously saved by Save_and_move_file()
Called in postremove. It will restore the original file saved, and
its saved membership to existing packages.
Init_preremove();
No arguments.
Just do some sanity check.
Last Modified: June 20 1999 by Jean
Chouanard, Xerox PARC