openpkg/rc.8

Wed, 14 Jan 2009 15:59:12 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 14 Jan 2009 15:59:12 +0100
changeset 86
78e7deb1d6ab
child 427
71503088f51b
permissions
-rw-r--r--

Correct and improve many buildconf and code logic blocks. In particular:
1. Document potential problems building with current binutils releases.
2. Document the flawed webkit and explain its temporary exclusion.
3. Document the edition of Qt which is built and installed.
4. Remove the Solaris x11_supdir logic as it is no longer found.
5. Correct several .pr[io] files including QMAKE_CXXFLAGS and INCPATH,
which previously caused preexisting Qt installations to deliver
erroneous old include and library logic instead of relying on
that of the currently building package. -I/opkg/include is now
placed at the end of the compile statements.
6. Don't trust the QMAKE_[INC|LIB]DIR_X11 identifiers in qmake.conf.
7. Allow more 64-bit builds and more properly identify the platform.
8. Place plugins (which are shared objects) in lib instead of share.
9. Build components as plugins when possible if with_shared is enabled.
10. Translate German text to English to be more consistent.
11. Instead of removing the pkgconfig directory of with_shared builds,
place it in a child directory useful for shared building.
12. Document the nonstandard shared build directory structure,
including using the hidden pkgconfig directory (PKG_CONFIG_PATH.)
13. Change %doc to specify files rather than directories in the RPM DB.

michael@13 1 .\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
michael@13 2 .\"
michael@13 3 .\" Standard preamble:
michael@13 4 .\" ========================================================================
michael@13 5 .de Sh \" Subsection heading
michael@13 6 .br
michael@13 7 .if t .Sp
michael@13 8 .ne 5
michael@13 9 .PP
michael@13 10 \fB\\$1\fR
michael@13 11 .PP
michael@13 12 ..
michael@13 13 .de Sp \" Vertical space (when we can't use .PP)
michael@13 14 .if t .sp .5v
michael@13 15 .if n .sp
michael@13 16 ..
michael@13 17 .de Vb \" Begin verbatim text
michael@13 18 .ft CW
michael@13 19 .nf
michael@13 20 .ne \\$1
michael@13 21 ..
michael@13 22 .de Ve \" End verbatim text
michael@13 23 .ft R
michael@13 24 .fi
michael@13 25 ..
michael@13 26 .\" Set up some character translations and predefined strings. \*(-- will
michael@13 27 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
michael@13 28 .\" double quote, and \*(R" will give a right double quote. | will give a
michael@13 29 .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
michael@13 30 .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
michael@13 31 .\" expand to `' in nroff, nothing in troff, for use with C<>.
michael@13 32 .tr \(*W-|\(bv\*(Tr
michael@13 33 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
michael@13 34 .ie n \{\
michael@13 35 . ds -- \(*W-
michael@13 36 . ds PI pi
michael@13 37 . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
michael@13 38 . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
michael@13 39 . ds L" ""
michael@13 40 . ds R" ""
michael@13 41 . ds C`
michael@13 42 . ds C'
michael@13 43 'br\}
michael@13 44 .el\{\
michael@13 45 . ds -- \|\(em\|
michael@13 46 . ds PI \(*p
michael@13 47 . ds L" ``
michael@13 48 . ds R" ''
michael@13 49 'br\}
michael@13 50 .\"
michael@13 51 .\" If the F register is turned on, we'll generate index entries on stderr for
michael@13 52 .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
michael@13 53 .\" entries marked with X<> in POD. Of course, you'll have to process the
michael@13 54 .\" output yourself in some meaningful fashion.
michael@13 55 .if \nF \{\
michael@13 56 . de IX
michael@13 57 . tm Index:\\$1\t\\n%\t"\\$2"
michael@13 58 ..
michael@13 59 . nr % 0
michael@13 60 . rr F
michael@13 61 .\}
michael@13 62 .\"
michael@13 63 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
michael@13 64 .\" way too many mistakes in technical documents.
michael@13 65 .hy 0
michael@13 66 .if n .na
michael@13 67 .\"
michael@13 68 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
michael@13 69 .\" Fear. Run. Save yourself. No user-serviceable parts.
michael@13 70 . \" fudge factors for nroff and troff
michael@13 71 .if n \{\
michael@13 72 . ds #H 0
michael@13 73 . ds #V .8m
michael@13 74 . ds #F .3m
michael@13 75 . ds #[ \f1
michael@13 76 . ds #] \fP
michael@13 77 .\}
michael@13 78 .if t \{\
michael@13 79 . ds #H ((1u-(\\\\n(.fu%2u))*.13m)
michael@13 80 . ds #V .6m
michael@13 81 . ds #F 0
michael@13 82 . ds #[ \&
michael@13 83 . ds #] \&
michael@13 84 .\}
michael@13 85 . \" simple accents for nroff and troff
michael@13 86 .if n \{\
michael@13 87 . ds ' \&
michael@13 88 . ds ` \&
michael@13 89 . ds ^ \&
michael@13 90 . ds , \&
michael@13 91 . ds ~ ~
michael@13 92 . ds /
michael@13 93 .\}
michael@13 94 .if t \{\
michael@13 95 . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
michael@13 96 . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
michael@13 97 . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
michael@13 98 . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
michael@13 99 . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
michael@13 100 . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
michael@13 101 .\}
michael@13 102 . \" troff and (daisy-wheel) nroff accents
michael@13 103 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
michael@13 104 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
michael@13 105 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
michael@13 106 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
michael@13 107 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
michael@13 108 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
michael@13 109 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
michael@13 110 .ds ae a\h'-(\w'a'u*4/10)'e
michael@13 111 .ds Ae A\h'-(\w'A'u*4/10)'E
michael@13 112 . \" corrections for vroff
michael@13 113 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
michael@13 114 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
michael@13 115 . \" for low resolution devices (crt and lpr)
michael@13 116 .if \n(.H>23 .if \n(.V>19 \
michael@13 117 \{\
michael@13 118 . ds : e
michael@13 119 . ds 8 ss
michael@13 120 . ds o a
michael@13 121 . ds d- d\h'-1'\(ga
michael@13 122 . ds D- D\h'-1'\(hy
michael@13 123 . ds th \o'bp'
michael@13 124 . ds Th \o'LP'
michael@13 125 . ds ae ae
michael@13 126 . ds Ae AE
michael@13 127 .\}
michael@13 128 .rm #[ #] #H #V #F C
michael@13 129 .\" ========================================================================
michael@13 130 .\"
michael@13 131 .IX Title "RC 8"
michael@13 132 .TH RC 8 "OpenPKG" "RC(8)" "OpenPKG"
michael@13 133 .SH "NAME"
michael@13 134 \&\fB@l_prefix@/bin/openpkg rc\fR \- OpenPKG Run\-Command Processor
michael@13 135 .SH "SYNOPSIS"
michael@13 136 .IX Header "SYNOPSIS"
michael@13 137 \&\fB@l_prefix@/bin/openpkg rc\fR [\fB\-s\fR|\fB\-\-silent\fR] [\fB\-v\fR|\fB\-\-verbose\fR] [\fB\-d\fR|\fB\-\-debug\fR] [\fB\-k\fR|\fB\-\-keep\fR] \fIpackage\fR \fIcommand\fR [\fIcommand\fR ...]
michael@13 138 .PP
michael@13 139 \&\fB@l_prefix@/bin/openpkg rc\fR \fB\-p\fR|\fB\-\-print\fR \fIpackage\fR \fIcommand\fR [\fIcommand\fR ...]
michael@13 140 .PP
michael@13 141 eval `\fB@l_prefix@/bin/openpkg rc\fR \fB\-e\fR|\fB\-\-eval\fR \fIpackage\fR \fIcommand\fR [\fIcommand\fR ...]`
michael@13 142 .PP
michael@13 143 \&\fB@l_prefix@/bin/openpkg rc\fR \fB\-q\fR|\fB\-\-query\fR \fIvariable\fR [\fIvariable\fR ...]
michael@13 144 .PP
michael@13 145 \&\fB@l_prefix@/bin/openpkg rc\fR \fB\-c\fR|\fB\-\-config\fR
michael@13 146 .PP
michael@13 147 \&\fB@l_prefix@/bin/openpkg rc\fR \fB\-h\fR|\fB\-\-help\fR
michael@13 148 .SH "DESCRIPTION"
michael@13 149 .IX Header "DESCRIPTION"
michael@13 150 The \fB@l_prefix@/bin/openpkg rc\fR program is the run-command (rc) processor
michael@13 151 of the \fBOpenPKG\fR instance \f(CW\*(C`@l_prefix@\*(C'\fR. It allows querying the rc
michael@13 152 configuration variables and the execution of rc command scripts of one
michael@13 153 or more installed \fBOpenPKG\fR packages. The implemented run-command
michael@13 154 facility is partly modeled after the classical \s-1UNIX\s0(tm) System V
michael@13 155 run-command facility plus ideas taken from the FreeBSD and NetBSD
michael@13 156 run-command facilities. It mainly merges the classical startup/shutdown
michael@13 157 procedures with periodical procedures into a single approach.
michael@13 158 .SH "USAGE"
michael@13 159 .IX Header "USAGE"
michael@13 160 .IP "\fB@l_prefix@/bin/openpkg rc\fR [\fB\-s\fR|\fB\-\-silent\fR] [\fB\-v\fR|\fB\-\-verbose\fR] [\fB\-d\fR|\fB\-\-debug\fR] [\fB\-k\fR|\fB\-\-keep\fR] \fIpackage\fR \fIcommand\fR [\fIcommand\fR ...]" 4
michael@13 161 .IX Item "@l_prefix@/bin/openpkg rc [-s|--silent] [-v|--verbose] [-d|--debug] [-k|--keep] package command [command ...]"
michael@13 162 \&\fBRun-Command Execution.\fR This executes one or more specified
michael@13 163 \&\fIcommand\fRs in a particular \fIpackage\fR or in all installed packages if
michael@13 164 \&\fIpackage\fR is "\f(CW\*(C`all\*(C'\fR". Option \fB\-\-silent\fR can be used to explicitly
michael@13 165 disable progress messages on \f(CW\*(C`stderr\*(C'\fR. Option \fB\-\-verbose\fR can be used
michael@13 166 to explicitly enable progress messages on \f(CW\*(C`stderr\*(C'\fR. By default, \fBrc\fR
michael@13 167 automatically determines whether progress messages should be displayed
michael@13 168 or not depending on whether \f(CW\*(C`stderr\*(C'\fR is connected to a terminal device.
michael@13 169 Option \fB\-\-keep\fR can be used for debugging purposes to keep the
michael@13 170 temporary files were generated during internal processing.
michael@13 171 .IP "\fB@l_prefix@/bin/openpkg rc\fR \fB\-p\fR|\fB\-\-print\fR \fIpackage\fR \fIcommand\fR [\fIcommand\fR ...]" 4
michael@13 172 .IX Item "@l_prefix@/bin/openpkg rc -p|--print package command [command ...]"
michael@13 173 \&\fBRun-Command Printing.\fR This is like the run-command execution (see
michael@13 174 above), but instead of immediately executing all involved individual
michael@13 175 run-command scripts, they are concatenated (but with all configuration
michael@13 176 parts reduced to a single configuration part) and printed to \f(CW\*(C`stdout\*(C'\fR.
michael@13 177 Use this for debugging or post-processing purposes.
michael@13 178 .IP "eval `\fB@l_prefix@/bin/openpkg rc\fR \fB\-e\fR|\fB\-\-eval\fR \fIpackage\fR \fIcommand\fR [\fIcommand\fR ...]`" 4
michael@13 179 .IX Item "eval `@l_prefix@/bin/openpkg rc -e|--eval package command [command ...]`"
michael@13 180 \&\fBRun-Command Evaluation.\fR This is like the run-command execution
michael@13 181 (see above), but the resulting exported shell environment variables
michael@13 182 are output to a temporary file as a (Bourne\-Shell or C\-Shell syntax)
michael@13 183 shell script, suitable for evaluation within the shell environment
michael@13 184 of the caller. A one-line script is printed to \f(CW\*(C`stdout\*(C'\fR which then
michael@13 185 \&\*(L"sources\*(R" (and immediately removes) this temporary file. This is
michael@13 186 slightly different from printing the temporary script directly to
michael@13 187 \&\f(CW\*(C`stdout\*(C'\fR, because not all shell implementations like to "\fBeval\fR\*(L"
michael@13 188 large multi-line scripts. Hence, use this for executing the \*(R"\f(CW\*(C`env\*(C'\fR"
michael@13 189 run-commands within the current shell.
michael@13 190 .IP "\fB@l_prefix@/bin/openpkg rc\fR \fB\-q\fR|\fB\-\-query\fR \fIvariable\fR [\fIvariable\fR ...]" 4
michael@13 191 .IX Item "@l_prefix@/bin/openpkg rc -q|--query variable [variable ...]"
michael@13 192 \&\fBConfiguration Variable Querying.\fR This queries the effective values
michael@13 193 (see \fBRUN-COMMAND \s-1CONFIGURATION\s0\fR section below) of one or more
michael@13 194 run-command configuration \fIvariable\fRs. Use this within a shell script
michael@13 195 to selectively query a particular variable.
michael@13 196 .IP "\fB@l_prefix@/bin/openpkg rc\fR \fB\-c\fR|\fB\-\-config\fR" 4
michael@13 197 .IX Item "@l_prefix@/bin/openpkg rc -c|--config"
michael@13 198 \&\fBConfiguration Variable Summary.\fR This displays on \f(CW\*(C`stdout\*(C'\fR a
michael@13 199 three-column table showing the name, default and effective values of
michael@13 200 all run-command configuration variables. If \f(CW\*(C`stdout\*(C'\fR is connected to
michael@13 201 terminal device, variables where the default and effective values differ
michael@13 202 are shown in bold mode.
michael@13 203 .IP "\fB@l_prefix@/bin/openpkg rc\fR \fB\-h\fR|\fB\-\-help\fR" 4
michael@13 204 .IX Item "@l_prefix@/bin/openpkg rc -h|--help"
michael@13 205 \&\fBRequesting Help.\fR This just displays a short summary of
michael@13 206 the usage for this program.
michael@13 207 .SH "FILES"
michael@13 208 .IX Header "FILES"
michael@13 209 .ie n .Sh "RUN-COMMAND \s-1FILES\s0 (\*(C`@l_prefix@/bin/openpkg rc.d/rc.*\*(C')"
michael@13 210 .el .Sh "RUN-COMMAND \s-1FILES\s0 (\f(CW\*(C`@l_prefix@/bin/openpkg rc.d/rc.*\*(C'\fP)"
michael@13 211 .IX Subsection "RUN-COMMAND FILES (@l_prefix@/bin/openpkg rc.d/rc.*)"
michael@13 212 The foundation of the \fBOpenPKG\fR run-command facility are the individual
michael@13 213 run-command files \f(CW\*(C`rc.*\*(C'\fR of the installed packages. They are all
michael@13 214 located in the directory \f(CW\*(C`@l_prefix@/bin/openpkg rc.d/\*(C'\fR and are named
michael@13 215 "\f(CW\*(C`rc.\*(C'\fR\fIpackage\fR\*(L". They consist of one or more sections, each starting
michael@13 216 with a section header \*(R"\f(CW\*(C`%\*(C'\fR\fIname\fR [\fIoptions\fR]" and following a \s-1GNU\s0
michael@13 217 Bash compatible shell script. There are three classes of sections:
michael@13 218 .IP "\fBSpecial Sections\fR" 4
michael@13 219 .IX Item "Special Sections"
michael@13 220 There are 2 sections which have a special meaning to the \fBrc\fR program
michael@13 221 and cannot be used for different purposes.
michael@13 222 .RS 4
michael@13 223 .ie n .IP "%config" 4
michael@13 224 .el .IP "\f(CW%config\fR" 4
michael@13 225 .IX Item "%config"
michael@13 226 This section has to consist of run-command configuration
michael@13 227 variable default settings in Bourne-Shell syntax only, i.e.,
michael@13 228 it has to contain one or more lines, each of exactly the form
michael@13 229 "\fIpackage\fR\f(CW\*(C`_\*(C'\fR\fIvariable\fR\f(CW\*(C`=\*(C'\fR\fIvalue\fR\*(L". Notice that in section
michael@13 230 \&\*(R"\f(CW%config\fR\*(L" of run-command file \*(R"\f(CW\*(C`rc.foo\*(C'\fR\*(L" the variables all have
michael@13 231 to be prefixed (by convention) with \*(R"\f(CW\*(C`foo_\*(C'\fR". It is allowed that the
michael@13 232 \&\fIvalue\fRs reference other variables defined before in the same section
michael@13 233 or from the "\f(CW%config\fR\*(L" section of the bootstrap package \*(R"\f(CW\*(C`openpkg\*(C'\fR".
michael@13 234 Additionally, by convention all lines have to be indented by 4 spaces.
michael@13 235 .Sp
michael@13 236 \&\s-1NOTICE:\s0 All sections of all run-command scripts see all \f(CW%config\fR
michael@13 237 sections of all packages.
michael@13 238 .ie n .IP "%common" 4
michael@13 239 .el .IP "\f(CW%common\fR" 4
michael@13 240 .IX Item "%common"
michael@13 241 This section can consist of an arbitrary shell script
michael@13 242 which is automatically prepended to the shell scripts
michael@13 243 of all other sections on execution. It is usually used
michael@13 244 to define common and local variables and functions.
michael@13 245 .RE
michael@13 246 .RS 4
michael@13 247 .RE
michael@13 248 .IP "\fBConventional Sections\fR" 4
michael@13 249 .IX Item "Conventional Sections"
michael@13 250 There are 9 sections which have no special meaning to the \fBrc\fR program,
michael@13 251 but are used in \fBOpenPKG\fR by convention for standard purposes. Hence,
michael@13 252 do not use them for arbitrary things instead.
michael@13 253 .Sp
michael@13 254 Throughout these sections it is possible to specify the user to be
michael@13 255 switched to before the code is executed.
michael@13 256 .Sp
michael@13 257 A priority can be given for each section to control execution sequence
michael@13 258 if "\f(CW\*(C`all\*(C'\fR" packages are given. Higher priority leads to earlier
michael@13 259 starting and later stopping. The priority is a number where low numbers
michael@13 260 mean high priority (numerically sorted for starting). If omitted, the
michael@13 261 priority defaults to 500.
michael@13 262 .Sp
michael@13 263 Output generated on \fIstdout\fR and \fIstderr\fR is captured and normally
michael@13 264 suppressed. In case the sections script exits with a non-zero return
michael@13 265 value, the intercepted messages are consolidated, reformatted with a
michael@13 266 surrounding ASCII-art border and printed to \fIstderr\fR. If the section
michael@13 267 is tagged with option \fB\-o\fR, \fIstdout\fR messages are passed through
michael@13 268 verbatim, even if the section script exists with a zero return value.
michael@13 269 .RS 4
michael@13 270 .ie n .IP "%start\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority]" 4
michael@13 271 .el .IP "\f(CW%start\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority\fR]" 4
michael@13 272 .IX Item "%start [-u user] [-p priority]"
michael@13 273 This section should start daemons or initialize components.
michael@13 274 It is especially executed by \fBOpenPKG\fR during system startup.
michael@13 275 .ie n .IP "%stop\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority]" 4
michael@13 276 .el .IP "\f(CW%stop\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority\fR]" 4
michael@13 277 .IX Item "%stop [-u user] [-p priority]"
michael@13 278 This section should stop daemons or cleaning up components. It is
michael@13 279 especially executed by \fBOpenPKG\fR during system shutdown and package
michael@13 280 deinstallation.
michael@13 281 .ie n .IP "%restart\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority]" 4
michael@13 282 .el .IP "\f(CW%restart\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority\fR]" 4
michael@13 283 .IX Item "%restart [-u user] [-p priority]"
michael@13 284 This section should restart daemons.
michael@13 285 It is especially executed by \fBOpenPKG\fR during package upgrades.
michael@13 286 .ie n .IP "\*(C`%status \-o\*(C'\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority]" 4
michael@13 287 .el .IP "\f(CW\*(C`%status \-o\*(C'\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority\fR]" 4
michael@13 288 .IX Item "%status -o [-u user] [-p priority]"
michael@13 289 This section has to provide status information for a package
michael@13 290 by printing to \f(CW\*(C`stdout\*(C'\fR (hence the \fB\-o\fR option is always required),
michael@13 291 in Bourne-Shell syntax, the definition of three variables:
michael@13 292 .RS 4
michael@13 293 .ie n .IP "\fIpackage\fR\*(C`_enable\*(C'" 4
michael@13 294 .el .IP "\fIpackage\fR\f(CW\*(C`_enable\*(C'\fR" 4
michael@13 295 .IX Item "package_enable"
michael@13 296 Whether package is enabled, i.e., whether it accepts run\-commands. This
michael@13 297 variable just has to be printed, because is already set in current
michael@13 298 script environment.
michael@13 299 .ie n .IP "\fIpackage\fR\*(C`_usable\*(C'" 4
michael@13 300 .el .IP "\fIpackage\fR\f(CW\*(C`_usable\*(C'\fR" 4
michael@13 301 .IX Item "package_usable"
michael@13 302 Whether package is usable, i.e., whether it is already correctly
michael@13 303 configured, etc. This variable has to be individually determined.
michael@13 304 .ie n .IP "\fIpackage\fR\*(C`_active\*(C'" 4
michael@13 305 .el .IP "\fIpackage\fR\f(CW\*(C`_active\*(C'\fR" 4
michael@13 306 .IX Item "package_active"
michael@13 307 Whether package is active, i.e., whether it is already running.
michael@13 308 This variable has to be individually determined.
michael@13 309 .RE
michael@13 310 .RS 4
michael@13 311 .RE
michael@13 312 .ie n .IP "%monthly\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority]" 4
michael@13 313 .el .IP "\f(CW%monthly\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority\fR]" 4
michael@13 314 .IX Item "%monthly [-u user] [-p priority]"
michael@13 315 .PD 0
michael@13 316 .ie n .IP "%weekly\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority]" 4
michael@13 317 .el .IP "\f(CW%weekly\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority\fR]" 4
michael@13 318 .IX Item "%weekly [-u user] [-p priority]"
michael@13 319 .ie n .IP "%hourly\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority]" 4
michael@13 320 .el .IP "\f(CW%hourly\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority\fR]" 4
michael@13 321 .IX Item "%hourly [-u user] [-p priority]"
michael@13 322 .ie n .IP "%quarterly\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority]" 4
michael@13 323 .el .IP "\f(CW%quarterly\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority\fR]" 4
michael@13 324 .IX Item "%quarterly [-u user] [-p priority]"
michael@13 325 .PD
michael@13 326 These sections should perform periodical tasks for a package and
michael@13 327 are executed on a monthly, weekly, hourly or quarterly basis.
michael@13 328 .ie n .IP "%env" 4
michael@13 329 .el .IP "\f(CW%env\fR" 4
michael@13 330 .IX Item "%env"
michael@13 331 This section is intended to export one or more environment variables
michael@13 332 which are imported into the shell environment of the caller through the
michael@13 333 \&\fB\-\-eval\fR command line option.
michael@13 334 .RE
michael@13 335 .RS 4
michael@13 336 .RE
michael@13 337 .IP "\fBCustom Sections\fR" 4
michael@13 338 .IX Item "Custom Sections"
michael@13 339 All other sections are custom ones and can be fully individual to each
michael@13 340 package. Some often seen sections are \f(CW%reload\fR (just reload the
michael@13 341 configuration without full stop and start procedure), \f(CW%info\fR (output
michael@13 342 arbitrary information about package), etc.
michael@13 343 .ie n .Sh "RUN-COMMAND \s-1CONFIGURATION\s0 (\*(C`@l_prefix@/bin/openpkg rc.conf\*(C')"
michael@13 344 .el .Sh "RUN-COMMAND \s-1CONFIGURATION\s0 (\f(CW\*(C`@l_prefix@/bin/openpkg rc.conf\*(C'\fP)"
michael@13 345 .IX Subsection "RUN-COMMAND CONFIGURATION (@l_prefix@/bin/openpkg rc.conf)"
michael@13 346 The run-command configuration variables defined in the "\f(CW%config\fR"
michael@13 347 sections of all installed packages can be overridden by the
michael@13 348 administrator in the global file \f(CW\*(C`@l_prefix@/bin/openpkg rc.conf\*(C'\fR. This file is
michael@13 349 usually empty, but can be filled with Bourne-Shell compatible variable
michael@13 350 assignment statements like "\fIpackage\fR\f(CW\*(C`_\*(C'\fR\fIvariable\fR=\fIvalue\fR".
michael@13 351 .ie n .Sh "RUN-COMMAND \s-1FUNCTIONS\s0 (\*(C`@l_prefix@/bin/openpkg rc.func\*(C')"
michael@13 352 .el .Sh "RUN-COMMAND \s-1FUNCTIONS\s0 (\f(CW\*(C`@l_prefix@/bin/openpkg rc.func\*(C'\fP)"
michael@13 353 .IX Subsection "RUN-COMMAND FUNCTIONS (@l_prefix@/bin/openpkg rc.func)"
michael@13 354 The file \f(CW\*(C`@l_prefix@/bin/openpkg rc.func\*(C'\fR is prepended to the scripts of all
michael@13 355 executed run-command sections and provides reusable functions.
michael@13 356 Currently the following functions are defined:
michael@13 357 .IP "\fBrcMsg\fR [\fB\-e\fR] [\fB\-w\fR] \fImessage\fR" 4
michael@13 358 .IX Item "rcMsg [-e] [-w] message"
michael@13 359 Print a message to the output device of the run-command caller. The
michael@13 360 message is printed to the captured \fIstderr\fR (but are visible to
michael@13 361 the caller of the run-command script only if the script fails). All
michael@13 362 messages are prefixed with "\f(CW\*(C`rc:\*(C'\fR". If option \fB\-e\fR is given, the
michael@13 363 prefix is "\f(CW\*(C`rc:ERROR:\*(C'\fR". If option \fB\-w\fR is given, the prefix is
michael@13 364 "\f(CW\*(C`rc:WARNING:\*(C'\fR".
michael@13 365 .IP "\fBrcPath\fR [\fB\-a\fR] [\fB\-r\fR] [\fB\-p\fR] [\fB\-e\fR] \fIvariable\fR \fIdir\fR [\fIdir\fR ...]" 4
michael@13 366 .IX Item "rcPath [-a] [-r] [-p] [-e] variable dir [dir ...]"
michael@13 367 Add (option \fB\-a\fR) or remove (option \fB\-r\fR) one or more \fIdir\fRectories
michael@13 368 to/from the colon-separated value of a \fIvar\fRable. By default, on
michael@13 369 addition, the directory is appended to the end, if option \fB\-p\fR is used
michael@13 370 the directory is prepended to the start. If option \fB\-e\fR is used, the
michael@13 371 directories are added only if they exist on the underlying filesystem.
michael@13 372 Use this function for conveniently manipulating \f(CW\*(C`PATH\*(C'\fR, \f(CW\*(C`MANPATH\*(C'\fR,
michael@13 373 \&\f(CW\*(C`INFOPATH\*(C'\fR, \f(CW\*(C`LD_LIBRARY_PATH\*(C'\fR and similar variables.
michael@13 374 .IP "\fBrcTmp\fR [\fB\-i\fR] [\fB\-f\fR] [\fB\-n\fR \fIname\fR] [\fB\-k\fR]" 4
michael@13 375 .IX Item "rcTmp [-i] [-f] [-n name] [-k]"
michael@13 376 Convenience interface to secure temporary file handling. Option \fB\-i\fR
michael@13 377 first has to be used to initialize a secure temporary directory (option
michael@13 378 \&\fB\-k\fR later will kill this again). Under option \fB\-f\fR you then can get
michael@13 379 reasonable temporary filenames under the created temporary directory. By
michael@13 380 default, the temporary filename is just "\f(CW\*(C`tmp\*(C'\fR", but can be specified
michael@13 381 with option \fB\-n\fR to be \fIname\fR.
michael@13 382 .IP "\fBrcService\fR \fIpackage\fR \fIstatus\fR \fIvalue\fR" 4
michael@13 383 .IX Item "rcService package status value"
michael@13 384 Convenience interface to checking the \f(CW%status\fR variables
michael@13 385 \&\fIpackage\fR\f(CW\*(C`_\*(C'\fR\fIstatus\fR which have to be provided by the \f(CW%config\fR (if
michael@13 386 \&\fIstatus\fR is "\f(CW\*(C`enable\*(C'\fR" this is enough) and \f(CW%status\fR (if \fIstatus\fR is
michael@13 387 "\f(CW\*(C`enable\*(C'\fR\*(L", \*(R"\f(CW\*(C`usable\*(C'\fR\*(L" and \*(R"\f(CW\*(C`active\*(C'\fR"). The \fBrcService\fR especially
michael@13 388 caches the resolving of the variable values. Returns 0 if the resolved
michael@13 389 value is \fIvalue\fR, else returns 1.
michael@13 390 .IP "\fBrcVarIsYes\fR \fIname\fR" 4
michael@13 391 .IX Item "rcVarIsYes name"
michael@13 392 Checks whether variable \fIname\fR has a value of "\f(CW\*(C`yes\*(C'\fR\*(L", \*(R"\f(CW\*(C`true\*(C'\fR\*(L",
michael@13 393 \&\*(R"\f(CW\*(C`on\*(C'\fR\*(L", or \*(R"\f(CW1\fR" (with arbitrary lower or upper case letters). Returns
michael@13 394 0 if value is one of these positive ones, else returns 1.
michael@13 395 .SH "EXAMPLES"
michael@13 396 .IX Header "EXAMPLES"
michael@13 397 First, an example run-command script \f(CW\*(C`@l_prefix@/bin/openpkg rc.d/rc.foo\*(C'\fR for a
michael@13 398 fictional daemon package "\f(CW\*(C`foo\*(C'\fR":
michael@13 399 .PP
michael@13 400 .Vb 8
michael@13 401 \& %config
michael@13 402 \& foo_enable="${openpkg_rc_def}"
michael@13 403 \& foo_listen="127.0.0.1"
michael@13 404 \& foo_log_prolog="true"
michael@13 405 \& foo_log_epilog="true"
michael@13 406 \& foo_log_numfiles="10"
michael@13 407 \& foo_log_minsize="1M"
michael@13 408 \& foo_log_complevel="9"
michael@13 409 .Ve
michael@13 410 .PP
michael@13 411 .Vb 13
michael@13 412 \& %common
michael@13 413 \& foo_homedir="@l_prefix@/share/foo"
michael@13 414 \& foo_cfgfile="@l_prefix@/etc/foo/foo.cfg"
michael@13 415 \& foo_pidfile="@l_prefix@/var/foo/foo.pid"
michael@13 416 \& foo_logfile="@l_prefix@/var/foo/foo.log"
michael@13 417 \& foo_signal () {
michael@13 418 \& if [ -f ${foo_pidfile} ]; then
michael@13 419 \& kill -$1 `cat ${foo_pidfile}`
michael@13 420 \& return $?
michael@13 421 \& else
michael@13 422 \& return 1
michael@13 423 \& fi
michael@13 424 \& }
michael@13 425 .Ve
michael@13 426 .PP
michael@13 427 .Vb 15
michael@13 428 \& %status
michael@13 429 \& foo_usable="no"
michael@13 430 \& if [ ".`grep '<<PASSWORD>>' ${foo_cfgfile}`" = . ]; then
michael@13 431 \& foo_usable="yes"
michael@13 432 \& fi
michael@13 433 \& foo_active="no"
michael@13 434 \& if [ -f ${foo_pidfile} ]; then
michael@13 435 \& foo_signal 0
michael@13 436 \& if [ $? -eq 0 ]; then
michael@13 437 \& foo_active="yes"
michael@13 438 \& fi
michael@13 439 \& fi
michael@13 440 \& echo "foo_enable=${foo_enable}"
michael@13 441 \& echo "foo_usable=${foo_usable}"
michael@13 442 \& echo "foo_active=${foo_active}"
michael@13 443 .Ve
michael@13 444 .PP
michael@13 445 .Vb 4
michael@13 446 \& %start
michael@13 447 \& rcService foo enable yes || exit 0
michael@13 448 \& rcService foo active yes && exit 0
michael@13 449 \& @l_prefix@/sbin/foo --listen ${foo_listen}
michael@13 450 .Ve
michael@13 451 .PP
michael@13 452 .Vb 4
michael@13 453 \& %stop
michael@13 454 \& rcService foo enable yes || exit 0
michael@13 455 \& rcService foo active yes || exit 0
michael@13 456 \& foo_signal TERM
michael@13 457 .Ve
michael@13 458 .PP
michael@13 459 .Vb 4
michael@13 460 \& %restart
michael@13 461 \& rcService foo enable yes || exit 0
michael@13 462 \& rcService foo active yes || exit 0
michael@13 463 \& rc foo stop start
michael@13 464 .Ve
michael@13 465 .PP
michael@13 466 .Vb 7
michael@13 467 \& %daily
michael@13 468 \& rcService foo enable yes || exit 0
michael@13 469 \& shtool rotate -f \e
michael@13 470 \& -n ${foo_log_numfiles} -s ${foo_log_minsize} -d \e
michael@13 471 \& -z ${foo_log_complevel} -o @l_rusr@ -g @l_rgrp@ -m 644 \e
michael@13 472 \& -P "${foo_log_prolog}" -E "${foo_log_epilog}" \e
michael@13 473 \& ${foo_logfile}
michael@13 474 .Ve
michael@13 475 .PP
michael@13 476 .Vb 5
michael@13 477 \& %env
michael@13 478 \& if rcService foo enable yes; then
michael@13 479 \& FOO_HOME="$foo_homedir"
michael@13 480 \& export FOO_HOME
michael@13 481 \& fi
michael@13 482 .Ve
michael@13 483 .PP
michael@13 484 Now, show all run-command configuration variables, their
michael@13 485 default values and their effective values of package "\f(CW\*(C`foo\*(C'\fR":
michael@13 486 .PP
michael@13 487 .Vb 1
michael@13 488 \& $ @l_prefix@/bin/openpkg rc --config | grep "^foo_"
michael@13 489 .Ve
michael@13 490 .PP
michael@13 491 Override the default value of a run-command configuration
michael@13 492 variable \f(CW\*(C`foo_listen\*(C'\fR:
michael@13 493 .PP
michael@13 494 .Vb 1
michael@13 495 \& $ echo 'foo_listen="192.168.0.1"' >>@l_prefix@/bin/openpkg rc.conf
michael@13 496 .Ve
michael@13 497 .PP
michael@13 498 Stop and start from scratch the package "\f(CW\*(C`foo\*(C'\fR":
michael@13 499 .PP
michael@13 500 .Vb 1
michael@13 501 \& $ @l_prefix@/bin/openpkg rc foo stop start
michael@13 502 .Ve
michael@13 503 .PP
michael@13 504 Query the effective value of run-command configuration
michael@13 505 variable \f(CW\*(C`foo_enable\*(C'\fR in a script:
michael@13 506 .PP
michael@13 507 .Vb 1
michael@13 508 \& if [ ".`@l_prefix@/bin/openpkg rc -q foo_enable`" = .yes ]; then ...
michael@13 509 .Ve
michael@13 510 .PP
michael@13 511 Import all environment settings from all (including "\f(CW\*(C`foo\*(C'\fR") installed
michael@13 512 packages into the current Bourne-Shell environment:
michael@13 513 .PP
michael@13 514 .Vb 2
michael@13 515 \& $ eval `@l_prefix@/bin/openpkg rc --eval all env`
michael@13 516 \& $ echo $FOO_HOME
michael@13 517 .Ve
michael@13 518 .SH "SEE ALSO"
michael@13 519 .IX Header "SEE ALSO"
michael@13 520 \&\fBOpenPKG\fR http://www.openpkg.org/
michael@13 521 .SH "HISTORY"
michael@13 522 .IX Header "HISTORY"
michael@13 523 The \fBOpenPKG\fR run-command facility consisting of the scripts \f(CW\*(C`rc\*(C'\fR
michael@13 524 and \f(CW\*(C`rc.func\*(C'\fR were originally invented in November 2000 by Ralf S.
michael@13 525 Engelschall for \fBOpenPKG\fR. They were completely worked off from scratch
michael@13 526 in July 2003 for \fBOpenPKG 1.3\fR.
michael@13 527 .SH "AUTHOR"
michael@13 528 .IX Header "AUTHOR"
michael@13 529 .Vb 3
michael@13 530 \& Ralf S. Engelschall
michael@13 531 \& rse@engelschall.com
michael@13 532 \& www.engelschall.com
michael@13 533 .Ve

mercurial