
      ALT Linux alterator 2.0.

:
alterator  ,       ,   .

1:  .

1. .

     ,               ,   .
            :         .  , frontend  backend.
,                  ,          .

Alterator  frontend  backend  ݣ   -  ,        ,  , ,       .         .

2.     Alterator.

, alterator   ң ϣ.      ,      .       ,     .

   ,       .
    ͣ            ( )    ͣ,     ף (  ).
       :     ,      ͣ   .   .
:
 * /users - .     ,    (   -   ).        .
 * /ldap/users -    LDAP.  ldap   ͣ,  users -  
 * /ldap/users/test -  test   ldap. ldap  ͣ, users -  , test -   . ldap  users - , test - .
 * /local/users -      (/etc/passwd).
 * /services/ -  
 * /services/cups -   .

  : < > <>=<> <>=<> ... 

      .   backend     action    ң  :
 * new -  
 * delete -  
 * read -    
 * write - /   .

 :
 * /users/test chpasswd=123  -     test   "123" ( ,      ).
 * /ldap/users/test action=new uid=123 -    test  uid=123.
 * /services/cups action=delete -    cups.
 
 ,      ,          :    -  WOO,   backend -  HOO.

      ,        WOO  HOO.  WOO  HOO    ,    - ӣ    .

     ,       .         .  "action=read", Σ   ,       .   -      -  .      ,    .

       ,       :
,  "/users/test action=read"   "/users/test uid=123"

      ,      ,   "/users action=read"  :
/users/test1
/users/test2
/users/test3

    /ctrl/ -   ͣ     alterator.

     /error/  /error?/ -      .         ,      ,     .

3.  Alterator.

      Alterator? Σ    :

3.1 Look

Look -    ,    .   - , ,  http.
        ,        .        .   ,   ,   -      ,        WOO.        -   . ,  listbox       WOO: /users action=read.        ,     .
           /ctrl/look.   :
* /ctrl/look action="view" id="viewid" -       id.
* /ctrl/look action="file" name="filename" -        filename.

  ӣ     , ݣ  ""  .

3.2 WooCache

  Look    WOO.    ,      ,       .     :
 * /ctrl/cache action="reset" -  
 * /ctrl/cache action="ignore" -    (),   .
  :
 count -   ,
 id - id ,    .
 * /ctrl/cache action="unignore" -  "ignore".

  ̣ ,       .
  "action"  "write"  "delete" (    ),       "action"  "read".

ݣ  ,         .           ģ,     woocache   ۣ.

3.3 Chooser

Chooser - ,   ,    .
  -  ,     WOO    HOO       .      ,      .
, ,   ,         , ģ ,      LDAP.
     "/users action=read"    : "/local/users action=read"  "/ldap/users action=read".           ,    .  "/local/users/test1"  "/ldap/users/test2"   "/users/test1"  "/users/test2".       ,          .

ݣ  ,    .   ,    ,       .       ,      .
  chooser  "/users/test action=write passwd1=132 passwd2=234",        ,   "/users/test action=write passwd=123"  "/error/users/test action=write reason='passwords mismatch'" .

3.4 Brook

  Chooser      HOO,          .  ,        Samba  ,     :
     :
"   "
    samba :
"    "
"    samba".

        . Brook    ,       .
   :   .  -     ,   . : "/users  uid=123"  "/users gid=234"   "/users uid=123 gid=234".
     , ,      
"a b",   - "b a".
  ,       ӣ  .

      Brook,     .

3.5 Backend.

      backend.             .
  ,  executor,   ݣ        Backend ̣   ,    .
      ,        .

             - admfs.         .

 ,  defusator,       -  .

         :
*        ,     Alterator.
*        Alterator -        
*        ,  CVS,     ,        .  CVS   ݣ    -    WOO.    ,                    .   ,    ģ  ,      ,        .   -      .
*         ,     (  ģ  ).
  :
*       Linux    ,           .
*  admfs         -        ,          admfs,    dead-lock.  dead-lock      admfs,      .
* - -                          ţ   .

 ,           .

3.6 WooBus

ݣ   Alterator,        ,      .
  Alterator: Look, Cache, Chooser, Brook, Backend         WooBus.
WooBus -   (   ) ,             Σ   . /    ,       ,   .
 ,     ,      . ,    ,   ,    Backend       .
           ,     ,   .  ң, , ,   Chooser,   ,         .     ;)
WooBus  ,     /   . ,   ,  Cache  Chooser.    ,        , ,    Look  Backend     ,  Chooser.
  
    Ctrl-C  ,    .      .

 :
load -    
append/insert -  
remove -  
help -    
exit -   .
status -     
start -  
stop -  

 Ctrl-D     .

 2.     ALTerator

1.  .

  ,        ALTerator  ,    .
      .    : local -  , fake -   .
     :
 * type -    local  fake
 * uid -  
 * gid -  
 * gecos -  , , ,   
 * home -  
 * shell -  -
 * passwd -     

    local     ,   fake    ,     ,  ,    .

 ,    ,       () , ף : local_users  fake_users.         .
    ,    fake         .    local - :
 *   ,       (, uid),       
 *   
 *    , ޣ         
 *      
    :     ,        ,    ,    - .

2.  .

     ,       WOO.
 *    -           ,          fake,     local
  ** : /users action=read
  ** :   /users/< >
 *   
  ** : /users/<> action=read
   ** : /users/<> type=< > uid=<uid> gid=...
 *     
   ** : /users/<> action=write type=<> passwd1=< > passwd2=< >
   ** :  passwd1 = passwd2 -  ,  - : /error/users/<> action=write reason="Passwords mismatch"
 *    
   ** : /users/<> action=write type=<> uid=<uid> ...
   ** :  ӣ  -  ,  -  /error/users/<> action=write reason="".
 *  
   ** : /users/<> action=new type=local home=<home> gecos=<gecos> shell=<shell>
   ** :  ӣ  -  ,  -  /error/users/<> action=new reason="".
 *  
   ** : /users/<> action=delete type=<>
   ** :  ӣ  -  ,  -  /error/users/<> action=delete reason="".
 
       Backend'a:     ,    .             ģ ,     ,       type.    , backend'  ,      type, passwd1  passwd2.
  HOO  local_users  fake_users    ,      :
 * /local_users action=read -    
 * /local_users/<> action=read -   
 * /local_users/<> action=write uid=<uid> -    
 * /local_users/<> action=new home=<home> -          
 * /local_users/<> action=delete -    

 3. Backend

    executor,           .         ݣ  defusator.

    admfs.  backend     ţ     .  ,  admfs    /admfs    :
--
/admfs
/admfs/ldap/users
/admfs/ldap/server
/admfs/local_users
--
 ldap   users  server   backend,  local_users - .   backend'    .

  backend    ?  ,   -    ,  backend  ̣   ,           .

  ,      backend           .      ,     .
     stateless backend'   ݣ  ,  backend             .

 Backend'a     ,           admfs.      backend'   local_users,  - fake_users.
   backend',  admfs    :
--
/admfs/local_users/
/admfs/fake_users/
...
--
,     backend:
a)      -l <> -   ,       ,    <>.  :
--
1<>1
2<>2
....
--
  - "d"  , "r" -  .  ,     ,        .

           :
--
$local_users -l /
user1 r
user2 r
user3 r
.....
--
   ,   ldap,    :
--
$ldap -l /
users d
server d
...
$ldap -l /users
ldap_user1 r
ldap_user2 r
...
--
b)      -f <>, ,       .     ,   ,   -   .
--
$ldap -f /users/ldap_user_unknown
<>
$ldap -f /users/ldap_user1
ldap_user r
--
  :
--
$local_users -l user1
user1 r
--
c)      "-w  ", ,       ,    .     ,     .
 backend   stdin   :
--
1:1
2:2
...
--
   EOF, ,      backend    .
  :
--
$local_users -w test1
uid:123
gecos:llll
<Ctrl-D>
--
    (   )  test1  uid=123, gecos=llll
d)      "-r  ", ,      . 
backend   stdout   :
--
1:1
2:2
...
--
  :
--
$local_users -r root
local_users -r root
uid:0
gid:0
gecos:System Administrator
home:/root
shell:/bin/bash
--
e)      "-d  ", ,     .
  :
--
$local_users -d test1
--
   test1.

 ݣ ޣ       admfs   backend'a, ģ  .        ,      backend'a
--------------------------------------------------------------
admfs					|backend
--------------------------------------------------------------
$cd /admfs				|     backend'  
$ls					|    
.					|
---------------------------------------------------------------
$mkdir local_users			|  backend    
$ls					|  <plugin_dir>/local_users,   
local_users				|      
---------------------------------------------------------------
$cd local_users				|   "<plugin_dir>/local_users -l /"
$pwd					|  :
/admfs/local_users			|	user1 r
$ls					|	user2 r
user1					|	user3 r
user2					|	.....
user3					|
.....					|
---------------------------------------------------------------
$stat user1				|   "<plugin_dir>/local_users -f user1"
 File: `./local_users'			|  :
  Size: 2160            Blocks: 8 	|	user1 r
---------------------------------------------------------------
$cat root				|   "<plugin_dir>/local_users -r root"
uid:0					|  :
gid:0					| 	uid:0
gecos:System Administrator		|	gid:0
home:/root				|	....
shell:/bin/bash				|
---------------------------------------------------------------
$echo "gecos:SuperAdmin" >root		|   "<plugin_dir>/local_users -w root"
					|    stdin: "gecos:SuperAdmin",  
					|     root
---------------------------------------------------------------
$rm user1				|   "<plugin_dir>/local_users -d user1"
					|    user1  
---------------------------------------------------------------
$stat user1				| "<pligin_dir>/local_users -f user1"   
stat:   stat...	|     
----------------------------------------------------------------


,   ӣ,      backend' local_users  fake_users,      ALTerator.

4 .

  ,      ,    WOO    HOO ,              .

    ,         ,       . ,     :
*   ,       .
*   ,   .

   ,      ,       ݣ     ALTerator'a.

ALTerator    " ":
* commander (   admiral) -   
* rcommander -   .

4.1   (commander)

: commander      Σ   admiral.

commander     :
,      

 , "init"  "convert".

   commander     ,  :
#!/usr/bin/commander /bin/bash

( )
      :
%. < ,   >
<        >

   commander             .   /    init/convert   ,         ,      .

 ,   ,   :
"<.   > <.   1>=<.  1> <.  2>=<.  2>"
:
 /users/ action=read  :
^/users$ ^action$=^read$
 /users/< > action=read  :
^/users/(.*)$ ^action$=^read$
 /users/< > action=write passwd1=< >  :
^/users/(.*)$ ^action$=^write$ ^type$=^local$ ^passwd1$=^(.*)$

commander      ,      ,    .  ,     ,    ,     .

(  )
     , ֣ ,      
 : %match:_.
 , ݣ   %attrs:all -      .     /users action=read passwd=123, %attr:all   "action=read passwd=123".
  ,    .     ,      %.
:
  : action=%match:1 value=....
   : action=%match:1% value=...

()
  ӣ           .   ,       ,    () HOO :
 1)      :
:
/users action=read
:
/local_users action=read
/fake_users action=read
 2)   .   ݣ    ,     ,   ͣ     :
:
/users/<> action=read
:
/local_users/<> action=read
/fake_users/<> action=read
 3)   
 :
 /users/<> action=write type=<> passwd1=< > passwd2=< >
 :
 	  local.
	  :
		/local_users/<> action=write passwd=< > {  }
	   :
		/error/local_users/<> action=write reason="Passwords mismatch"
	  fake - .
 4)    .     ,       
 :
 /users/<> action=write type=<>
 :
 	  local.
		/local_users/<> action=write < >
	  fake - .
5,6)        4.

          ALTerator.    ̣   .   local_users,   fake_users.

4.1+   (admiral)

admiral     :
* 
*  , "init"  "convert".

   admiral     ,  :
":" ; exec ./admiral $0 $1

( )
    S-  :
( < -   > <    Schem    >)

   admiral             .   /    init/convert   ,         ,      .

,      :
(< > < 1> < 1> < 2> < 2> ... )
       .   ,      "^$".
:
 /users/ action=read  :
(/users/ action read)
 /users/< > action=read  :
("^/users/(.*)$" action read)
 /users/< > action=write passwd1=< >  :
("^/users/(.*)$" action write type local passwd1 "^(.*)$")

admiral                .            ,     .

(  )
      ֣ ,      
 : (match _).
  ݣ    (all-attrs) -     .     /users action=read passwd=123, (all-attrs) Σ (action "read" passwd "123").
     hoo-   (hoo-command <-> <1> <1> <2> <2> ...).     all-attrs,    apply "(apply (hoo-command /test ) (all-attrs))".        (    ),     , (hoo-command '/users 'action "read")

()
  ӣ           .   ,       ,    () HOO :
 1)      :
:
/users action=read
:
/local_users action=read
/fake_users action=read
 2)   .   ݣ    ,     ,   ͣ     :
:
/users/<> action=read
:
/local_users/<> action=read
/fake_users/<> action=read
 3)   
 :
 /users/<> action=write type=<> passwd1=< > passwd2=< >
 :
 	  local.
	  :
		/local_users/<> action=write passwd=< > {  }
	   :
		/error/local_users/<> action=write reason="Passwords mismatch"
	  fake - .
 4)    .     ,       
 :
 /users/<> action=write type=<>
 :
 	  local.
		/local_users/<> action=write < >
	  fake - .
5,6)        4.

          ALTerator.    ̣   .   local_users,   fake_users.

(  chooser   )
Chooser   commander'  .
  ,    commander',   ţ ,    ţ  " ".  commander    HOO.         .
 ,      ģ    (     /error/),      ,     .
   ,    ,     ,    ,    .
   ,   WOO    chooser       .


4.2   (rcommander)

    ,    ,   .            ,    .

 :      ,   ,      : WOO ,     ,   HOO ,  .

 :   ,        ,     .

 :       ,    
          .    ,        ,    .

       ,         rcommander':   fake_users,   local_users.      ,       rcommander' (,         Samba).

( )
  rcommander     commander (      ;)) )     :
%. < ,   WOO >
<   >
     :
%.. < ,   HOO >
<       WOO >

ӣ :   ,   -  .
 ,       HOO    %match2.

()
      ( local_users,  fake_users  ӣ ):
1.      .      backend'  ,  ,     
: /local_users/<>
	: /users/<>

	: /error/local_users
	: /error/users
2.     .    :   ,      .       ,    backend'    .       ,  ӣ  .    HOO /error    /error,   /error? (    ).    . Chooser   ң     -      .
  
 	: /local_users/<> 
 	: /users/<> 
  
 	: /error/local_users/<> 
 	: /error?/users/<> 


  3)        /error/local_users  /error/users

    rcommander      ALTerator.

(  chooser   )
  HOO , Chooser,  Σ  ,   rcommander'   ,        .
    WOO ,    .     ,    .     ,    Brook    :
 * ,       reason -    .
 *          ,       ,            .

 ģ      ,   /error?//  /,   ,      .

,        ,      ,   ,   ӣ  .

5. .

        -    ,      .         Look.    :   ,  ,  WWW .       .

             Look.
      . Look       .     ,      ,     .      .

              mapper. Mapper   ,     .
   .   s-    :
 (_ file  [ ]) -   ,         .
 (_1 view 2 [ ]) -      ,  ,          .
 (include "__") -      .

        :
 * /tmp/tttt -    ( symbol  scheme)
 * "/tmp/ttt" -    ( string  scheme)
 * ,(make-regexp  ) -    .
 * '(/tmp/lll /tmp/zzz) -    ͣ (  list  scheme)

       ,  ,(make-regexp "/users/(.*)"),       : ,(later (match _))

 :
   (/zuzu/ file zuzu.scm) -       "/zuzu/",     ,    zuzu.scm.
   (/wa/ view /) -       "/wa/"        "/".
   (,(make-regexp "/users/(.*)") file "user.scm" username ,(later (match 1))) -           "/users/(.*)",  "/users/test",        "user.scm",      'username="test"'.         ,     , "    test,    ".         username,     "test".

 ң   .
Look      ң :
*   Mapper.
*  
*    ,            .

""       :
  layout
  
  listbox.
  layout
  
  layout
...

  ""   ,      .
       :
*   
*   

    : ( )
   : ( < > < > ... )
    :  (button),   (label),   (edit).
   :  layout (vbox),  layout (hbox),  (listbox).    . vbox  hbox    .  -  label.  ,  label      text  pixmap,   listbox         .

            :
(hbox
  (button "Button1")
  (button "Button2"))

   ӣ  .       Scheme.        ,     . :
(define (two-buttons)
 (hbox
    (button "Button1")
    (button "Button2")))

(vbox (two-buttons) (two-buttons))

       .

 ,  ""  .              ?  ,        :
(on- <  woo> )
    ,      admiral, , ('/users 'action "read"). C     ,  look-quit    .
    "Hello World":

(label "Hello World")
(button "Exit" (on-click look-quit))

       "Hello World"  ,    ģ    look.    -  ,      .     id,   ,        ,   .
:
(id 'test (label "Hello World"))
   ,     test.         (   Scheme).
  ,     .         .    ,     .

(id 'my-label (label "Hello World"))
(button "Change text" (on-click (look-attr 'my-label text "Changed Hello")))
(button "Exit (on-click look-quit))

   ,   (look-attr-get <> <>). ,          : (look-attr-get 'my-label text)

 .  ,      .       text -   .         : 
(declare-keyword my-label)
    : (look-attr-get my-label text).
  ,     ,        .

(id 'from (label "from"))
(id 'to (label "to"))
(button "Copy text" (on-click (look-attr 'to text (look-attr-get 'from text))))

    .     .  :    ? .       ,            -     later.ģ           later.

(id 'lb (listbox (label "test1")
         (label "test2")
         current 0))
(id 'from (label "from"))
(button "lll" (on-click
(look-attr 'from text (look-attr-get 'lb current))))

            .          ,       "0".         .   look-attr-get  later.

(id 'lb (listbox (label "test1")
         (label "test2")
         current 0))
(id 'from (label "from"))
(button "lll" (on-click
(look-attr 'from text (later (look-attr-get 'lb current)))))

            listbox.     .

   ݣ     .      ,     -   ,       . ,  listbox,  current    ,          listbox   .    :
(listbox (label "test1") (label "test2") current 1)
  :
(listbox current 1 (label "test1") (label "test2"))
   current     1        ݣ   .

ݣ  .         .   . :
(label "text") -   
(label "text" pixmap "lll.png") -   .
    listbox (label "text" pixmap "lll.png")  Σ      .

           (on-click).      . ,  edit  textbox - on-change -     .
 listbox - on-select -      .
     on-error.         woo  hoo  .        reason.
      woo       ţ  (     /error/)       .
(id 'lbl (label "ok"))
(on-error (look-attr 'lbl text (global 'reason)))
(button "click me" (on-error '(/users 'action "read")))

            .     (look-send  ).   ,       on-click  .            .
(id 'b1 (button "b1" (on-click (look-send 'b2 'on-click))))
(id 'b2 (button "b2" (on-click look-quit)))

    ϣ ,   -  ,    declare-event.
:
(declare-event on-my-event)
(id 'some-id (button "123123" (on-my-event ... - ...)))
(button "123123" (on-click (look-send 'some-id 'on-my-event)))

,        ,               include. include                    .
     .         listbox.
--f1.scm--
(define (make-button a) (button a))
(listbox (label "t1") (label "t2"))
-----------
 ,  listbox   hbox    ̣     ݣ  :
(hbox (include "f1.scm")
      (make-button "t3"))

  .        layout,          ,         .      .   -    .     width  height.       .    sizepolicy  layout.   : fixed -       layout. expanding -         (       ).

 3.   .

1.  WOOBus.

         ALTerator      , ,    .       WOOBUS.      , WooBUS -      .       ,    ,        ,         . ,  ,   ,          . ӣ          .
        .     :
">>" - ң
"<<" - 
       ,    .     ,        ,      (">>"  "<<").       :
"vv" -    
"<>" -   ,  .
   ɣ  ,     ,  "vv" (-  ).      ,     "^^".
-ɣ ,      "^^"  .            .

      libalterator      ɣ-  WOOBus.

* std::string receive(std::istream& is, std::ostream& os, std::ostream& log);
    :
is -  ,  std::cin.
os -  ,  std::cout.
log -    ,  std::cerr.

* void send(const std::string& addr, const std::string& msg,                      
          std::istream& is, std::ostream& os, std::ostream& log);
  msg   addr, is,os,log -     ,    receive.


2.  .
    stdout,         ,   ɣ  stdin     .    .

  .  :
"<mark><text1>[:<text2>]",  "<mark>" ---   ,     , "<text1>"  "<text2>" --- .

    .

 "<text1>"  "<text2>"     :
 *  ":"     "$%",
 *  "$" ---  "$$",
 *  "\n" ---  "$n". 

,    ``"%"'' ---   .   "<text1>"
  ,  "<text2>" ݣ.

,    ``"+"'' ---     .        ,   .  "<text1>" ---  ,  "<text2>" ---  .

,    '#'     .         eof

:
/users/inger action=read type=local
 :
%/users/inger
+action:read
+type:local

:      ݣ   alterator 1.0   ,     scheme        s-.   ,      .

3.       

rpm-  backend'     :
alterator-backend-<>

backend     alterator'a:
 * /usr/lib/alterator/backend -   backend',    alterator'.
 * /var/cache/alterator - ,  backend'  - .
 * /etc/alterator/backends/ -            .



 A. Wizard.
~~~~~~~~~~~~~~~~~~~~~

       (wizard),      alterator (    Scheme).           "ң"  ""            .        alterator         stabdalone  (     ),       wizard.
        .

-,    ,   Σ    ( )  :  OK  Cancel,  Prev,Next.     -  ,      -   ,      . ,    ,       "Quit"      "Add user", "Delete User", "Edit User".

 ,           .
     :
*     :             (on-apply).
*      (   ).         (on-next),  ,        (,    )  -   (on-prev).
*     ,    (on-error), Wizard -       .
*          (Wizard    : "Prev"  "Next"),        . : (disable-next)  (disable-prev).         prev-button  next-button.

 standalone      (on-apply), (on-prev)  (on-next)   look-send.  ,         Quit   on-apply  
 :
(id 'subdialog
   (vbox (include "subdialog.scm")))
(button "Quit" (on-click 
                        (look-send 'subdialog 'on-apply)
			look-quit))

 alterator   doc/wizard      wizard.

