From 72e9f7c254ff235ab25dc42952e7069099ad35da Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 6 Dec 2010 12:22:58 +0000 Subject: [PATCH] configure: Check for insmod.static and fail if not present. This is not packaged on Debian/Ubuntu, but we require it. Fail with a useful error message if it is not available. --- README | 5 +++++ configure.ac | 16 +++++++++++++++- helper/ext2initrd.c | 4 ++-- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/README b/README index 6545756..b2288c0 100644 --- a/README +++ b/README @@ -40,6 +40,11 @@ Requirements /sbin/mke2fs - These are part of e2fsprogs. + /sbin/insmod.static + - This is part of module-init-tools. Note that Debian does NOT + package this, you have to build it yourself (or copy the file + from a Fedora machine which also works ...) + Optional -------- (but you will need a package manager for your Linux distro) diff --git a/configure.ac b/configure.ac index d1b334d..21dd340 100644 --- a/configure.ac +++ b/configure.ac @@ -64,7 +64,21 @@ dnl For Debian handler. AC_CHECK_PROG(APTITUDE,[aptitude],[aptitude],[no]) AC_CHECK_PROG(DPKG,[dpkg],[dpkg],[no]) -dnl Required e2fsprogs, libs. +dnl Required programs, libraries. +AC_PATH_PROG([INSMODSTATIC],[insmod.static],[no]) +if test "x$INSMODSTATIC" = "xno" ; then + AC_MSG_FAILURE([insmod.static program not found + +Is /sbin in your current path? + +Note that Debian/Ubuntu do not package this file from module-init-tools. +Sorry, please fix your distribution. In the meantime you can copy +/sbin/insmod.static from a Fedora machine. +]) +fi +AC_DEFINE_UNQUOTED([INSMODSTATIC],["$INSMODSTATIC"], + [Full path to the insmod.static program.]) + AC_PATH_PROG([MKE2FS],[mke2fs],[no]) if test "x$MKE2FS" = "xno" ; then AC_MSG_FAILURE([mke2fs program not found (is /sbin in your current path?)]) diff --git a/helper/ext2initrd.c b/helper/ext2initrd.c index c981232..f10aef2 100644 --- a/helper/ext2initrd.c +++ b/helper/ext2initrd.c @@ -144,12 +144,12 @@ ext2_make_initrd (const char *modpath, const char *initrd) free_module_deps (); /* Copy in insmod static binary. */ - cmd = xasprintf ("cp /sbin/insmod.static %s", dir); + cmd = xasprintf ("cp %s %s", INSMODSTATIC, dir); if (verbose >= 2) fprintf (stderr, "%s\n", cmd); r = system (cmd); if (r == -1 || WEXITSTATUS (r) != 0) error (EXIT_FAILURE, 0, - "ext2_make_initrd: copy /sbin/insmod.static failed"); + "ext2_make_initrd: copy %s failed", INSMODSTATIC); free (cmd); /* Copy in the init program, linked into this program as a data blob. */ -- 1.8.3.1