Software DLMenu provides a simple way for system administrators to provide good-looking multi-level menus for program launching within a terminal. It uses the dialog program for producing the display, populating it with menu options specified in a simple configuration file.
The configuration file consists of a series of sections, each of which represents one menu screen. Sections are headed with a square-bracket-delimited menu names. When the program first starts, it will attempt to load the menu whose name is "MAIN". The contents of sections consists of a series of lines of one of two forms:
Whenever a menu option is chosen, DlMenu will first try to interpret the right-hand side of a configuration file entry as a menu name and display the relevant submenu; if this fails, it will treat the string as a command to execute. The configuration file may contain comment lines, which should begin with a #. In addition to menu options specified in the configuration file, each level of menu has a "cancel" option, which causes the previous menu up the hierarchy to be redisplayed; the "cancel" option on the top level menu presents a confirmation dialog and then exits. An example configuration file, with explanatory comments, is given below.
# /etc/dlmenu.conf - configuration file for DlMenu # First we define the "MAIN" menu. [MAIN] # Now we will add two menu entries, one of which will trigger vi, # and the other pico # The text to the left of each "=" will be displayed in the menu; # that to the right will be executed. The VI text editor = /bin/vi The Pico text editor = /usr/bin/pico # The entry below will not execute code, but will cause the "EMAIL" # menu to be displayed (Menu names do not have to be in capitals, # but it is a good convention). Submenu for Email activities = EMAIL # This, the final entry in the MAIN menu looks as though it should # display the "FILES" submenu. # However, as we have not defined a "FILES" menu in this configuration # file, DlMenu will instead attempt to execute a program in the # path called FILES if this option is chosen. Submenu for File Management activities = FILES # Now we define the EMAIL menu [EMAIL] Read mail with Pine = /usr/bin/pine Read mail with Mail = /bin/mail # end of configuration file
Note 1: DLMenu can be happily used as a login shell. However, it was not written with security particularly in mind. Anyone who wishes to run it in a security-critical environment should audit the code themselves. In particular, such a person may wish to replace the 'readConfig()' method with one that subjects the configuration file to more rigorous checks.
Note 2: There are three paths hard-wired into the code: the path to the dialog executable (/usr/bin/dialog), the path to the DlMenu configuration file (dlmenu.conf) and a menu title (--- Menu System ---). In order to change these, edit the "CONFIGURATION" section of the source file, as indicated within the sourcefile itself.
DLMenu is released under the terms of the GNU General Public Licence Version 2.