aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordlezcano <dlezcano>2008-10-26 22:06:49 +0000
committerdlezcano <dlezcano>2008-10-26 22:06:49 +0000
commit693dcea5e46626ca813e520d970ef4c7b8227404 (patch)
tree4c53cd6cc3a01f1993a0d91ed09564413f7d7f13
parentAdded automatic generation of packages and repository tagging (diff)
downloadlxc-693dcea5e46626ca813e520d970ef4c7b8227404.tar.gz
lxc-693dcea5e46626ca813e520d970ef4c7b8227404.tar.bz2
lxc-693dcea5e46626ca813e520d970ef4c7b8227404.zip
Fixed different compilation scheme by making /var/lxc directory relative to
the installation prefix and by adding some extra path to search for the 'setcap' command.
-rw-r--r--Makefile.am6
-rw-r--r--configure.in6
-rw-r--r--lxc.spec.in25
-rw-r--r--src/lxc/Makefile.am11
-rw-r--r--src/lxc/lxc.h2
5 files changed, 35 insertions, 15 deletions
diff --git a/Makefile.am b/Makefile.am
index 0b34a63..2ab16cb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -5,12 +5,14 @@ DIST_SUBDIRS = config src test etc
EXTRA_DIST = lxc.spec
ChangeLog::
- @echo "Generating ChangeLog"
- @cvs2cl
+ touch ChangeLog
rpm: dist
rpmbuild --clean -ta ${distdir}.tar.gz
+
release: rpm
+ @echo "Generating ChangeLog"
+ @cvs2cl
@sh ./release.sh $(PACKAGE_NAME) \
$(LXC_MAJOR_VERSION) \
$(LXC_MINOR_VERSION) \
diff --git a/configure.in b/configure.in
index 9ce751a..ebeca46 100644
--- a/configure.in
+++ b/configure.in
@@ -12,7 +12,7 @@ AC_PROG_RANLIB
AM_PROG_CC_C_O
AC_GNU_SOURCE
AC_PROG_LIBTOOL
-AC_CHECK_PROG(SETCAP, setcap, yes, no, "/usr/sbin")
+AC_CHECK_PROG(SETCAP, setcap, yes, no)
AC_CHECK_HEADERS([linux/netlink.h linux/genetlink.h], [], AC_MSG_ERROR([netlink headers not found]),
[#include <linux/types.h>
@@ -59,8 +59,8 @@ Warning:
--------
The libcap-2 is not installed. That means the tools to
-set the privilege for the lxc commands are not available
-and you will need to run these commands as root
+set the privilege for the lxc commands are not available,
+that's ok, but you will need to run these commands as root
])
diff --git a/lxc.spec.in b/lxc.spec.in
index c311a0c..49cce65 100644
--- a/lxc.spec.in
+++ b/lxc.spec.in
@@ -75,7 +75,9 @@ development of containers
%setup -q
%build
-%configure $args
+
+# I don't understand why but I have to specify this prefix :(
+%configure --prefix=/ $args
ncpus=`egrep -c "^cpu[0-9]+" /proc/stat || :`
make -j$ncpus
@@ -106,9 +108,24 @@ fi
chmod ugo+w /var/lxc
-setcap cap_net_admin,cap_net_raw,cap_sys_admin,cap_dac_override=ep %{_bindir}/lxc-execute
-setcap cap_net_admin,cap_net_raw,cap_sys_admin,cap_dac_override=ep %{_bindir}/lxc-start
-setcap cap_net_admin,cap_net_raw,cap_sys_admin,cap_dac_override=ep %{_bindir}/lxc-restart
+PATH=$PATH:/usr/sbin:/sbin
+
+which setcap 2>&1 > /dev/null
+RES=$?
+
+if [ $RES != 0 ]; then
+ echo -e "\t********************WARNING*************************"
+ echo -e "\t* The 'setcap' command was not found, this is not *"
+ echo -e "\t* a problem and the 'lxc' package is installed but *"
+ echo -e "\t* you will have to run the 'lxc' commands as root. *"
+ echo -e "\t* If you wish to run these commands as a non-root *"
+ echo -e "\t* user, you will need to install libcap-2 package *"
+ echo -e "\t* and reinstall the lxc package *"
+ echo -e "\t****************************************************"
+else
+setcap cap_net_admin,cap_net_raw,cap_sys_admin,cap_dac_override=ep %{_bindir}/lxc-execute && setcap cap_net_admin,cap_net_raw,cap_sys_admin,cap_dac_override=ep %{_bindir}/lxc-start && setcap cap_net_admin,cap_net_raw,cap_sys_admin,cap_dac_override=ep %{_bindir}/lxc-restart
+fi
+
%files
%defattr(-,root,root)
diff --git a/src/lxc/Makefile.am b/src/lxc/Makefile.am
index 70b5a19..c22f757 100644
--- a/src/lxc/Makefile.am
+++ b/src/lxc/Makefile.am
@@ -1,5 +1,5 @@
-INCLUDES= -I$(top_srcdir)/src
-
+lxcpath=$(prefix)/var/lxc
+INCLUDES= -I$(top_srcdir)/src -DLXCPATH="\"$(lxcpath)\""
lib_LTLIBRARIES = liblxc.la
pkginclude_HEADERS = \
monitor.h \
@@ -113,9 +113,10 @@ lxc_version_SOURCES = lxc_version.c
lxc_version_LDADD = liblxc.la
install-exec-local:
- -@/usr/sbin/setcap cap_net_admin,cap_net_raw,cap_sys_admin,cap_dac_override=ep $(bindir)/lxc-execute 2>&1 > /dev/null && \
- /usr/sbin/setcap cap_net_admin,cap_net_raw,cap_sys_admin,cap_dac_override=ep $(bindir)/lxc-start && \
- /usr/sbin/setcap cap_net_admin,cap_net_raw,cap_sys_admin,cap_dac_override=ep $(bindir)/lxc-restart && \
+ -@export PATH=$$PATH:/sbin:/usr/sbin && \
+ setcap cap_net_admin,cap_net_raw,cap_sys_admin,cap_dac_override=ep $(bindir)/lxc-execute && \
+ setcap cap_net_admin,cap_net_raw,cap_sys_admin,cap_dac_override=ep $(bindir)/lxc-start && \
+ setcap cap_net_admin,cap_net_raw,cap_sys_admin,cap_dac_override=ep $(bindir)/lxc-restart && \
mkdir -p $(prefix)/var/lxc && \
chmod ugo+rw $(prefix)/var/lxc || \
(echo && echo && \
diff --git a/src/lxc/lxc.h b/src/lxc/lxc.h
index 601dfa2..810f7eb 100644
--- a/src/lxc/lxc.h
+++ b/src/lxc/lxc.h
@@ -43,7 +43,7 @@ extern "C" {
#include <lxc/cgroup.h>
#include <lxc/monitor.h>
-#define LXCPATH "/var/lxc"
+/* #define LXCPATH "/var/lxc" */
#define MAXPIDLEN 20
struct lxc_mem_stat;