DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Packaging your software applications

Approach

You could use the build class and follow the approach shown for editing /etc/inittab in case study 5c except that you want to edit more than one file. If you used the build class approach, you would need to deliver one for each crontab file edited. Defining a cron class provides a more general approach. To edit a crontab file with this approach, you must:

  1. Define the crontab files that will be edited in the prototype(F) file.

    Create an entry in the prototype(F) file for each crontab file which will be edited. Define their class as cron and their file type as e. Use the actual name of the file to be edited, as shown in the example.

  2. Create the crontab files that will be delivered with the package.

    These files contain the information you want added to the existing crontab files of the same name. See the sample root and sys files for two examples.

  3. Create an installation class action script for the cron class.

    The i.cron script performs the following procedures:


    a.
    Calculates the user ID.

    This is done by setting the variable user to the base name of the cron class file being processed. That name equates to the user ID. For example, the basename of /var/spool/cron/crontabs/root is root (which is also the user ID).


    b.
    Executes crontab using the user ID and the -l option.

    Using the -l options tells crontab to send the standard output the contents of the crontab for the defined user.


    c.
    Pipes the output of the crontab command to a sed(C) script that removes any previous entries that have been added using this installation technique.

    d.
    Puts the edited output into a temporary file.

    e.
    Adds the data file for the root user ID (that was delivered with the package) to the temporary file and adds a tag so that you will know from where these entries came.

    f.
    Executes crontab with the same user ID and give it the temporary file as input.

  4. Create a removal class action script for the cron class.

    The sample removal script is the same as the installation script except that there is no procedure to add information to the crontab file.

These procedures are performed for every file in the cron class.


Next topic: pkginfo file
Previous topic: Techniques

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003