On Fri, 2011-01-14 at 14:28 -0800, Vagrant Cascadian wrote:
> On Fri, Jan 07, 2011 at 09:49:49AM +1100, Peter Howard wrote:
> > On Tue, 2011-01-04 at 14:44 -0800, Vagrant Cascadian wrote:
> 
> > > zoneminder could detect non-default/unknown symlink
> > > locations in the preinst script, and fail to upgrade in those cases; not
> > > pretty, but maybe better than loosing the database data.
> > 
> > In the short term, I don't think there's a neater solution than that.  I
> > think we should go with the "bail out update with warning" approach.
> 
> here's a preinst which i think should accomplish this safely:
> 
> 
> #!/bin/sh
> 
> set -e
> 
> abort=false
> if [ -L /usr/share/zoneminder/events ]; then
>     l=$(readlink /usr/share/zoneminder/events)
>     if [ "$l" != "/var/cache/zoneminder/events" ]; then
>         abort=true
>     fi
> fi
> if [ -L /usr/share/zoneminder/images ]; then
>     l=$(readlink /usr/share/zoneminder/images )
>     if [ "$l" != "/var/cache/zoneminder/images" ]; then
>         abort=true
>     fi
> fi
> 
> if [ "$abort" = "true" ]; then
>     cat >&2 << EOF 
> Aborting installation of zoneminder due to non-default symlinks in
> /usr/share/zoneminder for the images and/or events directory, which could
> result in loss of data. Please move your data in each of these directories to
> /var/cache/zoneminder before installing zoneminder from the package.
> EOF
>     exit 1
> 
> fi
> 
> #DEBHELPER#
> 
> exit 0
> 
> 
> though the warning could use some improvement.
> 
> looking at the fast approaching squeeze release, and the possibility of
> data-loss for people switching from manual/source installs to the package, i
> think it might be worth including this now.  long-term, something more
> sophisticated and intelligent will definitely be needed.

One possible addition.  Even though it wasn't part of the problem for
this bug, what about checking that /usr/share/zoneminder itself is a
directory.  I could imagine someone putting a link at that level as
well.

Also, the warning could add reference
to /usr/share/doc/zoneminder/README.Debian - I'll add the "alternate
mount" instructions with additional explanation to that file.

-- 
Peter Howard <p...@coastal.net.au>




-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to