]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
mountpoint: add new command
authorKarel Zak <kzak@redhat.com>
Tue, 21 Jun 2011 09:46:36 +0000 (11:46 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 21 Jun 2011 09:46:36 +0000 (11:46 +0200)
This is libmount based re-implementation of the mountpoint(1) command.
The original implementation is maintained in sysvinit suite.

The mountpoint(1) in util-linux is not enabled by default (for now) --
use --enable-mountpoint to enable the util.

Signed-off-by: Karel Zak <kzak@redhat.com>
configure.ac
libmount/samples/.gitignore
libmount/samples/Makefile.am
sys-utils/.gitignore
sys-utils/Makefile.am
sys-utils/mountpoint.1 [new file with mode: 0644]
sys-utils/mountpoint.c [moved from libmount/samples/mountpoint.c with 100% similarity]

index 52eade9e1137fbec9f09be8f25d92d51a7affdb7..a02b5e31f68cc9334ee6878f6b91ce9ff646e16e 100644 (file)
@@ -483,6 +483,17 @@ esac
 AM_CONDITIONAL(BUILD_LIBMOUNT_MOUNT, test "x$enable_libmount_mount" = xyes)
 
 
+AC_ARG_ENABLE([mountpoint],
+  AS_HELP_STRING([--enable-mountpoint], [build mountpoint]),
+  [], enable_mountpoint=no
+)
+case "$enable_libmount:$enable_mountpoint" in
+no:yes)
+  AC_MSG_ERROR([cannot enable mountpoint when libmount is disabled]) ;;
+esac
+AM_CONDITIONAL(BUILD_MOUNTPOINT, test "x$enable_mountpoint" = xyes)
+
+
 UTIL_CHECK_LIB(util, openpty)
 UTIL_CHECK_LIB(termcap, tgetnum)
 
index 6008ee3212b9d7938f495fb60a9dcf8524d61aaa..fde64773937cff389e9973a7910b416798bfd5b4 100644 (file)
@@ -1,2 +1 @@
 mount
-mountpoint
index ee13d8b777bf901b3e4fd388b8134f3a87301e13..b0c655f1ac191d22174c41ebaf5f4b9f66f49d97 100644 (file)
@@ -3,5 +3,5 @@ include $(top_srcdir)/config/include-Makefile.am
 AM_CPPFLAGS += -I$(ul_libmount_incdir)
 AM_LDFLAGS += $(ul_libmount_la)
 
-noinst_PROGRAMS = mount mountpoint
+noinst_PROGRAMS = mount
 
index b8af98f1aa9cf44d22a691fd21b4412cad6569de..3ae7e4a7bf6aa99efba024cd3e73858072d2e218 100644 (file)
@@ -18,6 +18,7 @@ lscpu
 mips32.8
 mips64.8
 mips.8
+mountpoint
 parisc32.8
 parisc64.8
 parisc.8
index d916d3d04f09009810d961f01aff07a639ec9243..53cdc3718c9e170c7cbfb60690f81228a7ad2e85 100644 (file)
@@ -31,6 +31,13 @@ fstrim_SOURCES = fstrim.c $(top_srcdir)/lib/strutils.c
 rtcwake_SOURCES = rtcwake.c $(top_srcdir)/lib/strutils.c
 dmesg_SOURCES = dmesg.c $(top_srcdir)/lib/strutils.c
 
+if BUILD_MOUNTPOINT
+bin_PROGRAMS += mountpoint
+mountpoint_LDADD = $(ul_libmount_la)
+mountpoint_CFLAGS = $(AM_CFLAGS) -I$(ul_libmount_incdir)
+dist_man_MANS += mountpoint.1
+endif
+
 if BUILD_FALLOCATE
 usrbin_exec_PROGRAMS += fallocate
 fallocate_SOURCES = fallocate.c $(top_srcdir)/lib/strutils.c
diff --git a/sys-utils/mountpoint.1 b/sys-utils/mountpoint.1
new file mode 100644 (file)
index 0000000..be17c42
--- /dev/null
@@ -0,0 +1,43 @@
+.\" -*- nroff -*-
+.TH MOUNTPOINT 1 "June 2011"
+.SH NAME
+mountpoint \- see if a directory is a mountpoint
+.SH SYNOPSIS
+.B mountpoint
+.RB [ \-q ]
+.RB [ \-d ]
+.I directory
+
+.B mountpoint
+.RB \-x
+.I device
+
+.SH DESCRIPTION
+.B mountpoint
+checks if the directory is mentioned in the /proc/self/mountinfo file.
+.SH OPTIONS
+.IP "\fB\-h, \-\-help\fP"
+Print help and exit.
+.IP "\fB\-q, \-\-quiet\fP"
+Be quiet - don't print anything.
+.IP "\fB\-d, \-\-fs\-devno\fP"
+Print major/minor device number of the filesystem on stdout.
+.IP "\fB\-x, \-\-devno\fP"
+Print major/minor device number of the blockdevice on stdout.
+.SH EXIT STATUS
+Zero if the directory is a mountpoint, non-zero if not.
+.SH AUTHOR
+.PP
+Karel Zak <kzak@redhat.com>
+.SH NOTES
+.PP
+The util-linux
+.B mountpoint
+implementation was written from scratch for libmount. The original version
+for sysvinit suite was written by Miquel van Smoorenburg.
+.SH SEE ALSO
+.BR mount (8)
+.SH AVAILABILITY
+The mountpoint command is part of the util-linux package and is available from
+ftp://ftp.kernel.org/pub/linux/utils/util-linux/.
+