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

Re: [virt-tools-list] [libosinfo 1/2] Create udev rules dir before installing rules file



On Fri, Sep 16, 2011 at 08:46:25AM +0100, Richard W.M. Jones wrote:
> On Thu, Sep 15, 2011 at 06:07:03PM +0300, Zeeshan Ali (Khattak) wrote:
> > From: "Zeeshan Ali (Khattak)" <zeeshanak gnome org>
> > 
> > ---
> >  data/Makefile.am |    3 +++
> >  1 files changed, 3 insertions(+), 0 deletions(-)
> > 
> > diff --git a/data/Makefile.am b/data/Makefile.am
> > index bd712d4..6fa12d4 100644
> > --- a/data/Makefile.am
> > +++ b/data/Makefile.am
> > @@ -16,6 +16,9 @@ BUILT_SOURCES = 95-osinfo.rules
> >  # since it can easily fail (e.g if `make install` is run unprivileged) and its
> >  # not a big deal if it does.
> >  install-data-hook: 95-osinfo.rules
> > +	-mkdir $(DESTDIR)/lib
> > +	-mkdir $(DESTDIR)/lib/udev
> > +	-mkdir $(DESTDIR)/lib/udev/rules.d
> >  	-cp 95-osinfo.rules $(DESTDIR)/lib/udev/rules.d/
> 
> I would be writing:
> 
>   mkdir -p $(DESTDIR)/lib/udev/rules.d
>   $(INSTALL) -m 0644 95-osinfo.rules $(DESTDIR)/lib/udev/rules.d/
> Also it's almost always a bad idea to use '-' to ignore errors,
> particularly so in this case.
> 
> In fact I'd probably also define $(rulesdir), but I guess that's not
> so important here.

Actually we should define $(rulesdir), since that makes it easy to
override the location during make install. Since we can't install
into /lib/udev as non-root I think we need todo a little magic
work

   udev_rulesdir = @udev_rulesdir@
   mkdir -p $(DESTDIR)$(udev_rulesdir)
   $(INSTALL) -m 0644 95-osinfo.rules $(DESTDIR)$(udev_rulesdir)

And in configure.ac we could add

  AC_ARG_WITH([udev-rulesdir],
              [AS_HELP_STRING([--with-udev-rulesdir],[UDev rules directory])],
              [], [])

  if test -z "$udev_rulesdir" ; then
     if test "$prefix" = "/usr" ; then
        udev_rulesdir=/lib/udev/rules.d
     else
        udev_rulesdir=$prefix/lib/udev/rules.d
     fi
  fi

  AC_SUBST(udev_rulesdir)


This means that if someone does ./configure --prefix=/usr then they will
get the udev rules in the correct place, but if they do something like
./configure --prefix=/home/berrange/libosinfo, they will get the udev
rules in /home/berrange/libosinfo/lib/udev/rules.d, and they can also
use ./configure --with-udev-rulesdir=/some/where/else if they really
want to


Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|


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