Re: [systemd-devel] [PATCH v2] Default to /usr/bin/u?mount, configurable, rather than hard-coded /bin/u?mount.

2015-05-13 Thread Lennart Poettering
On Wed, 13.05.15 14:43, Dimitri John Ledkov (dimitri.j.led...@intel.com) wrote:

Thanks! Applied!

> ---
>  Makefile.am |  2 ++
>  configure.ac|  3 +++
>  src/core/execute.h  |  2 +-
>  src/core/mount.c| 12 ++--
>  src/core/mount.h|  4 ++--
>  src/remount-fs/remount-fs.c | 10 +-
>  6 files changed, 19 insertions(+), 14 deletions(-)
> 
> diff --git a/Makefile.am b/Makefile.am
> index e4d00a8..e8a329f 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -208,6 +208,8 @@ AM_CPPFLAGS = \
>   -DPOLKIT_AGENT_BINARY_PATH=\"$(bindir)/pkttyagent\" \
>   -DQUOTACHECK=\"$(QUOTACHECK)\" \
>   -DKEXEC=\"$(KEXEC)\" \
> + -DMOUNT_PATH=\"$(MOUNT_PATH)\" \
> + -DUMOUNT_PATH=\"$(UMOUNT_PATH)\" \
>   -DLIBDIR=\"$(libdir)\" \
>   -DROOTLIBDIR=\"$(rootlibdir)\" \
>   -DROOTLIBEXECDIR=\"$(rootlibexecdir)\" \
> diff --git a/configure.ac b/configure.ac
> index 600e203..70e594d 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -100,6 +100,9 @@ AC_PATH_PROG([KEXEC], [kexec], [/usr/sbin/kexec], 
> [$PATH:/usr/sbin:/sbin])
>  
>  AC_PATH_PROG([SULOGIN], [sulogin], [/usr/sbin/sulogin], 
> [$PATH:/usr/sbin:/sbin])
>  
> +AC_PATH_PROG([MOUNT_PATH], [mount], [/usr/bin/mount], 
> [$PATH:/usr/sbin:/sbin])
> +AC_PATH_PROG([UMOUNT_PATH], [umount], [/usr/bin/umount], 
> [$PATH:/usr/sbin:/sbin])
> +
>  AS_IF([! ln --relative --help > /dev/null 2>&1], [AC_MSG_ERROR([*** ln 
> doesn't support --relative ***])])
>  
>  M4_DEFINES=
> diff --git a/src/core/execute.h b/src/core/execute.h
> index a0908e0..f5d5c1d 100644
> --- a/src/core/execute.h
> +++ b/src/core/execute.h
> @@ -165,7 +165,7 @@ struct ExecContext {
>  
>  /* This is not exposed to the user but available
>   * internally. We need it to make sure that whenever we spawn
> - * /bin/mount it is run in the same process group as us so
> + * /usr/bin/mount it is run in the same process group as us so
>   * that the autofs logic detects that it belongs to us and we
>   * don't enter a trigger loop. */
>  bool same_pgrp;
> diff --git a/src/core/mount.c b/src/core/mount.c
> index 8853311..8ef3d17 100644
> --- a/src/core/mount.c
> +++ b/src/core/mount.c
> @@ -135,8 +135,8 @@ static void mount_init(Unit *u) {
>  m->exec_context.std_error = u->manager->default_std_error;
>  }
>  
> -/* We need to make sure that /bin/mount is always called in
> - * the same process group as us, so that the autofs kernel
> +/* We need to make sure that /usr/bin/mount is always called
> + * in the same process group as us, so that the autofs kernel
>   * side doesn't send us another mount request while we are
>   * already trying to comply its last one. */
>  m->exec_context.same_pgrp = true;
> @@ -833,7 +833,7 @@ static void mount_enter_unmounting(Mount *m) {
>  m->control_command_id = MOUNT_EXEC_UNMOUNT;
>  m->control_command = m->exec_command + MOUNT_EXEC_UNMOUNT;
>  
> -r = exec_command_set(m->control_command, "/bin/umount", m->where, 
> NULL);
> +r = exec_command_set(m->control_command, UMOUNT_PATH, m->where, 
> NULL);
>  if (r >= 0 && UNIT(m)->manager->running_as == MANAGER_SYSTEM)
>  r = exec_command_append(m->control_command, "-n", NULL);
>  if (r < 0)
> @@ -884,7 +884,7 @@ static void mount_enter_mounting(Mount *m) {
>  if (r < 0)
>  goto fail;
>  
> -r = exec_command_set(m->control_command, "/bin/mount",
> +r = exec_command_set(m->control_command, MOUNT_PATH,
>   m->parameters_fragment.what, m->where, 
> NULL);
>  if (r >= 0 && UNIT(m)->manager->running_as == MANAGER_SYSTEM)
>  r = exec_command_append(m->control_command, "-n", 
> NULL);
> @@ -931,7 +931,7 @@ static void mount_enter_remounting(Mount *m) {
>  else
>  o = "remount";
>  
> -r = exec_command_set(m->control_command, "/bin/mount",
> +r = exec_command_set(m->control_command, MOUNT_PATH,
>   m->parameters_fragment.what, m->where,
>   "-o", o, NULL);
>  if (r >= 0 && UNIT(m)->manager->running_as == MANAGER_SYSTEM)
> @@ -1582,7 +1582,7 @@ static int mount_enumerate(Manager *m) {
>  
>  /* Dispatch this before we dispatch SIGCHLD, so that
>   * we always get the events from /proc/self/mountinfo
> - * before the SIGCHLD of /bin/mount. */
> + * before the SIGCHLD of /usr/bin/mount. */
>  r = sd_event_source_set_priority(m->mount_event_source, -10);
>  if (r < 0)
>  goto fail;
> diff --git a/src/core/mount.h b/src/core/mount.h

[systemd-devel] [PATCH v2] Default to /usr/bin/u?mount, configurable, rather than hard-coded /bin/u?mount.

2015-05-13 Thread Dimitri John Ledkov
---
 Makefile.am |  2 ++
 configure.ac|  3 +++
 src/core/execute.h  |  2 +-
 src/core/mount.c| 12 ++--
 src/core/mount.h|  4 ++--
 src/remount-fs/remount-fs.c | 10 +-
 6 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index e4d00a8..e8a329f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -208,6 +208,8 @@ AM_CPPFLAGS = \
-DPOLKIT_AGENT_BINARY_PATH=\"$(bindir)/pkttyagent\" \
-DQUOTACHECK=\"$(QUOTACHECK)\" \
-DKEXEC=\"$(KEXEC)\" \
+   -DMOUNT_PATH=\"$(MOUNT_PATH)\" \
+   -DUMOUNT_PATH=\"$(UMOUNT_PATH)\" \
-DLIBDIR=\"$(libdir)\" \
-DROOTLIBDIR=\"$(rootlibdir)\" \
-DROOTLIBEXECDIR=\"$(rootlibexecdir)\" \
diff --git a/configure.ac b/configure.ac
index 600e203..70e594d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -100,6 +100,9 @@ AC_PATH_PROG([KEXEC], [kexec], [/usr/sbin/kexec], 
[$PATH:/usr/sbin:/sbin])
 
 AC_PATH_PROG([SULOGIN], [sulogin], [/usr/sbin/sulogin], 
[$PATH:/usr/sbin:/sbin])
 
+AC_PATH_PROG([MOUNT_PATH], [mount], [/usr/bin/mount], [$PATH:/usr/sbin:/sbin])
+AC_PATH_PROG([UMOUNT_PATH], [umount], [/usr/bin/umount], 
[$PATH:/usr/sbin:/sbin])
+
 AS_IF([! ln --relative --help > /dev/null 2>&1], [AC_MSG_ERROR([*** ln doesn't 
support --relative ***])])
 
 M4_DEFINES=
diff --git a/src/core/execute.h b/src/core/execute.h
index a0908e0..f5d5c1d 100644
--- a/src/core/execute.h
+++ b/src/core/execute.h
@@ -165,7 +165,7 @@ struct ExecContext {
 
 /* This is not exposed to the user but available
  * internally. We need it to make sure that whenever we spawn
- * /bin/mount it is run in the same process group as us so
+ * /usr/bin/mount it is run in the same process group as us so
  * that the autofs logic detects that it belongs to us and we
  * don't enter a trigger loop. */
 bool same_pgrp;
diff --git a/src/core/mount.c b/src/core/mount.c
index 8853311..8ef3d17 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -135,8 +135,8 @@ static void mount_init(Unit *u) {
 m->exec_context.std_error = u->manager->default_std_error;
 }
 
-/* We need to make sure that /bin/mount is always called in
- * the same process group as us, so that the autofs kernel
+/* We need to make sure that /usr/bin/mount is always called
+ * in the same process group as us, so that the autofs kernel
  * side doesn't send us another mount request while we are
  * already trying to comply its last one. */
 m->exec_context.same_pgrp = true;
@@ -833,7 +833,7 @@ static void mount_enter_unmounting(Mount *m) {
 m->control_command_id = MOUNT_EXEC_UNMOUNT;
 m->control_command = m->exec_command + MOUNT_EXEC_UNMOUNT;
 
-r = exec_command_set(m->control_command, "/bin/umount", m->where, 
NULL);
+r = exec_command_set(m->control_command, UMOUNT_PATH, m->where, NULL);
 if (r >= 0 && UNIT(m)->manager->running_as == MANAGER_SYSTEM)
 r = exec_command_append(m->control_command, "-n", NULL);
 if (r < 0)
@@ -884,7 +884,7 @@ static void mount_enter_mounting(Mount *m) {
 if (r < 0)
 goto fail;
 
-r = exec_command_set(m->control_command, "/bin/mount",
+r = exec_command_set(m->control_command, MOUNT_PATH,
  m->parameters_fragment.what, m->where, 
NULL);
 if (r >= 0 && UNIT(m)->manager->running_as == MANAGER_SYSTEM)
 r = exec_command_append(m->control_command, "-n", 
NULL);
@@ -931,7 +931,7 @@ static void mount_enter_remounting(Mount *m) {
 else
 o = "remount";
 
-r = exec_command_set(m->control_command, "/bin/mount",
+r = exec_command_set(m->control_command, MOUNT_PATH,
  m->parameters_fragment.what, m->where,
  "-o", o, NULL);
 if (r >= 0 && UNIT(m)->manager->running_as == MANAGER_SYSTEM)
@@ -1582,7 +1582,7 @@ static int mount_enumerate(Manager *m) {
 
 /* Dispatch this before we dispatch SIGCHLD, so that
  * we always get the events from /proc/self/mountinfo
- * before the SIGCHLD of /bin/mount. */
+ * before the SIGCHLD of /usr/bin/mount. */
 r = sd_event_source_set_priority(m->mount_event_source, -10);
 if (r < 0)
 goto fail;
diff --git a/src/core/mount.h b/src/core/mount.h
index a01e6da..280ea0d 100644
--- a/src/core/mount.h
+++ b/src/core/mount.h
@@ -28,8 +28,8 @@ typedef struct Mount Mount;
 
 typedef enum MountState {
 MOUNT_DEAD,
-MOUNT_MOUNTING,   /* /bin/mount is running, but the mount 
is not done yet. */
-MOUNT_MOUNTING_DONE,