OSSP CVS Repository

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

Check-in Number: 1615
Date: 2002-Jan-23 15:58:51 (local)
2002-Jan-23 14:58:51 (UTC)
User:ms
Branch:
Comment: flush our brainstorming
Tickets:
Inspections:
Files:
ossp-pkg/rc/rc.pod      1.13 -> 1.14     101 inserted, 0 deleted

ossp-pkg/rc/rc.pod 1.13 -> 1.14

--- rc.pod       2002/01/23 13:44:50     1.13
+++ rc.pod       2002/01/23 14:58:51     1.14
@@ -23,6 +23,106 @@
 ##  SUCH DAMAGE.
 ##
 
+# ref: %start; %stop
+# cfg
+# def --showdefault, --defsetion=config
+
+# --dir=dir1:dir2:..
+# --rcfile='rc.%s'
+# --regex-section='(?<=^|\n)%%%s\s*\n(.+?)(?=\n%\S+|$)'
+# --regex-param='..'
+# --regex-reference='(?<=^|\n)%%%s\s*(.+?)(?=\n|;)'
+# --regex-config='(\s+)=(.*)$'
+# --name-config=config
+# --name-common=common
+
+#  RegexSection (?<=^|\n)%%%s\s*\n(.+?)(?=\n%\S+|$)
+
+# Examples:
+
+# rc.foo
+%config
+    foo=1
+    bar=2
+%start -u root -p 200
+    /cw/bin/fooctl start $foo
+%stop -u root -p 200
+    /cw/bin/fooctl stop $bar
+%restart -u root
+    %stop
+    sleep 1
+    %start
+%foo -c /usr/bin/perl
+    print STDERR "foo";
+
+<!-- rc.foo -->
+<config>
+    <set name=foo>1</set>
+    <set name=bar>2</set>
+</config>
+<start user=root priority=20>
+    /cw/bin/fooctl start $foo
+</start>
+<stop user=root priority=200>
+    /cw/bin/fooctl stop $bar
+</stop>
+<restart user=root>
+    %stop
+    sleep 1
+    %start
+</restart>
+<foo command=/usr/bin/perl>
+    print STDERR "foo";
+</foo>
+
+rc <package> <section> [<section> ...]
+
+foreach sec in <section> [<section> ...] {
+    foreach dir in --dir=dir1:dir2:.. {
+        search for --rcfile where %s is <package>
+        parse rcfile into blocks according to --regex-section/etc.
+        remember common/<section> into list
+    }
+    // we now have an unsorted list of common/<section>
+    sort list of common/<section> according to their priority (see --regex-param)
+
+    // execution
+    forearch common/<section> in list {
+        prepend config section
+        prepend common section
+        expand references accordingf to --regex-reference
+        execute result as user/group (see --regex-param) with interpreter (see --regex-param)
+    }
+}
+
+
+cd () {
+    eval `rc --eval --rcfunc=$HOME/.cdfunc --rcfile-owner=$USER --rcfile-umask=022 --dir .:..:../..:../../.. --rcfile .cd all leave`
+    builtin cd ${1+"$@"}
+    eval `rc --eval --rcfunc=$HOME/.cdfunc --rcfile-owner=$USER --rcfile-umask=022 --dir .:..:../..:../../.. --rcfile .cd all enter`
+}
+
+#  $HOME/.cdfunc
+AddPath () {
+    ...
+}
+RemPath () {
+    ...
+}
+
+# .cd
+%enter
+    FOO=1
+    export FOO
+    AddPath `pwd`/bin
+%leave
+    unset FOO
+    RemPath `pwd`/bin
+
+TODO:
+- error semantic: imediate faulure or skip failured
+- security => --rcfile-umask
+
 =pod
 
 =head1 NAME
@@ -48,6 +148,7 @@
 [B<-r>|B<--raw>]
 [B<-v>|B<--verbose>] 
 [B<-D>|B<--debug>] 
+[I<command>]
 [I<command-options>]
 [I<command-arguments>]
 

CVSTrac 2.0.1