Check-in Number:
|
1679 | |
Date: |
2002-Jan-29 09:53:03 (local)
2002-Jan-29 08:53:03 (UTC) |
User: | ms |
Branch: | |
Comment: |
overhauling the location determination of rc files |
Tickets: |
|
Inspections: |
|
Files: |
|
ossp-pkg/rc/rc-sample.pod 1.2 -> 1.3
--- 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<OSSP rc> is used as the B<OpenPKG>
-(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<OpenPKG>
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</cw/etc/rc.func> (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 path="%{RCFILE}">(.*)<\/dir>/i
+ Locate ${HOME}/.duerc.%{RCFILE:s/^\///:s/[\/]/-/g}
+
+ # restrictions on RC files
+ RequireUmask 022
+ RequireOwner ${USER}
+ RequireGroup ${USER:F<user2group>}
+
+ # how to parse RC files
+ Functions $HOME/.duefunc
=item F<$HOME/.duefunc>
@@ -237,38 +253,38 @@
=item F</cw/.duerc>
- <event name=enter>
- duePathAdd PATH $CWD/bin $CWD/sbin
- duePathAdd MANPATH $CWD/man
- duePathAdd INFOPATH $CWD/info
- duePathAdd LD_LIBRARY_PATH $CWD/lib
- </event>
- <event name=leave>
- duePathDel PATH $CWD/bin $CWD/sbin
- duePathDel MANPATH $CWD/man
- duePathDel INFOPATH $CWD/info
- duePathDel LD_LIBRARY_PATH $CWD/lib
- </event>
+ <event name=enter>
+ duePathAdd PATH $CWD/bin $CWD/sbin
+ duePathAdd MANPATH $CWD/man
+ duePathAdd INFOPATH $CWD/info
+ duePathAdd LD_LIBRARY_PATH $CWD/lib
+ </event>
+ <event name=leave>
+ duePathDel PATH $CWD/bin $CWD/sbin
+ duePathDel MANPATH $CWD/man
+ duePathDel INFOPATH $CWD/info
+ duePathDel LD_LIBRARY_PATH $CWD/lib
+ </event>
=item F<$HOME/.dueglobal>
- <directory path=/cw>
- <event name=enter>
- duePathAdd PATH /cw/bin /cw/sbin
- duePathAdd MANPATH /cw/man
- duePathAdd INFOPATH /cw/info
- duePathAdd LD_LIBRARY_PATH /cw/lib
- </event>
- <event name=leave>
- duePathDel PATH /cw/bin /cw/sbin
- duePathDel MANPATH /cw/man
- duePathDel INFOPATH /cw/info
- duePathDel LD_LIBRARY_PATH /cw/lib
- </event>
- </directory>
- <directory path=/usr/opkg>
- ...
- </directory>
+ <dir path=/cw>
+ <event name=enter>
+ duePathAdd PATH /cw/bin /cw/sbin
+ duePathAdd MANPATH /cw/man
+ duePathAdd INFOPATH /cw/info
+ duePathAdd LD_LIBRARY_PATH /cw/lib
+ </event>
+ <event name=leave>
+ duePathDel PATH /cw/bin /cw/sbin
+ duePathDel MANPATH /cw/man
+ duePathDel INFOPATH /cw/info
+ duePathDel LD_LIBRARY_PATH /cw/lib
+ </event>
+ </dir>
+ <dir path=/usr/opkg>
+ ...
+ </dir>
=cut
|
|