2 # Filename: grml-quickconfig
3 # Purpose: get fast access to some basic grml-scripts
4 # Authors: Grml Team <team@grml.org>
5 # Bug-Reports: see http://grml.org/bugs/
6 # License: This file is licensed under the GPL v2.
7 ################################################################################
11 . /etc/grml/script-functions
12 if ! checkbootparam 'nocolor'; then
20 # switch between character sets
29 VLINE=$(repeat $MAXLEN echo -n q)
31 HIGHLIGHT_NAME="$MAGENTA"
32 SCRIPTDIR="/usr/share/grml-quickconfig/"
35 # enable alternate console fonts
43 # helper functions {{{
46 ORIG_LEN=$(echo $(printf '%s' "$1" | sed "s#${esc}\[[0-9;]*m##g" | wc -c))
47 echo -n "${BLUE}$HLINE${NORMAL}"
49 printf "%$[${MAXLEN}-${ORIG_LEN}-2]s${BLUE}${HLINE}${NORMAL}\n"
52 print_starting_line() {
53 echo $B ${BLUE}l"$VLINE"k${NORMAL} $N
56 print_closing_line() {
57 echo $B ${BLUE}m"$VLINE"j${NORMAL} $N
61 echo $B ${BLUE}t"$VLINE"u${NORMAL} $N
65 echo $1 | sed -e "s/$2/$HIGHLIGHT$2$NORMAL/"
77 echo Running Command $*
83 stty -echo ; read -kq ${1}?"Press a key: "
87 [ -n "$1" ] && RC=$1 || RC=0
88 [ -n "$2" ] && print "$2" >&2
93 trap bailout 1 2 3 3 6 9 14 15
95 # check boot parameter {{{
98 if [ -d "./$TARGET" ] ; then
100 elif [ -d "$SCRIPTDIR/$TARGET" ] ; then
101 MENUDIR="$SCRIPTDIR/$TARGET"
104 BOOT_PARAM=$(getbootparam menu) || true
105 if [ -n "$TARGET" ] ; then
106 get_menu_dir "$BOOT_PARAM"
108 if [ -n "$1" ] ; then
112 if [ -z "$MENUDIR" ] ; then
119 if ! ls "$MENUDIR"/*.sh &>/dev/null ; then
120 bailout 1 "Error: $MENUDIR is empty, exiting."
122 ls ${MENUDIR}/*.sh &>/dev/null || exit 1
123 for file in ${MENUDIR}/*.sh ; do
129 if display_entry ; then
131 if [ -n "$LINE" ] ; then
132 info+="$(eval $LINE)"
144 if [ -z "$info" ] ; then
160 eval ${keymap[$INPUT]}
173 ## END OF FILE #################################################################
174 # vim:foldmethod=marker expandtab ai ft=zsh shiftwidth=3