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

Re: Sorting out the xdvi.bin problem



On Wed, Jul 18, 2001 at 02:02:12PM +0200, Adrian Bunk wrote:
> > > I think this solution is really the best one. We can keep
> > > update-alternatives. The only drawback is that someone might have
> > > switched to manual mode on purpose and this would change it back.
> >
> > That's why the test for the *presence* of xdvi.bin; this would still
> > be a problem even if they had changed to manual.
> 
> It checks for the existance of xdvi.bin - but you gain nothing when it's a
> dangling symlink.
> 
> My solution is to check whether it does currently point to anything in
> /usr/X11R6/bin and if yes switch to auto mode:
> 
> # remove the manual setting of the xdvi alternatives when
> # they point to the obsolete location in /usr/X11R6/bin
> update-alternatives --display xdvi.bin | grep "points to" | \
>   grep X11R6 >/dev/null && update-alternatives --auto xdvi.bin  || true
> update-alternatives --display oxdvi.bin | grep "points to" | \
>   grep X11R6 >/dev/null &&  update-alternatives --auto oxdvi.bin || true

Not quite.  You just need to test whether it's dangling:

test -x /usr/bin/xdvi.bin  || update-alternatives --auto xdvi.bin
test -x /usr/bin/oxdvi.bin || update-alternatives --auto oxdvi.bin

Your version might miss a case where it dangles elsewhere.  I don't
know whether or not this matters, though.

   Julian

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

         Julian Gilbey, Dept of Maths, Queen Mary, Univ. of London
       Debian GNU/Linux Developer,  see http://people.debian.org/~jdg
  Donate free food to the world's hungry: see http://www.thehungersite.com/



Reply to: