#! /bin/sh #---------------------------------------------------------------------------- # edit - ask user for edit # # usage: edit file # # return values: # 0 editor started # 1 editor not started # # Copyright (c) 2003 Frank Meyer # # Creation: 19.07.2003 fm # Last Update: 14.09.2003 fm # # 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. #---------------------------------------------------------------------------- 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 if /var/install/bin/ask "Continue" then cp $configfile /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 if ! /usr/local/bin/eischk -c /etc/config.d -x /etc/check.d -l /tmp/$baseconfigfile.log -p $baseconfigfile then if ! /var/install/bin/ask "Edit configuration again" then break fi else break fi else break fi done if diff /tmp/edit-$$ $configfile >/dev/null then mv /tmp/edit-$$ $configfile.backup else rm -f /tmp/edit-$$ fi exit 0 fi exit 1