[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: moving a config file



On Mon, Oct 21, 2002 at 05:13:54PM +0200, Martin Godisch wrote:
> On Mon, Oct 21, 2002 at 16:41:01 +0200, Oliver Kurth wrote:
> 
> > #!/bin/sh -e
> > 
> > ##$DEBIAN_SCRIPT_DEBUG || set -v -x 
> > 
> > if [ "$1" = "upgrade" ] ; then
> >   if dpkg --compare-versions "$2" lt "0.1.6-1" ; then
> > 
> >     # move config file to new location
> >     if [ -e /etc/masqmail.conf ]; then
> >         if [ ! -d /etc/masqmail ]; then
> >             mkdir /etc/masqmail
> >             mv -f /etc/masqmail.conf /etc/masqmail/
> >         fi
> >     fi
> >   fi
> > fi
> 
> Is it idempotent? This may be a theoretical example, but consider CTRL+C
> after the mkdir line, the mv will never happen then. Also '-f' shouldn't
> be needed since /etc/masqmail should be empty.

Yes, you are right. I should test for the existence of the conf file in
the directory, and move only if it does not exist.

It is pretty academic though... this version 0.1.6 is _really_ old, I 
think pre potato.

Thanks for the hint :-).

Mermgfurt,
Oliver
-- 
debian/rules                                       http://zork.net/~nick/srom/

Attachment: pgpRCbzqgzh5m.pgp
Description: PGP signature


Reply to: