#---------------------------------------------------------------------------- # /var/install/include/check-eisfair-version - check installed version # # Creation : 2007-12-18 hbfl # Last Update: $Id$ # # Copyright (c) 2001-2008 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. #---------------------------------------------------------------------------- #---------------------------------------------------------------------------- # select system version #---------------------------------------------------------------------------- # list systems to select systems="eisfair-1 eisfair-2 eisxen-1" etc_system_file=/etc/eisfair-system check_system () { clrhome # display systems to select on tty mecho -info "Can't detect the system type," mecho -info "please select one first." techo begin 6r 32* echo echo _idx=1 echo "${systems}" | while read line do techo row "${_idx}." "${line}" _idx=`expr ${_idx} + 1` done echo echo techo end system_to_work=`/var/install/bin/ask "Select" "${system_to_work}" "1-$(echo "${systems}" | wc -l)" "^$=Return" "0=Exit"` case ${system_to_work} in '') exit 0 ;; 0) exit 127 ;; *) # set working system system_work="`echo "$systems" | sed -n "${system_to_work}p" | sed 's/^ *//'`" # write ${etc_system_file} echo "${system_work}" >${etc_system_file} EISFAIR_SYSTEM=${system_work} # export EISFAIR_SYSTEM to check it once export EISFAIR_SYSTEM ;; esac } # check ${etc_system_file} exists if [ ! -f ${etc_system_file} ] then # if not exists check_system else # if exists, read entry system_work="`cat ${etc_system_file} | sed 's/^ *//'`" # check if ${etc_system_file} entry broken if `echo "${systems}" | grep -q "${system_work}$"` then # if not broken EISFAIR_SYSTEM="${system_work}" # export EISFAIR_SYSTEM to check it once export EISFAIR_SYSTEM else # if broken check_system fi fi #---------------------------------------------------------------------------- # end #----------------------------------------------------------------------------