This is the mail archive of the ecos-patches@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

host : make install fail if not root


Hi.

If i do the sequence "./configure make make install" for host side tools, and if i'am not root, the install fail.

I think we should not need to be root for succedd the install.

So i suggest this patch.

I'am not sure it is the good solution.

Regards.
Index: packages/devs/eth/synth/ecosynth/current/host/Makefile.am
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/eth/synth/ecosynth/current/host/Makefile.am,v
retrieving revision 1.4
diff -u -5 -r1.4 Makefile.am
--- packages/devs/eth/synth/ecosynth/current/host/Makefile.am	29 Jan 2009 17:48:16 -0000	1.4
+++ packages/devs/eth/synth/ecosynth/current/host/Makefile.am	25 Sep 2009 18:10:53 -0000
@@ -80,12 +80,12 @@
 rawether.$(OBJEXT)	: Makefile ../src/protocol.h
 
 ## The rawether program needs to run with root privileges, or it will
 ## be unable to access the ethernet hardware.
 install-data-hook:
-	chown root $(etherdir)/rawether
-	chmod u+s $(etherdir)/rawether
+	if [ `id -u` = 0 ] ; then chown root $(etherdir)/rawether ; fi
+	if [ `id -u` = 0 ] ; then chmod u+s $(etherdir)/rawether  ; fi
 
 else
 ## When automake scans for hooks it does not take conditionals fully
 ## into account. If the conditional is not satisfied the generated
 ## makefile will still try to invoke the hook, so dummy hooks are needed.
Index: packages/devs/eth/synth/ecosynth/current/host/Makefile.in
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/eth/synth/ecosynth/current/host/Makefile.in,v
retrieving revision 1.6
diff -u -5 -r1.6 Makefile.in
--- packages/devs/eth/synth/ecosynth/current/host/Makefile.in	23 Aug 2009 13:07:45 -0000	1.6
+++ packages/devs/eth/synth/ecosynth/current/host/Makefile.in	25 Sep 2009 18:10:53 -0000
@@ -708,12 +708,12 @@
 
 
 @SUPPORTED_TRUE@rawether.$(OBJEXT)	: Makefile ../src/protocol.h
 
 @SUPPORTED_TRUE@install-data-hook:
-@SUPPORTED_TRUE@	chown root $(etherdir)/rawether
-@SUPPORTED_TRUE@	chmod u+s $(etherdir)/rawether
+@SUPPORTED_TRUE@	if [ `id -u` = 0 ] ; then chown root $(etherdir)/rawether ; fi
+@SUPPORTED_TRUE@	if [ `id -u` = 0 ] ; then chmod u+s $(etherdir)/rawether  ; fi
 
 @SUPPORTED_FALSE@install-data-hook:
 @SUPPORTED_FALSE@	echo Nothing to be done for this platform
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
Index: packages/io/usb/slave/current/host/Makefile.am
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/usb/slave/current/host/Makefile.am,v
retrieving revision 1.5
diff -u -5 -r1.5 Makefile.am
--- packages/io/usb/slave/current/host/Makefile.am	29 Jan 2009 17:49:49 -0000	1.5
+++ packages/io/usb/slave/current/host/Makefile.am	25 Sep 2009 18:11:03 -0000
@@ -95,12 +95,12 @@
 	$(INSTALL_PROGRAM) usbhost $(bindir)/usbhost_@PACKAGE_VERSION@
 	rm -f $(bindir)/usbhost
 	$(LN_S) $(bindir)/usbhost_@PACKAGE_VERSION@ $(bindir)/usbhost
 
 install-data-hook:
-	chown root $(usbauxdir)/usbchmod
-	chmod u+s $(usbauxdir)/usbchmod
+	if [ `id -u` = 0 ] ; then chown root $(usbauxdir)/usbchmod ; fi
+	if [ `id -u` = 0 ] ; then chmod u+s $(usbauxdir)/usbchmod  ; fi
 
 else
 
 ## When automake scans for hooks it does not take conditionals fully
 ## into account. If the conditional is not satisfied the generated
Index: packages/io/usb/slave/current/host/Makefile.in
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/usb/slave/current/host/Makefile.in,v
retrieving revision 1.6
diff -u -5 -r1.6 Makefile.in
--- packages/io/usb/slave/current/host/Makefile.in	18 Aug 2008 13:34:29 -0000	1.6
+++ packages/io/usb/slave/current/host/Makefile.in	25 Sep 2009 18:11:03 -0000
@@ -658,12 +658,12 @@
 @SUPPORTED_TRUE@	$(INSTALL_PROGRAM) usbhost $(bindir)/usbhost_@PACKAGE_VERSION@
 @SUPPORTED_TRUE@	rm -f $(bindir)/usbhost
 @SUPPORTED_TRUE@	$(LN_S) $(bindir)/usbhost_@PACKAGE_VERSION@ $(bindir)/usbhost
 
 @SUPPORTED_TRUE@install-data-hook:
-@SUPPORTED_TRUE@	chown root $(usbauxdir)/usbchmod
-@SUPPORTED_TRUE@	chmod u+s $(usbauxdir)/usbchmod
+@SUPPORTED_TRUE@	if [ `id -u` = 0 ] ; then chown root $(usbauxdir)/usbchmod ; fi
+@SUPPORTED_TRUE@	if [ `id -u` = 0 ] ; then chmod u+s $(usbauxdir)/usbchmod  ; fi
 
 @SUPPORTED_FALSE@install-exec-hook:
 @SUPPORTED_FALSE@	echo Nothing to be done for this platform
 
 @SUPPORTED_FALSE@install-data-hook:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]