#! /bin/sh #---------------------------------------------------------------------------- # /var/install/bin/system-base-set-menu-style - set menu style # # Creation: 2005-08-06 dv # Last Update: $Id$ # # Copyright (c) 2001-2011 the eisfair team, team(at)eisfair(dot)org # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #---------------------------------------------------------------------------- # include eislib . /var/install/include/eislib # --------------------------------------------------------------------------- # main # --------------------------------------------------------------------------- # set page titel clrhome mecho --info "Set eisfair menu style" echo echo # set menu style:executable menu_style="Classic text style:/var/install/bin/show-menu Curses style:/var/install/bin/show-menu.cui" # get current menu executable current_menu_exec=`grep "^MENU=" /etc/config.d/setup | sed "s#^MENU=['\"]##; s/['\"].*$//"` # show current menu style echo -n "Current eisfair menu style: " # get the display name from current menu executable echo "${menu_style}" | while read line do _menu_exec=`echo ${line} | awk -F: '{ print $2 }'` if [ "${_menu_exec}" = "${current_menu_exec}" ] then _style=`echo ${line} | awk -F: '{ print $1 }'` mecho --info "${_style}" else continue fi done # show available menu styles techo --begin '6r 32*' echo echo _idx=1 echo "${menu_style}" | while read line do _style=`echo ${line} | awk -F: '{ print $1 }'` techo --row "${_idx}." "${_style}" _idx=`expr ${_idx} + 1` done echo echo techo --end _ask_tmpfile=$(mktemp -t XXXXXXXXXXXXX) /var/install/bin/ask "Select" "" "1-`echo "${menu_style}" | wc -l`" "^$=Return" "0=Exit" >${_ask_tmpfile} rc=${?} style_to_work=`cat ${_ask_tmpfile}` rm -f ${_ask_tmpfile} if [ ${rc} = 255 ] then style_to_work=0 fi case "${style_to_work}" in "") exit 0 ;; 0) exit 127 ;; *) # get the line from '$menu_style' and display '$2' selected_menu=`echo "${menu_style}" | awk -F: 'FNR == '${style_to_work}' { print $2 }'` if [ "${selected_menu}" != "${current_menu_exec}" ] then # write in config file sed -i "s#^MENU=['\"].*['\"]#MENU='${selected_menu}'#" /etc/config.d/setup echo mecho --info -n "You need to " mecho -n "Exit " mecho --info "from the currently running" mecho --info "menu to make the changes take effect." echo _ask_tmpfile=$(mktemp -t XXXXXXXXXXXXX) /var/install/bin/ask "Select" "" "^$=Return" "0=Exit" >${_ask_tmpfile} rc=${?} _my_answer=`cat ${_ask_tmpfile}` rm -f ${_ask_tmpfile} if [ ${rc} = 255 ] then _my_answer=0 fi case ${_my_answer} in '') exit 0 ;; 0) exit 127 ;; esac fi ;; esac exit 0 # --------------------------------------------------------------------------- # end #----------------------------------------------------------------------------