UCO command welcome page


The uco command is a front end to sub-commands which are meant to help users to reset or tune some of their UNIX user environment.

It stands for User COmpagon or can be seen as the User Consulting Office command.

Users can reset their Home directory structure, their shell configuration files, their X11 configuration files, etc.

You can access the following areas in this page:

Background - Proposal - Technical details - User - System administrator - References


Background - Why the need for such a command?

Preferences files on UNIX systems

In a well managed computing center, system managers should configure machines and services with a proper default. This default should suit 90% of users needs. However, it is clear that some users may want to customise their environment. Therefore they need a place where to encode their preferences.

In UNIX systems users preferences are stored in the file system of their HOME directory. Usually each application, program or system allows users to encode their preferences in a file which name is prepended by a dot, like

	.tcshrc
is the file which should be customised for the environment behaviour of the Tenex C-Shell (tcsh) shell. As the command in UNIX to list files (ls) in a directory doesn't display files which names start with a dot, then you shouldn't see these files. To list them, simply enter:
	ls -a 
just after you logged in. You may read a long list.

Problems with users setting up their preferences files

When users get their account, it should be already prepared for them to work. However, as users may have got an account somewhere else, they may want to use the same environment as before. They try to get back their old interface by just copying few files which, they believe, should give them back this previous interface.

Unfortunately, usually, they don't take care that

Another issue is when a user wants to customise his environment and make a mistake. The consequences are:

Therefore they need a way to reset their environment to a reference level with which they can work.

Problems for system and group administrators to build and give access to a reference level

System administrators (who are setting up services and machines) as well as group administrors (who are setting up environment for their users) may wan to build commands which give the possibility to their users to get access to a reference environment which is guarantied to work.

As shown with the HEPiX project, there are many kinds of system managers and proposing a federal approach to takle the problem is fruitful.

Indeed, you may want to setup a reference level for a site and have additional entry points to give access to group or local environment which are 'specializing' the user environment.


Proposal for the UCO command

The UCO command is a front end command which offers menus and give access to sub-commands which are going to actually do the job and perform the operations.

It should be able to scan a configuration PATH where to find the resources menus, it should load this menus and could display some of them on request.

Anybody who has the write permission in one segment of the UCO PATH can add or modify a menu file which is going to add or overwrite some items, menus to the whole set of menus. He should add as well the commands or give a proper access to the commands to be used by user.

A library of function could be used by system administrators in order to minimize the development costs and to inherit some centrally managed data.

Then for each choice it should perform the proper action, i.e.

The implementation is done using perl 5.002 with many of its modules.


Technical details

What does the uco command perform?

The uco command scans the uco PATH in order to find all the resources it needs and in particular the menus to be loaded.

The uco PATH can be specified in 3 ways:

Once the resources are found, uco is loading all of the menus discovered in this search PATH and it is ready to display them. A menu is a file with the extension .menu. In each segment of the uco PATH, menus are loaded in the alphabetical order. The "latest" can overwrite the previous menu files (their format is described later on).

There are several predefined areas which can be called directly using options on the command line. If no such area is specified, uco is using the always present 'Main' menu.

Thus, being 'Main' or another specified area, uco displays the corresponding menu and then listens for users to enter his choice. Once it is entered uco performs the actions and exits.

uco can understand several kind of actions as described later which gives users to go from one menu to another one, to execute all sorts of external commands as well as functions defined into the library.

Menus and Actions are described in the next sections.

The menu format

A file with the extension .menu can describe several menus. Menus are represented with a description language close to the one used to build fvwm menus.

The usual attributes of a menu are:

An item can be:

The syntax is described below:

   menu ::=
     Comment
     Menu "Title" [Type]
	List_of_Items
     EndMenu

   List_of_Items ::=
	Item [Flag] "Label"   "Action" || Nop "Text" || Apply "Action"

   Comment ::= #

   Type    ::= Select || Select-Numeric
   Flag    ::= Overwrite
   Action  ::= exec Command-name || func Function-name || menu Menu-name

   Text    ::= List of strings
   Label   ::= List of strings
   Title   ::= List of strings
For an example, the following menu description:
Menu "X11"
        Nop  "X11's possible actions:"
        Item "Cancel"
             "func &Cancel"
        Item "Reset your X11 configuration files." 
             "exec uco-x11 -R -v"
        Item "Fake the Xsession." 
             "exec uco-x11 -f -v"
        Item "Restore the X11 configuration from a previous version." 
             "exec uco-x11 -r -v"
        Item "Clean the X11 trailing configuration files." 
             "exec uco-x11 -c -v"
        Item "FVWM template files." 
             "menu Fvwm"
EndMenu
will display:

 X11's possible actions:
 1   - Cancel
 2   - Reset your X11 configuration files.
 3   - Fake the Xsession.
 4   - Restore the X11 configuration from a previous version.
 5   - Clean the X11 trailing configuration files.
 6   - FVWM template files.
Choice: 
and will wait for user input.

If the user enter 1, then uco will evaluate that it should call a perl function named Cancel from its library (the token func).

If the user enters 2 to 5, then uco will evaluate that it should execute an external sub-command named uco-X11 with the proper option (the token exec).

If the user enters 6, then uco evaluates that it should display another menu named Fvwm (the token menu).

What are the uco sub-commands?

Of course uco itself is not enough to perfrom the work as it is 'just' able to read data menu files.

The work is done by uco sub-commands which are perl5 specialised commands.

Each of them can do specific things to an area. There are currently 7 area defined but a system manager is free to define is own command (for physics applications, engineering, etc.):

For more explanation click on them and you will get a complete documentation.

Each of these commands can have an arbitrary name but for more standardisation, there are some conventions:


What the user can do?

The user can enter:

	uco 
which will display the main menu:
 Uco Main Menu:
 1   - Setting your shell environment
 2   - Setting your X11 (graphical) environment
 3   - Setting your HOME directory
 4   - Setting your Mail configuration
 5   - Checking that basic Security is enabled
 6   - Looking at your Environment variables
Choice: 
or
	uco -h
which will provide the help
This command is setting or resetting the user template files
in his home directory.

  uco [-v|-n|-h] [Area]
   
          
    Area:       
    -----
    -X11               : the X11 environment.
    -shell             : the shell (.cshrc, etc.).
    -security          : the security (.rhosts).
    -mail              : the mail agents, etc. (.forward).
    -home              : the structure of the HOME directory (.@sys, etc.)
    -keyboard          : the keyboard environment.
    -environment       : the environment variables.
     
    -v                 : the verbose mode.
    -n                 : the fake mode.
    -h                 : the help.

If you want to enter the menu of one area:
	uco -X11
which will display:

 X11's possible actions:
 1   - Cancel
 2   - Reset your X11 configuration files.
 3   - Fake the Xsession.
 4   - Restore the X11 configuration from a previous version.
 5   - Clean the X11 trailing configuration files.
 6   - FVWM template files.
Choice: 
and so on.

What system and group administrators can do?

The following is an example of what can be done. It defines 3 menus, Main, X11 and Fvwm. Main is a menu which is going to display items. When the user will choose one it will display

Menu "Main"
        Nop "Uco Main Menu:"
        Item "Setting your shell environment"
             "menu Shells"
        Item "Setting your X11 (graphical) environment"
             "menu X11"
        Item "Setting your HOME directory"
             "menu Home"
        Item "Setting your Mail configuration"
             "menu Mail"
        Item "Checking that basic Security is enabled"
             "menu Security"
        Item "Looking at your Environment variables"
             "menu Environment"
EndMenu

Menu "X11"
        Nop  "X11's possible actions:"
        Item "Cancel"
             "func &Cancel"
        Item "Reset your X11 configuration files." 
             "exec uco-x11 -R -v"
        Item "Fake the Xsession." 
             "exec uco-x11 -f -v"
        Item "Restore the X11 configuration from a previous version." 
             "exec uco-x11 -r -v"
        Item "Clean the X11 trailing configuration files." 
             "exec uco-x11 -c -v"
        Item "FVWM template files." 
             "menu Fvwm"
EndMenu

Menu "Fvwm" Select-Numeric
        Nop  "FVWM template files you can retrieve"
        Item "Cancel"
             "menu X11"
        Item "User menu                             (fvwm_menu)"
        Item "Popup menus                           (fvwm_popup)"
        Item "Number of desktops                    (fvwm_startup)"
        Item "Focus, autoraise, etc                 (fvwm_configuration)"
        Item "Desktop size/scrolling                (fvwm_desk)"
        Item "Window frame colours                  (fvwm_colours)"
        Item "Pager colours                         (fvwm_modules)"
        Item "Icons, styles and decorations         (fvwm_style)"
        Item "Button and key bindings               (fvwm_bindings)"
        Item "Functions                             (fvwm_functions)"
        Item "Paths                                 (fvwm_path)"
        Nop "Your choice can be a comma separated list. For example you can"
        Nop "enter: 2,3,4. If you enter only 1, you will get the previous menu"
        Apply "exec uco-x11 -w [Params] -v"
EndMenu

Menu "Main"
        Nop "Uco Main Menu:"
        Item "Setting your shell environment"
             "menu Shells"
        Item "Setting your X11 (graphical) environment"
             "menu X11"
        Item "Setting your HOME directory"
             "menu Home"
        Item "Setting your Mail configuration"
             "menu Mail"
        Item "Checking that basic Security is enabled"
             "menu Security"
        Item "Looking at your Environment variables"
             "menu Environment"
EndMenu

Documentation you may want to access


Arnaud Taddei