master_template - a gaggle of funtions which provide services to package control scripts
The master.template file used by template-control holds a number of functions
useful for writers of package control scripts.
There are a number of variables which the functions require; they are:
/usr/local
${prefix}/bin
${prefix}/sbin
${prefix}/man
/etc
bin directory, traditionally under
/usr/local/bin
etc directory, traditionally under
/usr/local/etc
crontab file, normally /etc/crontab
syslog.conf file, normally /etc/syslog.conf
logrotate.conf file, normally ${local_etc}/logrotate.conf
/etc/profile file, normally /etc/profile
PATH and MANPATH details. This
normally contains /etc/default/login /etc/default/su ${etc_profile}
crontab command to update root's crontab if it has changed ? Set
to 1 for yes, 0 for no.
${local_bin}/co
${local_bin}/ci
CheckOut /etc/syslog.conf
CheckInt /etc/syslog.conf "Addition by ${PKGINST}"
InitRCS /etc/somefile
${default_paths} variable which by default
holds /etc/default/login /etc/default/su /etc/profile
AddPath "${bin}:${sbin}" "${man}"
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"
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"
${local_etc}/logrotate.conf. The arguments
are a list of lines to add.
LogrotateAdd \
"/home/somepkg/log/file1" \
"/home/somepkg/log/file2"
${local_etc}/logrotate.conf. The
arguments are a list of extracts from lines to remove.
LogrotateRemove \
"/home/somepkg/log/file1" \
"/home/somepkg/log/file2"
${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"
${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"
${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"
${inetd_conf}. The arguments are a
list of extracts to remove.
InetdRemove \
"perflog\tstream\ttcp\tnowait\tnobody\t/usr/local/bin/PerfLogSrv PLS"
${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"
${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"
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.
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.
Simon Burr <simes@bpfh.net>
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.