disk: Ensure we use the explicit path to resize2fs

On some configurations, /sbin and /usr/sbin may not even be in the $PATH,
meaning that the configure routine would fail if this is where resize2fs
lives. Secondly, we must ensure that disks now uses this explicit path.

This ensures correct functionality during non privileged testing, and
consistency with installed behaviour.

Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
This commit is contained in:
Ikey Doherty
2015-11-25 16:21:49 +00:00
parent 880e0bc84e
commit c8c6482c42
2 changed files with 8 additions and 3 deletions
+4 -2
View File
@@ -48,10 +48,12 @@ AS_IF([test "x$enable_debug" = "xyes"],
AM_CONDITIONAL([DEBUG], [test x$enable_debug = x"yes"])
# Checks for commands
AC_CHECK_PROG([RESIZE2FS], [resize2fs], [yes])
if test x"$RESIZE2FS" != x"yes" ; then
AC_PATH_PROG([RESIZE2FS], [resize2fs], [no], [$PATH:/sbin:/usr/sbin])
if test x"$RESIZE2FS" == x"no" ; then
AC_MSG_ERROR([Please install resize2fs.])
fi
AC_SUBST(RESIZE2FS)
AC_DEFINE_UNQUOTED([RESIZEFS_PATH], ["$RESIZE2FS"], [Path to resize2fs binary])
# Options
AC_ARG_WITH([systemdsystemunitdir], AS_HELP_STRING([--with-systemdsystemunitdir=DIR],
+4 -1
View File
@@ -32,6 +32,9 @@
files in the program, then also delete it here.
***/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <sys/stat.h>
@@ -178,7 +181,7 @@ gboolean disk_resize_grow(const gchar* disk_path) {
}
//FIXME using libparted algorithms
snprintf(command, LINE_MAX, "resize2fs %s", partition_path);
snprintf(command, LINE_MAX, RESIZEFS_PATH " %s", partition_path);
exec_task(command);
result = true;