Index: ossp-pkg/rc/rc-sample.pod RCS File: /v/ossp/cvs/ossp-pkg/rc/rc-sample.pod,v rcsdiff -q -kk '-r1.2' '-r1.3' -u '/v/ossp/cvs/ossp-pkg/rc/rc-sample.pod,v' 2>/dev/null --- rc-sample.pod 2002/01/28 16:23:20 1.2 +++ rc-sample.pod 2002/01/29 08:53:03 1.3 @@ -12,7 +12,9 @@ =head1 USE CASE: OpenPKG Run-Command Facility This describes how B is used as the B -(http://www.openpkg.org/) run-command facility. First, the involved files: +(http://www.openpkg.org/) run-command facility. + +First, the involved files: =over 4 @@ -27,18 +29,27 @@ C<--with-config=/cw/etc/rc.cf>. It is installed at B bootstrap time and used read-only. - Dirs /cw/etc/rc.d:/cw/local/etc/rc.d - Name rc.%s/rc.* - ConfigDef (?<=^\s*)([a-zA-Z_][a-zA-Z_0-9]*)=("[^"]*"|'[^']*'|\S+) - SectionDef (?<=^|\n)%([a-zA-Z][a-zA-Z0-9]*)(\s+-[a-zA-Z]\s*\S+)\s*\n(.+?)(?=\n%%\S+|$) - ParamDef (?<=^|\s)-([a-zA-Z])\s*(\S+) - SectionRef (?<=^\s*|;\s*)%([a-zA-Z][a-zA-Z0-9]*)(\s+[^\n]+)? - ParamRef \$([0-9]) - NameConfig config - NameCommon common - Execute root %s - Execute !root sudo %s - LineControl yes + # how to locate RC files + Locate /cw/etc/rc.d/rc.%{RCFILE:s/^all$/*/} + Locate /cw/local/etc/rc.d/rc.%{RCFILE:s/^all$/*/} + + # requirements on RC files + RequireUmask 022 + RequireOwner cw + RequireGroup cw + + # how to parse RC files + ParseConfigDef (?<=^\s*)([a-zA-Z_][a-zA-Z_0-9]*)=(?:"([^"]*)"|'([^']*)'|(\S+)) + ParseSectionDef (?<=^|\n)%([a-zA-Z][a-zA-Z0-9]*)(\s+-[a-zA-Z]\s*\S+)*\s*\n(.+?)(?=\n%%\S+|$) + ParseSectionParam (?<=^|\s)-([a-zA-Z])\s*(\S+) + ParseSectionRef (?<=^\s*|;\s*)%([a-zA-Z][a-zA-Z0-9]*)(\s+[^\n]+)? + ParseParamRef \$([0-9]) + NameConfig config + NameCommon common + + Execute root %s + Execute !root sudo %s + LineControl yes =item F (C<%common> extensions) @@ -159,21 +170,26 @@ =item F<$HOME/.bashrc> - cd () { - eval `rc --eval --conf=$HOME/.duecf - leave` - builtin cd ${1+"$@"} - eval `rc --eval --conf=$HOME/.duecf - enter` - } + cd () { + eval `rc --eval --conf=$HOME/.duecf $PWD leave` + builtin cd ${1+"$@"} + eval `rc --eval --conf=$HOME/.duecf $PWD enter` + } =item F<$HOME/.duecf> - Dirs .:..// # current and all parent dirs - Name .duerc - NameGlobal $HOME/.dueglobal:/etc/dueglobal - RequireUmask 022 - RequireOwner %{USER} - RequireGroup %{GROUP} - Functions $HOME/.duefunc + # how to locate RC files + Locate %{RCFILE}/.duerc + Locate ${HOME}/.duerc:m/^(.*)<\/dir>/i + Locate ${HOME}/.duerc.%{RCFILE:s/^\///:s/[\/]/-/g} + + # restrictions on RC files + RequireUmask 022 + RequireOwner ${USER} + RequireGroup ${USER:F} + + # how to parse RC files + Functions $HOME/.duefunc =item F<$HOME/.duefunc> @@ -237,38 +253,38 @@ =item F - - duePathAdd PATH $CWD/bin $CWD/sbin - duePathAdd MANPATH $CWD/man - duePathAdd INFOPATH $CWD/info - duePathAdd LD_LIBRARY_PATH $CWD/lib - - - duePathDel PATH $CWD/bin $CWD/sbin - duePathDel MANPATH $CWD/man - duePathDel INFOPATH $CWD/info - duePathDel LD_LIBRARY_PATH $CWD/lib - + + duePathAdd PATH $CWD/bin $CWD/sbin + duePathAdd MANPATH $CWD/man + duePathAdd INFOPATH $CWD/info + duePathAdd LD_LIBRARY_PATH $CWD/lib + + + duePathDel PATH $CWD/bin $CWD/sbin + duePathDel MANPATH $CWD/man + duePathDel INFOPATH $CWD/info + duePathDel LD_LIBRARY_PATH $CWD/lib + =item F<$HOME/.dueglobal> - - - duePathAdd PATH /cw/bin /cw/sbin - duePathAdd MANPATH /cw/man - duePathAdd INFOPATH /cw/info - duePathAdd LD_LIBRARY_PATH /cw/lib - - - duePathDel PATH /cw/bin /cw/sbin - duePathDel MANPATH /cw/man - duePathDel INFOPATH /cw/info - duePathDel LD_LIBRARY_PATH /cw/lib - - - - ... - + + + duePathAdd PATH /cw/bin /cw/sbin + duePathAdd MANPATH /cw/man + duePathAdd INFOPATH /cw/info + duePathAdd LD_LIBRARY_PATH /cw/lib + + + duePathDel PATH /cw/bin /cw/sbin + duePathDel MANPATH /cw/man + duePathDel INFOPATH /cw/info + duePathDel LD_LIBRARY_PATH /cw/lib + + + + ... + =cut