[systemd-devel] [PATCH] Default to /usr/bin/u?mount, configurable, rather than hard-coded /bin/u?mount.
Lennart Poettering
lennart at poettering.net
Wed May 13 06:00:34 PDT 2015
On Mon, 11.05.15 16:58, Dimitri John Ledkov (dimitri.j.ledkov at intel.com) wrote:
Hmm, all the other AM_PATH_PROG variables do not carry a _BIN suffix,
should these two? I don't think so.
(In general, I am not too big a fan of abbreviating things
unnecessarily, unless this is commonly done elsewhere...)
Otherwise looks fine,
Lennart
> ---
> Makefile.am | 2 ++
> configure.ac | 3 +++
> src/core/mount.c | 6 +++---
> src/remount-fs/remount-fs.c | 10 +++++-----
> 4 files changed, 13 insertions(+), 8 deletions(-)
>
> diff --git a/Makefile.am b/Makefile.am
> index e4d00a8..0ff11cc 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -208,6 +208,8 @@ AM_CPPFLAGS = \
> -DPOLKIT_AGENT_BINARY_PATH=\"$(bindir)/pkttyagent\" \
> -DQUOTACHECK=\"$(QUOTACHECK)\" \
> -DKEXEC=\"$(KEXEC)\" \
> + -DMOUNT_BIN=\"$(MOUNT_BIN)\" \
> + -DUMOUNT_BIN=\"$(UMOUNT_BIN)\" \
> -DLIBDIR=\"$(libdir)\" \
> -DROOTLIBDIR=\"$(rootlibdir)\" \
> -DROOTLIBEXECDIR=\"$(rootlibexecdir)\" \
> diff --git a/configure.ac b/configure.ac
> index 600e203..61dffc6 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_BIN], [mount], [/usr/bin/mount], [$PATH:/usr/sbin:/sbin])
> +AC_PATH_PROG([UMOUNT_BIN], [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/mount.c b/src/core/mount.c
> index 65a66b4..a370c74 100644
> --- a/src/core/mount.c
> +++ b/src/core/mount.c
> @@ -871,7 +871,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_BIN, m->where, NULL);
> if (r >= 0 && UNIT(m)->manager->running_as == SYSTEMD_SYSTEM)
> r = exec_command_append(m->control_command, "-n", NULL);
> if (r < 0)
> @@ -924,7 +924,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_BIN,
> m->parameters_fragment.what, m->where, NULL);
> if (r >= 0 && UNIT(m)->manager->running_as == SYSTEMD_SYSTEM)
> r = exec_command_append(m->control_command, "-n", NULL);
> @@ -973,7 +973,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_BIN,
> m->parameters_fragment.what, m->where,
> "-o", o, NULL);
> if (r >= 0 && UNIT(m)->manager->running_as == SYSTEMD_SYSTEM)
> diff --git a/src/remount-fs/remount-fs.c b/src/remount-fs/remount-fs.c
> index 70dacfa..ff7de2c 100644
> --- a/src/remount-fs/remount-fs.c
> +++ b/src/remount-fs/remount-fs.c
> @@ -94,15 +94,15 @@ int main(int argc, char *argv[]) {
> const char *arguments[5];
> /* Child */
>
> - arguments[0] = "/bin/mount";
> + arguments[0] = MOUNT_BIN;
> arguments[1] = me->mnt_dir;
> arguments[2] = "-o";
> arguments[3] = "remount";
> arguments[4] = NULL;
>
> - execv("/bin/mount", (char **) arguments);
> + execv(MOUNT_BIN, (char **) arguments);
>
> - log_error_errno(errno, "Failed to execute /bin/mount: %m");
> + log_error_errno(errno, "Failed to execute " MOUNT_BIN ": %m");
> _exit(EXIT_FAILURE);
> }
>
> @@ -142,9 +142,9 @@ int main(int argc, char *argv[]) {
> if (s) {
> if (!is_clean_exit(si.si_code, si.si_status, NULL)) {
> if (si.si_code == CLD_EXITED)
> - log_error("/bin/mount for %s exited with exit status %i.", s, si.si_status);
> + log_error(MOUNT_BIN " for %s exited with exit status %i.", s, si.si_status);
> else
> - log_error("/bin/mount for %s terminated by signal %s.", s, signal_to_string(si.si_status));
> + log_error(MOUNT_BIN " for %s terminated by signal %s.", s, signal_to_string(si.si_status));
>
> ret = EXIT_FAILURE;
> }
> --
> 2.1.4
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list