NAME

master_template - a gaggle of funtions which provide services to package control scripts


SYNOPSIS

The master.template file used by template-control holds a number of functions useful for writers of package control scripts.


VARIABLES

There are a number of variables which the functions require; they are:

${prefix}
The root of the installation, this is normally /usr/local

${bin}
The binaries in the installation, this is normally ${prefix}/bin

${sbin}
The superuser binaries in the installation, this is normally ${prefix}/sbin

${man}
The root of the manual pages in the installation, this is normally ${prefix}/man

${etc}
Configuration files in the installation, this is normally /etc

${local_bin}
The location of the additional bin directory, traditionally under /usr/local/bin

${local_etc}
The location of the additional etc directory, traditionally under /usr/local/etc

${root_crontab}
The location of root's crontab file, normally /etc/crontab

${syslog_conf}
The location of the syslog.conf file, normally /etc/syslog.conf

${logrotate_conf}
The location of the logrotate.conf file, normally ${local_etc}/logrotate.conf

${etc_profile}
The location of the /etc/profile file, normally /etc/profile

${default_paths}
A space separated list of files to update with PATH and MANPATH details. This normally contains /etc/default/login /etc/default/su ${etc_profile}

${run_crontab}
Do we run the crontab command to update root's crontab if it has changed ? Set to 1 for yes, 0 for no.

${rcs_co}
The location of the RCS co (check out) command, normally ${local_bin}/co

${rcs_ci}
The location of the RCS ci (check in) command, normally ${local_bin}/ci


DESCRIPTION

CheckOut filename
Check out a file under RCS control. This takes the filename to work with:
  CheckOut /etc/syslog.conf

CheckIn filename message
Check in a file under RCS control. This takes the filename to check back in and the message to enter into the RCS log:
  CheckInt /etc/syslog.conf "Addition by ${PKGINST}"

InitRCS filename
Place a file under RCS control for the first time. This takes a filename to work with:
  InitRCS /etc/somefile

AddPath path manpath
Add entries to the default paths. The files which are updated are specified in the ${default_paths} variable which by default holds /etc/default/login /etc/default/su /etc/profile
  AddPath "${bin}:${sbin}" "${man}"

CrontabAdd file user cron [cron ...]
Add one or more lines to a crontab entry for a user. There are several arguments. file is the crontab file to work with - i.e. the output of crontab -l - or the empty string for root. user is the user who owns the crontab or the empty string for root. cron is one or more crontab entries. Note that any * should be escaped.

If run_crontab is set to 1 then the crontab command will be called to update the system crontab file of the user.

  ## Add two entries to root's crontab
  CrontabAdd "" "" \
        "0 3 \* \* \* /usr/local/bin/somecommand" \
        "5 3 \* \* \* /usr/local/bin/someother"

CrontabRemove file user extract [extract ...]
Remove one or more lines from a crontab entry. Again there are several arguments. file is the crontab file to work with - i.e. the output of crontab -l - or the empty string for root. user is the user who owns the crontab or the empty string for root. extract is one or more extracts from the crontab to remove.
  ## Remove two entries to root's crontab
  CrontabRemove "" "" \
        "/usr/local/bin/somecommand" \
        "/usr/local/bin/someother"

LogrotateAdd line [line ...]
Add one or more entries to ${local_etc}/logrotate.conf. The arguments are a list of lines to add.
  LogrotateAdd \
        "/home/somepkg/log/file1" \
        "/home/somepkg/log/file2"

LogrotateRemove extract [extract ...]
Remove one or more lines from ${local_etc}/logrotate.conf. The arguments are a list of extracts from lines to remove.
  LogrotateRemove \
        "/home/somepkg/log/file1" \
        "/home/somepkg/log/file2"

SyslogAdd line [line ...]
Add an entry to the ${syslog_conf} file. The arguments are a list of lines to add. Note that \t can be used for the required tab characters.
  SyslogAdd \
        "local0.info\t\t/home/somepkg/log/file1" \
        "local0.debug\t\t/home/somepkg/log/file2"

SyslogRemove extract [extract ...]
Remove an entry from the ${syslog_conf}. The arguments are a list of extracts to remove.
  SyslogRemove \
        "local0.info\t\t/home/somepkg/log/file1" \
        "local0.debug\t\t/home/somepkg/log/file2"

InetdAdd line [line ...]
Add an entry to the ${inetd_conf} file. The arguments are a list of lines to add. Note that \t can be used for the required tab characters.
  InetdAdd \
        "perflog\tstream\ttcp\tnowait\tnobody\t/usr/local/bin/PerfLogSrv PLS"

InetdRemove extract [extract ...]
Remove an entry from the ${inetd_conf}. The arguments are a list of extracts to remove.
  InetdRemove \
        "perflog\tstream\ttcp\tnowait\tnobody\t/usr/local/bin/PerfLogSrv PLS"

HostsAdd type line [line ...]
Add one or more lines to the ${local_etc}/hosts.allow or ${local_etc}/hosts.deny files. type is the type of hosts file to work with, either allow or deny. The other arguments are lines to add.
  HostAdd "allow" "rpcbind: LOCAL"

HostsRemove type extract [extract ...]
Add one or more lines to the ${local_etc}/hosts.allow or ${local_etc}/hosts.deny files. type is the type of hosts file to work with, either allow or deny. The other arguments are extracts of lines to remove.
  HostRemove "allow" "rpcbind: LOCAL"

RebuildMan manpath
Re-build the manual page windex for a single directory. This takes a single argument, the directory to work with.
  RebuildMan ${man}

It is recommended that if you have a package which installs into its own tree - i.e. /home/postfix - then the building of the windex file is performed when the package is actually created rather than at package installation time. In some cases it is possible to remove the need for a postremove script.

ConfigAdd file sample diff
Add a configuration file, calling InitRCS as required. file is the filename to work with. sample is a sample configuration file or an empty string for <file>.sample. If diff is set to 1 then differences between the file (if it exists) and the sample file are displayed. This is not done if diff is an empty string or 0.
  ConfigAdd ${etc}/config "" ""

It is assumed that you will provide sample configuration files which are then copied into place during package installation. The reason for this is simple - it allows you to pkgrm a package and leave the configuration files behind ready for pkgadding of a new version of the same package.


FILES

/usr/local/lib/pkg-tools/master.template
The master template file.


SEE ALSO

build-pkg(1), template-control(1), pkgadd(1)


AUTHOR

Simon Burr <simes@bpfh.net>


LICENSE

Copyright (c) 2003, Simon Burr <simes@bpfh.net> All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  * Redistributions of source code must retain the above copyright notice,
    this list of conditions and the following disclaimer. 
  * Redistributions in binary form must reproduce the above copyright
    notice, this list of conditions and the following disclaimer in the
    documentation and/or other materials provided with the distribution. 
  * Neither the name of the author nor the names of its contributors may
    be used to endorse or promote products derived from this software
    without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.