1
Description: lxc-init used to be under /usr/lib/lxc. Now it is under
2
/usr/lib/<multiarch>/lxc, but old containers will still have it under
3
/usr/lib/lxc. So search for a valid lxc-init to run.
4
Author: Serge Hallyn <serge.hallyn@ubuntu.com>
7
Index: lxc-0.8.0~rc1/src/lxc/execute.c
8
===================================================================
9
--- lxc-0.8.0~rc1.orig/src/lxc/execute.c 2012-04-25 14:15:50.929101176 -0500
10
+++ lxc-0.8.0~rc1/src/lxc/execute.c 2012-04-25 17:39:49.174409120 -0500
12
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15
+#include <sys/types.h>
16
+#include <sys/stat.h>
29
+/* historically lxc-init has been under /usr/lib/lxc. Now with
30
+ * multi-arch it can be under /usr/lib/$ARCH/lxc. Serge thinks
31
+ * it makes more sense to put it under /sbin.
32
+ * If /usr/lib/$ARCH/lxc exists and is used, then LXCINITDIR will
35
+static char *choose_init(void)
37
+ char *retv = malloc(PATH_MAX);
43
+ snprintf(retv, PATH_MAX-1, LXCINITDIR "/lxc-init");
44
+ ret = stat(retv, &mystat);
47
+ snprintf(retv, PATH_MAX-1, "/usr/lib/lxc/lxc-init");
48
+ ret = stat(retv, &mystat);
51
+ snprintf(retv, PATH_MAX-1, "/sbin/lxc-init");
52
+ ret = stat(retv, &mystat);
58
static int execute_start(struct lxc_handler *handler, void* data)
61
struct execute_args *my_args = data;
66
while (my_args->argv[argc++]);
72
- argv[i++] = LXCINITDIR "/lxc-init";
73
+ initpath = choose_init();
75
+ ERROR("Failed to find an lxc-init");
78
+ argv[i++] = initpath;
80
argv[i++] = "--quiet";