mock/src Makefile,1.1.1.1,1.2 mock-helper.c,1.3,1.4
Jeremy Katz (katzj)
fedora-extras-commits at redhat.com
Fri Jun 17 20:53:33 UTC 2005
Author: katzj
Update of /cvs/fedora/mock/src
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv11619/src
Modified Files:
Makefile mock-helper.c
Log Message:
* build libselinux-mock as a shared lib that gets installed into LIBDIR
* LD_PRELOAD libselinux-mock if we're running with selinux. this involves
linking with libselinux. if you're anti-selinux, build with
'make NOSELINUX=1'. this lets mock work on systems running targeted policy
at least
only ugliness here is that if the preload is being used, you get errors
about being unable to load it in the chroot from ld. it doesn't cause
problems, it's just aesthetically ugly.
Index: Makefile
===================================================================
RCS file: /cvs/fedora/mock/src/Makefile,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- Makefile 16 May 2005 02:44:00 -0000 1.1.1.1
+++ Makefile 17 Jun 2005 20:53:31 -0000 1.2
@@ -5,14 +5,28 @@
DESTDIR=''
INSTALL=/usr/bin/install
MKDIR=/bin/mkdir
+
+ifndef NOSELINUX
+SELINUXFLAGS=-DUSE_SELINUX=1 -lselinux
+endif
+
+ifneq (,$(filter ppc64 x86_64 s390x,$(shell uname -m)))
+LIBDIR = /usr/lib64
+else
+LIBDIR = /usr/lib
+endif
+
all:
- $(CC) -o $(EXECUTABLE) mock-helper.c
+ $(CC) $(CFLAGS) -o $(EXECUTABLE) mock-helper.c $(SELINUXFLAGS)
+ $(CC) $(CFLAGS) -fPIC -c selinux-mock.c
+ $(LD) -shared -o libselinux-mock.so selinux-mock.o
clean:
rm -f $(EXECUTABLE)
- rm -f *~ *.bak
+ rm -f *~ *.bak *.o *.so
install:
- $(MKDIR) -p $(DESTDIR)/$(SBINDIR)
- $(INSTALL) -m 4750 $(EXECUTABLE) $(DESTDIR)/$(PKGDIR)/$(SBINDIR)/$(EXECUTABLE)
+ $(MKDIR) -p $(DESTDIR)/$(SBINDIR) $(DESTDIR)/$(LIBDIR)
+ $(INSTALL) -m 4750 $(EXECUTABLE) $(DESTDIR)/$(SBINDIR)/$(EXECUTABLE)
+ $(INSTALL) -m 755 libselinux-mock.so $(DESTDIR)/$(LIBDIR)
Index: mock-helper.c
===================================================================
RCS file: /cvs/fedora/mock/src/mock-helper.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- mock-helper.c 12 Jun 2005 03:38:19 -0000 1.3
+++ mock-helper.c 17 Jun 2005 20:53:31 -0000 1.4
@@ -15,6 +15,10 @@
#include <stdlib.h>
#include <string.h>
+#ifdef USE_SELINUX
+#include <selinux/selinux.h>
+#endif
+
/* pull in configure'd defines */
char *rootsdir = ROOTSDIR;
@@ -158,13 +162,15 @@
printf ("\n");
*/
- /* add LD_PRELOAD for our selinux lib if MOCK_LD_PRELOAD is set */
- envvar = getenv ("MOCK_LD_PRELOAD");
- if (envvar != 0)
+#ifdef USE_SELINUX
+ /* add LD_PRELOAD for our selinux lib if selinux is in use is set */
+ if (is_selinux_enabled() != -1)
{
- ld_preload = strdup("LD_PRELOAD=" LIBDIR "/libselinux-mock.so");
+ ld_preload = strdup("LD_PRELOAD=libselinux-mock.so");
+ printf("adding ld_preload of %s\n", ld_preload);
env[idx++] = ld_preload;
}
+#endif
for (i = 0; i < ALLOWED_ENV_SIZE; ++i)
{
More information about the fedora-extras-commits
mailing list