[Nut-upsdev] Re: About blazer, powermust and mustek

Peter Selinger selinger at mathstat.dal.ca
Mon Oct 24 16:00:18 UTC 2005

Arnaud Quette wrote:
> 2005/10/23, Peter Selinger <selinger at mathstat.dal.ca>:
> >
> > ...
> > I am a great fan of backwards compatibility. Especially if you batch
> > update a lot of packages, it is a pain to have to track down
> > documentation for unexplained broken behaviors.
> >
> > I think we should do the same when we rename the "newhidups" driver.
> so do I.
> The driver name change is a long standing point, and more and more annoying
> me in my Debs. And we'll once again reach a high level of driver names
> change with 2.2, that point is sure!
> I'm currently more inclined at making some helper script that will replace
> the driver name in your conf (obviously making a backup of the orig files).
> This one would be called by the user at source install time, or by the
> package (preferably after having informed the user).
> The symlink and the stub doesn't solve the problem, but only annoy the user
> (if this one sees the message!). So let's go directly to a solution...
> Any perl (or other well supported scripting) monger out there to take over
> that one?

Great idea. How about bash/sh? Still the most universally available
scripting language. I am including a script below that is called as 

 updateconf.sh <configfile> <olddriver> <newdriver>

It does the trick nicely. It would have to be integrated into the
install process.


# command line

if [ $# -ne 3 ]; then
	echo "$0: wrong number of arguments." >&2
	echo "Usage: $0 <configfile> <olddriver> <newdriver>" >&2
	exit 1


# Note: new driver must be backwards compatible with old driver, i.e.,
# must accept the same config options


cp -p "$UPSCONF" "$BACKUP"
cat "$BACKUP" | sed -e 's/^\([ \t]*driver[ \t]*=[ \t]*\)'"$OLDDRIVER"'[ \t]*$/\1'"$NEWDRIVER"'/' > $UPSCONF

More information about the Nut-upsdev mailing list