.TH grml-quickconfig 8 .SH "NAME" grml-quickconfig \- get fast access to some basic grml-scripts .SH SYNOPSIS .B grml-quickconfig [menudir] .SH DESCRIPTION This manual page documents briefly the .B grml-quickconfig command. .SH OPTIONS .TP .B menudir Directory to load the menu files from. Menu files have to end in *.sh. If menudir is a directory files will be directly loaded from specified directory. If it is not a directory it will be loaded from .B /usr/share/grml-quickconfig/MENUDIR/ (if exists) If no option is provided the bootparameter .B menu is used as directory .SH NOTES grml-quickconfig provides a console based interface to get fast access to some basic grml-scripts like for example grml-network, netcardconfig, grml-lang, grml-x and grml2hd. .SH USAGE EXAMPLES .TP .B grml-quickconfig Invoke the interface. .TP .B grml-quickconfig /opt/my_menu/ Invoke the interface and load all files ending in *.sh .TP .B grml-quickconfig network Test if dir is a directory and load all files edning in *.sh from it. If dir is not a valid directory .B /usr/share/grml-quickconfig/network/ is used. .SH Writing own menu entries A menu script is a shell script with some necessary informations described in this section. .SS API Following predefined functions are available to write a script displaying a menu entry: .TP .B print_line text Print the text in one line inside the menu. Shell .TP .B print_starting_line Print the first line for a menu .TP .B print_closing_line Print the closing line for a menu .TP .B print_delim Print a delimiter line for a menu .TP .B run COMMAND Print command before executing it .TP .B get_key VARIABLE_NAME Get one key from user .TP .B Example # get user input get_key INPUT [ "$INPUT" == "c" ] && echo "C pressed" # print && execute grml-lang de run grml-lang de .SS Predefined Variables Following variables are predefined and could be used in a menu script: .TP .B NORMAL Switch back to normal color .TP .B HILIGHT Shall be used to hilight the used key for a menu .TP .B Example print_line "Configure ${HILIGHT}n${NORMAL}etwork" .SS MUST Provide .TP .B display_entry A function named display_entry to determine if this entry shall be displayed. .LP .RS .B Example .LP # Always display menu item display_entry() { return 0 } # Only display menu item if specified program is available display_entry() { . /etc/grml/script-functions check4progs PROGRAM >/dev/null return $? } .RE 1 .TP .B LINE A variable used to determine what shall be done to generate a menu entry. Typically used in combination with print_line. Only used if display_entry returns 0. .LP .RS .B \ Example # print Configure network (grml-network) LINE='print_line "Configure ${HILIGHT}n${NORMAL}etwork (${HILIGHT_NAME}grml-network${NORMAL})"' .RE 1 .SS Optional entries Following variables are optional and can be defined in a script but must not. .TP .B FUNCTION A variable specifing the code which shall be executed if user selects this menu entry. The variable $INPUT can be used to get the user input. .RS .B \ Example # Print the key from the user FUNCTION='echo $INPUT' # create a submenu submenu() { ... } FUNCTION='submenu' .RE 1 .TP .B KEY, array An array containig all possible keys for executing the code specified in the FUNCTION variable, e.g: .RS # execute code in FUNCTION if c, d or e is pressed. KEY=(c d e) .SS Complete Example # language module for grml-quickconfig LINE='print_line "Set keyboard layout (${HILIGHT_NAME}grml-lang${NORMAL}): \\ ${HILIGHT}d${NORMAL}e ${HILIGHT}a${NORMAL}t ${HILIGHT}c${NORMAL}h e${HILIGHT}s${NORMAL} ${HILIGHT}u${NORMAL}s"' typeset -A lang_mapping # map keys to language lang_mapping=( d de a at c ch s es u us ) # get all keys from assoc array KEY=(${(k)lang_mapping}) # $INPUT is the user input FUNCTION='run grml-lang ${lang_mapping[$INPUT]}' # always display entry display_entry() { return 0 } ## END OF FILE ################################################################# # vim:foldmethod=marker expandtab ai ft=zsh shiftwidth=3 .SH AUTHOR Current grml-quickconfig was written by the Grml Team and is based on the idea of Michael Schierl. The originaly grml-quickconfig was written by Michael Schierl . .PP This manual page was written by Michael Prokop for the grml project (but may be used by others).