OSSP CVS Repository

ossp - ossp-pkg/rc/00TODO 1.12
Not logged in
[Honeypot]  [Browse]  [Directory]  [Home]  [Login
[Reports]  [Search]  [Ticket]  [Timeline
  [Raw

ossp-pkg/rc/00TODO 1.12
00TODO: Tasks left to accomplish before rc is complete

Spec fehlt
  Security
    Off switch
  Command interpreter
    Beispiel
    Default
    Error
  Inconsistent
    rc.conf rc.config rc.env
    package command program section rcfile rc.file
    runcommand run command (run-command?)
  Environment
    Genaue wie comline- und rc.conf Optionen
    Ausname drei schon stehen

Consider
  Make return code and error definitions unique to OSSP rc.
  Offer include directive in config file.

Must do
  Strip local popt code, and move in OSSP popt library.
  Translate rc bourne shell script to ANSI C.
  Finish man page. Start latex or Docbook guide.
  If a variable is defined for which no default exists, warn user (Scholli.)
  Avoid a silent failure when giving non-existent run commands (Marcus.)

Automated environment
  Stock rc.func includes AddPath, DelPath, PermMask.

Error handling
  Classic error, give 'restart' command in place of 'start' to stopped prog

        /-------------------OSSP rc Inhalt------------------\
        | Manpage                                           |
        |   rc.1          Section 1 oder 8-Konflict?        |
        |   rc-sample.5   Vielleicht umnennen rc.usecases.5 |
        |   rc.conf.5     Beschreibung aber kein Beispiel   |
        |                                                   |
        | Geliefert                                         |
        |   rc.env        Leer                              |
        |   rc.conf       Ausgekommentet Beispiel           |
        |                                                   |
        | Beispiele                                         |
        |   rc.example    Soll rc.fooboar umgenannt werden  |
        \---------------------------------------------------/

Pseudocode
                ***********************************
                * psoudocode implementation of rc *
                ***********************************

parse 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 locate {
    for each (locate all possible rcfiles after variable expansion and shell globbing) {
        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 += 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);
}

CVSTrac 2.0.1