[linux-dvb] [PATCH] v4l-dvb: add $DESTDIR support

Ludwig Nussel ludwig.nussel at suse.de
Fri Mar 9 15:51:23 CET 2007


Trent Piepho wrote:
> On Thu, 8 Mar 2007, Ludwig Nussel wrote:
> > Trent Piepho wrote:
> > > > Following patch adds $DESTDIR support so one can install the kernel
> > > > modules into a directory other than / as non-root user. That's
> > > > useful when building an rpm or compiling for a different machine.
> 
> > > > -print OUT "\t/sbin/depmod -a \${KERNELRELEASE}\n\n";
> > > > +print OUT "\tif [ -w / ]; then /sbin/depmod -a \${KERNELRELEASE}; fi\n\n";
> > >
> > > This doesn't seem correct.  Shouldn't it be:
> > > print OUT "\t/sbin/depmod -a \$(KERNELRELEASE) \$(if \$(DESTDIR),-b \$(DESTDIR))\n\n";
> >
> > One needs to run depmod when the modules get installed to their final location.
> > $DESTDIR is incomplete so it doesn't make sense to run depmod here already.
> 
> When compiling an RPM package DESTDIR may not be the final location, but
> that is not the only reason one might want to use DESTDIR.  One could
> repair a mounted root fs after booting from a rescue CD or be trying to
> create a bootable MythTV image.

Well, obviously noone cared about such exotic use cased yet. Anyways here a
patch that adds your change as well, please apply.

Signed-off-by: Ludwig Nussel <ludwig.nussel at suse.de>

diff -r f71d56dfeb0d v4l/scripts/make_makefile.pl
--- a/v4l/scripts/make_makefile.pl	Wed Mar 07 12:28:33 2007 -0200
+++ b/v4l/scripts/make_makefile.pl	Fri Mar 09 15:45:49 2007 +0100
@@ -134,12 +134,12 @@ print OUT "\t\@strip --strip-debug \$(in
 
 while (my ($dir, $files) = each %instdir) {
 	print OUT "\t\@echo -e \"\\nInstalling \$(KDIR26)/$dir files:\"\n";
-	print OUT "\t\@install -d \$(KDIR26)/$dir\n";
+	print OUT "\t\@install -d \$(DESTDIR)\$(KDIR26)/$dir\n";
 	print OUT "\t\@for i in ", join(' ', keys %$files), ";do ";
 	print OUT "if [ -e \"\$\$i\" ]; then echo -n \"\$\$i \";";
-	print OUT " install -m 644 -c \$\$i \$(KDIR26)/$dir; fi; done; echo;\n\n";
+	print OUT " install -m 644 -c \$\$i \$(DESTDIR)\$(KDIR26)/$dir; fi; done; echo;\n\n";
 }
-print OUT "\t/sbin/depmod -a \${KERNELRELEASE}\n\n";
+print OUT "\t/sbin/depmod -a \$(KERNELRELEASE) \$(if \$(DESTDIR),-b \$(DESTDIR))\n\n";
 
 # Creating Remove rule
 print OUT "media-rminstall::\n";
@@ -149,13 +149,13 @@ while ( my ($dir, $files) = each(%instdi
 	print OUT "\t\@echo -e \"\\nRemoving old \$(KDIR26)/$dir files:\"\n";
 	print OUT "\t\@files='", join(' ', keys %$files), "'; ";
 
-	print OUT "for i in \$\$files;do if [ -e \$(KDIR26)/$dir/\$\$i ]; then ";
+	print OUT "for i in \$\$files;do if [ -e \$(DESTDIR)\$(KDIR26)/$dir/\$\$i ]; then ";
 	print OUT "echo -n \"\$\$i \";";
-	print OUT " rm \$(KDIR26)/$dir/\$\$i; fi; done; ";
+	print OUT " rm \$(DESTDIR)\$(KDIR26)/$dir/\$\$i; fi; done; ";
 
-	print OUT "for i in \$\$files;do if [ -e \$(KDIR26)/$dir/\$\$i.gz ]; then ";
+	print OUT "for i in \$\$files;do if [ -e \$(DESTDIR)\$(KDIR26)/$dir/\$\$i.gz ]; then ";
 	print OUT "echo -n \"\$\$i.gz \";";
-	print OUT " rm \$(KDIR26)/$dir/\$\$i.gz; fi; done; echo;\n\n";
+	print OUT " rm \$(DESTDIR)\$(KDIR26)/$dir/\$\$i.gz; fi; done; echo;\n\n";
 }
 
 # Print dependencies of Makefile.media

cu
Ludwig

-- 
 (o_   Ludwig Nussel
 //\   SUSE Labs
 V_/_  http://www.suse.de/
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg)




More information about the linux-dvb mailing list