#! /bin/sh #---------------------------------------------------------------------------- # /var/install/bin/show-menu - show menu # # Copyright (c) 2001-2004 Frank Meyer # # Creation: 04.11.2001 fm # Last Update: $Id$ # # 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. #---------------------------------------------------------------------------- menu_file="$1" url= read_menu_file() { n=0 while read line do if [ $n -eq 0 ] then title="$line" else if [ "$line" = '$URL' ] then url=`cat /var/install/url` n=`expr $n - 1` elif [ "$line" = '$VERSION' ] then version=`cat /etc/version` eiskernel=`grep "" /var/install/packages/eiskernel 2>/dev/null | sed 's###g'` kernel=`uname -r` n=`expr $n - 1` else set -- $line command="$1" shift comment="$*" eval comment_$n='"$comment"' eval command_$n='"$command"' fi fi n=`expr $n + 1` done < $menu_file n=`expr $n - 1` } while [ 1 ] do clrhome read_menu_file colecho "$title" gn if [ "$url" != "" ] then url=`cat /var/install/url` echo "URL: $url" elif [ "$version" != "" ] then echo "base: $version eiskernel: $eiskernel ($kernel)" else echo fi if [ $n -ge 10 ] then lines_used=`expr $n + 1` else lines_used=`expr $n '*' 2 + 2` fi blank_lines=`expr 22 - $lines_used` blank_lines=`expr $blank_lines / 2` i=1 while [ $i -le $blank_lines ] do echo i=`expr $i + 1` done i=1 while [ $i -le $n ] do eval command='$command_'$i eval comment='$comment_'$i if [ $i -lt 10 ] then echo " $i: $comment" else echo " $i: $comment" fi if [ $n -lt 10 ] then echo fi shift i=`expr $i + 1` done echo " 0: Exit" i=1 while [ $i -le $blank_lines ] do echo i=`expr $i + 1` done echo -e "Command (1-$n, ENTER=Return 0=Exit) \c" read a if [ "$a" = 0 ] then exit 127 fi if [ "$a" = "" ] then break fi if [ "$a" != "" -a $a -ge 1 -a $a -le $n ] then eval command='$command_'$a sh $command case $? in 127) exit 127;; 0) ;; *) /var/install/bin/anykey;; esac fi done exit 0