#! /bin/sh #---------------------------------------------------------------------------- # edit - ask user for edit # # usage: edit file # # return values: # 0 editor started # 1 editor not started # # Copyright (c) 2003-2004 Frank Meyer # # Creation: 19.07.2003 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. #---------------------------------------------------------------------------- # include function library . /var/install/bin/config_shlib configfile=$1 baseconfigfile=`basename $configfile` editor=$EDITOR if [ "$editor" = "" ] then editor=joe fi basename=`basename $editor` echo echo echo "Since there is no EIS/FAIR configuration tool, you must edit" echo "the EIS/FAIR configuration file $configfile with" echo "the editor $editor." echo param="" if [ "$basename" = "joe" ] then echo "You can get help by joe if you press 'Ctrl-K H'." echo param="-nobackups" elif [ "$basename" = "vi" -o "$basename" = "vim" ] then echo "You can get help by vi/vim if you enter ':help'." echo fi exitval=0 if /var/install/bin/ask "Continue" then cp -p $configfile /tmp/edit-$$ chmod og-rw /tmp/edit-$$ while [ 1 ] do $editor $param $configfile if [ -f /usr/local/bin/eischk -a -f /etc/check.d/$baseconfigfile ] then colecho "Checking configuration file ..." br b br echo /usr/local/bin/eischk \ -c /etc/config.d \ -x /etc/check.d \ -l /tmp/$baseconfigfile.log \ -p $baseconfigfile eischkretval=$? if [ -f /tmp/$baseconfigfile.log ] then chmod og-r /tmp/$baseconfigfile.log fi if [ "$eischkretval" != "0" ] then if ! /var/install/bin/ask "Edit configuration again" then exitval=1 break fi else break fi else break fi done if ! diff /tmp/edit-$$ $configfile >/dev/null then #mv /tmp/edit-$$ $configfile.backup backup_config $baseconfigfile /tmp/edit-$$ rm -f /tmp/edit-$$ else rm -f /tmp/edit-$$ fi rm -f /tmp/$baseconfigfile.log exit $exitval fi exit 1