Ideas about structure....

# executed in order
000 init-environment
010 deadsimplecorrections
020 lesssimplecorrections
030 sysmans
040 licensed-software
090 support ticket if not yum?
# not executed, but sourced
support-ticket
searchyum
searchpkgsearch

Where for 'any user' below we probably don't mean root...

1.  Any user on gateway machine
    - dead-simple corrections (optional?)
    $ emasc
    emacs

    - common misspelling? suggest correction

    $ sl
    'sl' not found: did you mean 'ls'?
    $ les
    'les' not found: did you mean 'less'?

    $ matlab
    

    - software we normally carry? advise why it's missing
    $ matlab
    'matlab' is not installed on this machine as it is a GATEWAY YOU FOOL

    $ rhdfkjghdfkgl
    

    - missing due to lack of $DISPLAY (in /usr/X11/bin?)

    $ xeyes
    You need X, DISPLAY, etc.

    - fail as usual(?)
    $ rhdfkjghdfkgl
    bash: rhdfkjghdfkgl: command not found
   

2.  Any user on staff/pgr ("allocated", "personal") desktop

    - licensed software?

    $ webots
    you / this machine do / does not have a licence for 'webots'
    machine: please use another machine?
    you: student: go away?
    you: staff: 

    - available, but uninstalled software 
    $ xeyes 
    'xeyes' is available in  but not installed. 
    if you'd like to request this please run:
        ~/get-me-xeyes-please
    and a support ticket will be created for you.
    Please see computing.help/requested-software for details


3.  Any user on student lab desktop

    - webots without appropriate driver

    $ webots
    this machine has terrible hardware.  use another.
    
    - available, but uninstalled software 
    


4.  Any user on compute server


5.  Any user on server


6.  Sysmans on any machine (ordering tbc)

    - did you mean /sbin/ ?

Use cases, attempt II:

All Machines

  • 010.puntIfRoot (incorporates 'classic')
  • 020 shellguards (don't run in pipe, subshell, etc.)
  • 100 because
  • 200 sbin | sysmans
  • 210 shouldbethere
  • 400 inform user about pkgsearch? [return 1]
  • 410 misspellings
  • ...?
  • 900.classic

plus

Multi-User Machines

  • 500 pkgsearch

Gateway Machines

  • 100 because [maybe for submit or other 'panic' commands?]
  • 500 baduser

Staff / PhD (Desktops)

  • 100 because [webots on specific hardware]
  • 45x user-filters on licensed software?
  • 500 pkgsearch

Lab Machines

  • 100 because [webots on specific hardware]
  • 500 pkgsearch (altered text)

Chris' Machine

  • 001 family fortunes [return 1]

Original Spec

now moved to modules/README.

A "Command Not Found" module:
  • should be named NNN<name>
  • accepts arguments containing the unavailable command (verbatim) as $*
  • (appears to) receive the entire user environment
  • can be written in any sensible language that doesn't behave badly.

It must:

  • return 0 on successful match - this ends the chain
  • return non-zero if the argument (or environment) does not match
  • write any information to share with core / other modules to stdout
    • format TBC - reconvene if we need to do this?
  • convey all information to the user via stderr

Simplest valid example:

#!/bin/sh
# does nothing; falls through
exit 1

"Classic" behaviour module:

#!/bin/sh
echo "bash: $0: command not found" >&1
exit 0 # not mandatory (but recommended)

References:

http://www.linuxjournal.com/content/bash-command-not-found

Topic revision: r5 - 28 Feb 2013 - 11:29:31 - GrahamDutton
 
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback
This Wiki uses Cookies