OSSP CVS Repository

ossp - Check-in [1685]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 1685
Date: 2002-Jan-29 16:35:05 (local)
2002-Jan-29 15:35:05 (UTC)
User:ms
Branch:
Comment: Pseudocoded anad small adjustments.

PR: Submitted by: Reviewed by: Approved by: Obtained from:

Tickets:
Inspections:
Files:
ossp-pkg/rc/00TODO      1.9 -> 1.10     67 inserted, 0 deleted
ossp-pkg/rc/rc.conf      1.3 -> 1.4     21 inserted, 19 deleted
ossp-pkg/rc/rc.pod      1.22 -> 1.23     40 inserted, 11 deleted

ossp-pkg/rc/00TODO 1.9 -> 1.10

--- 00TODO       2002/01/25 16:04:41     1.9
+++ 00TODO       2002/01/29 15:35:05     1.10
@@ -25,3 +25,70 @@
 
 Error handling
   Classic error, give 'restart' command in place of 'start' to stopped prog
+
+Pseudocode
+                ***********************************
+                * psoudocode implementation of rc *
+                ***********************************
+
+parse command line options
+read and merge all "rc.conf" files
+
+parse "Locate"
+
+ Locate        /cw/etc/rc.d/rc.%{RCFILE:s/^all$/*/}
+ Locate        /cw/local/etc/rc.d/rc.%{RCFILE:s/^all$/*/}
+ Locate        %{RCFILE}/.duerc
+ Locate        ${HOME}/.duerc:m/^<dir path="%{RCFILE}">(.*)<\/dir>/i
+ Locate        ${HOME}/.duerc.%{RCFILE:s/^\///:s/[\/]/-/g}
+ Locate        path/file/regex:regex_inside_file
+
+foreach given locate {
+    for each (locate all possible rcfiles working out the regex) {
+        continue if (absolute path seen previously) //avoid duplicates
+        if (filename matches given rcfile && securitycheck(RequireUmask, RequireOwner, RequireGroup))
+            load file and grab only a part of the file according to info after colon given in "locate"
+    }
+}
+
+foreach located_rcfile_fraction {
+        parse rcfile into blocks according to --ParseSectionDef
+        take out %config section according to --NameConfig
+        take out %common section according to --NameCommon
+        take out any sections given on command line
+}
+
+foreach section {
+    if (multiple rcfiles, i.e. all)
+        sort rcfiles by section priority.
+    foreach rcfile {
+        script = "";
+        script += %config from rcfile
+        script += %env from rc.env and override it
+        create_script_for_rcfile(script, section, parent=no)
+        expand our internal variables
+        execute, print or printeval script with user & group priveleges
+            and command interpreter according to options or section header
+    }
+}
+EXIT
+
+
+create_script_for_rcfile(script, section, parent)
+{
+    script += "${body}" //start with a pseudo value
+
+    if (!parent) { //only one rc.func!?
+        replace ${body} with %common from rc.func
+        if no ${body} assume prepend
+    }
+    replace ${body} with %common from rcfile
+    if no ${body} assume prepend
+    if (!parent) { //only one rc.func!?
+        replace ${body} with %section from rc.func
+        if no ${body} assume prepend
+    }
+    replace ${body} with %section from rcfile
+
+    expand references using --ParseSectionRef and calling create_script_for_rcfile(section, parent=yes);
+}


ossp-pkg/rc/rc.conf 1.3 -> 1.4

--- rc.conf      2002/01/28 16:01:23     1.3
+++ rc.conf      2002/01/29 15:35:05     1.4
@@ -11,17 +11,17 @@
 debug
 #raw
 
-defaultsection  config          #name for config section in rcfile
+configsection   config          #name for config section in rcfile
 commonsection   common          #name for common section in rcfile
 rcfile          'rc.%s'         #'rc.' followed by the program name
 rcumask         002             #mask checked against rcfile permissions
 deactivate      OSSP_RC_DEACT   #environment variable controls activation
 interpreter     /usr/bin/perl   #command interpreter to use for script code
 
-regex-sec       '(?<=^|\n)%%%s\s*\n(.+?)(?=\n%\S+|$)'
-regex-ref       '(?<=^|\n)%%%s\s*(.+?)(?=\n|;)'
-regex-assign    '(\s+)=(.*)$'
-regex-param     '..'            #needs explanation
+regexsection   '(?<=^|\n)%%%s\s*\n(.+?)(?=\n%\S+|$)'
+#RSE what about ${begin} regexref       '(?<=^|\n)%%%s\s*(.+?)(?=\n|;)'
+regexassign    '(\s+)=(.*)$'
+regexparam     '..'             #needs explanation
 
 
 
@@ -29,23 +29,25 @@
 
 
 
-#conf       it's not possible to set the conf file in the conf file
+
+usage       #flag
+debug       #flag
+force       #flag
+version     #flag
+#conf       #it's too late to set the conf file in the conf file
+dirs        /cw/etc/rc.d:/etc/rc.d
+eval        #flag
 func        rc.iofunc \
             rc.dbgfunc \
             rc.exfunc
-force       #flag
-dirs        /cw/etc/rc.d:/etc/rc.d
-tmp         /var/tmp
-verbose     #flag
-silent      #flag
-debug       #flag
-raw         #flag
 help        #flag
-usage       #flag
-version     #flag
+info        #flag
+labels      start
 print       #flag
-eval        #flag
-exec        #flag
 query       ${foovar:-foodefault}
-labels      start
-info        #flag
+silent      #flag
+raw         #flag
+tmp         /var/tmp
+verbose     #flag
+exec        #flag
+


ossp-pkg/rc/rc.pod 1.22 -> 1.23

--- rc.pod       2002/01/29 09:14:38     1.22
+++ rc.pod       2002/01/29 15:35:05     1.23
@@ -40,10 +40,9 @@
 @l_prefix@/etc/rc
 [B<-?>|B<--usage>]
 [B<-D>|B<--debug>] 
-[B<-F>|B<--force>]
+[B<-L>|B<--locate> I<dir>[C<:>I<dir>[...]]]
 [B<-V>|B<--version>]
 [B<-c>|B<--conf> I<file>[C<:>I<file>[...]]]
-[B<-d>|B<--dirs> I<dir>[C<:>I<dir>[...]]]
 [B<-e>|B<--eval>]
 [B<-f>|B<--func> I<file>[C<:>I<file>[...]]] 
 [B<-h>|B<--help>]
@@ -56,6 +55,13 @@
 [B<-t>|B<--tmp> I<dir>]
 [B<-v>|B<--verbose>]
 [B<-x>|B<--exec>] 
+[B<--RequireUmask umask>]
+[B<--RequireOwner uid|name>]
+[B<--RequireGroup gid|name>]
+[B<--ParseSectionDef regex>]
+[B<--ParseSectionRef regex>]
+[B<--NameConfig> name]
+[B<--NameCommon> name]
 I<rcfile>
 I<section>
 
@@ -97,12 +103,11 @@
 
 don't remove temporary files, and output debug messages to stderr
 
-=item B<-F>|B<--force>
+=item B<-L>|B<--locate> I<file>[C<:>I<part>]
 
-Usually F<rcfile> is a fraction of a filename and the run command facility
-prefixes this name with ${OSSP_RC_PREFIX} and appends ${OSSP_RC_SUFFIX} to it,
-then searches the file in directories given using --dirs.  If the initial
-F<rcfile> matches the regex '^\.{0,2}/', --force is automagically assumed.
+locations to search for F<rcfile>s where I<file> can contain regex patterns to
+filter files and the optional part is a regex to filter out parts of a file.
+This option can be specified more than once.
 
 =item B<-V>|B<--version>
 
@@ -113,10 +118,6 @@
 specify the location of the configuration file.  If omitted, the fallback is
 to look for C<$OSSP_RC_CONF>, and "@l_prefix@/etc/rc.conf", in that order.
 
-=item B<-d>|B<--dirs> I<dir>[C<:>I<dir>[...]]
-
-directories to search for F<rcfile>s.
-
 =item B<-e>|B<--eval>
 
 output the commands text in a format suitable for shell evaluation, but do not run it.
@@ -175,6 +176,34 @@
 If neither B<--print>, B<--eval>, or B<­-exec> is given, the default is
 B<--exec> anyway.
 
+=item B<--RequireUmask umask>
+
+umask a F<rcfile> has to have, otherwise it's ignored.
+
+=item B<--RequireOwner uid|name>
+
+owner of the F<rcfile> must match uid|name, otherwise it's ignored.
+
+=item B<--RequireGroup gid|name>
+
+group of the F<rcfile> must match gid|name, otherwise it's ignored.
+
+=item B<--ParseSectionDef regex>
+
+regex matching a section within a F<rcfile>.
+
+=item B<--ParseSectionRef regex>
+
+regex matching a reference within a F<rcfile>.
+
+=item B<--NameConfig> name
+
+name of the config section, defaults to %config.
+
+=item B<--NameCommon> name
+
+name of the common section, defaults to %common.
+
 =back 4
 
 =head1 ENVIRONMENT

CVSTrac 2.0.1