Coda File System

Re: Missing codaconfedit program for installation

From: Jan Harkes <jaharkes_at_cs.cmu.edu>
Date: Tue, 6 Mar 2001 12:07:16 -0500
On Mon, Mar 05, 2001 at 11:05:56PM +0100, Sangohn Christian wrote:
> Hello al!
> 
> I need the program codaconfedit for my Debian system to complete the 
> installation of coda-client but it?s missing in the package.
> Can somone please send it to me?
> 
> TIA

Argh, it went into the server package, and there will be an install
conflict between the coda-server and coda-client packages when I add it
to both. Does anyone know a solution without creating yet another
package (something like coda-common, containing only codaconfedit)?

In any case, here it is.

Jan

============================= codaconfedit ========================
#!/bin/sh
#
# codaconfedit, edits Coda configuration files.
#
# arguments: <configuration file> <variable> <newvalue>
#
# It looks for the configuration file specified by the user as is, and
# by prepending the path of the coda configuration directory (/etc/coda,
# /usr/pkg/etc/coda, /usr/local/etc/coda, depending on where Coda was
# installed). If the variable already has the new value, nothing is
# modified. Otherwise any existing entries are commented out and the new
# entry is appended right behind the last existing previous entry (or at
# the end of the configuration file if the variable didn't exist before.
#

set -e

prefix="/usr"

if [ $# != 3 ] ; then
    echo "Usage: $0 <conffile> <variable> <newvalue>"
    exit 1
fi

conffile="$1"
variable="$2"
newvalue="$3"

for cpath in "" /etc/coda/ ; do
    if [ -f "$cpath$conffile" ] ; then
	break
    fi
    if [ -f "$cpath$conffile.ex" ] ; then
	/bin/cp "$cpath$conffile.ex" "$cpath$conffile"
	break
    fi
done

if [ ! -f "$cpath$conffile" ] ; then
    echo "Couldn't find $conffile"
    exit 1
fi

if `/bin/grep -q "^$variable=\"\?$newvalue\"\?$" $cpath$conffile` ; then
    exit 0
fi

# Use ed to comment all previous declarations of the variable,
# and append the new value.
/bin/ed -s $cpath$conffile << EOF
g/^#*${variable}=/s/^#*/#/
a
${variable}="${newvalue}"
.
w
EOF
Received on 2001-03-06 12:07:54