Check for mke2fs in sbin dirs, configure path into linuxdisk plugin
authorHilko Bengen <bengen@debian.org>
Fri, 28 Feb 2020 13:16:06 +0000 (14:16 +0100)
committerHilko Bengen <bengen@debian.org>
Tue, 14 Jun 2022 10:00:40 +0000 (11:00 +0100)
Gbp-Pq: Name 0004-Check-for-mke2fs-in-sbin-dirs-configure-path-into-li.patch

configure.ac
plugins/linuxdisk/filesystem.c

index 9383b9fef0ad797542d6bc771a9ed87398f292f9..993b9bea4319763cc611d46c9d4ed76111529c3f 100644 (file)
@@ -649,12 +649,15 @@ dnl Check for mke2fs -d (used by linuxdisk plugin).  There are two
 dnl possible outcomes that we care about: (1) We have mke2fs and
 dnl it supports the -d option.  (2) We either don't have mke2fs
 dnl or it's too old to support the -d option (eg. on RHEL 7).
+AC_PATH_PROG([MKE2FS], [mke2fs], [no], [$PATH:/usr/local/sbin:/usr/sbin:/sbin])
+AC_MSG_CHECKING([for $MKE2FS supporting the -d option])
 mke2fs_with_d=no
 AS_IF([test "$enable_linuxdisk" != "no"], [
     AC_MSG_CHECKING([for mke2fs supporting the -d option])
-    AS_IF([mke2fs -V >/dev/null 2>&1], [
-        AS_IF([LANG=C mke2fs -d 2>&1 | grep -sq "option requires an argument"], [
+    AS_IF([$MKE2FS -V >/dev/null 2>&1], [
+        AS_IF([LANG=C $MKE2FS -d 2>&1 | grep -sq "option requires an argument"], [
             mke2fs_with_d=yes
+            AC_DEFINE_UNQUOTED([MKE2FS], ["$MKE2FS"], [path to mke2fs binary])
         ])
     ])
     AC_MSG_RESULT([$mke2fs_with_d])
index a9f70640d86b6463667bf35188cdbadb60ae0c4e..e0b02b18e9a5090b731a38f16d1e3fc784403192 100644 (file)
@@ -219,7 +219,7 @@ mke2fs (const char *filename)
     return -1;
   }
 
-  fprintf (fp, "mke2fs -q -F -t %s ", type);
+  fprintf (fp, MKE2FS " -q -F -t %s ", type);
   if (label) {
     fprintf (fp, "-L ");
     shell_quote (label, fp);