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>
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)
AM_CPPFLAGS += -I$(ul_libmount_incdir)
AM_LDFLAGS += $(ul_libmount_la)
-noinst_PROGRAMS = mount mountpoint
+noinst_PROGRAMS = mount
mips32.8
mips64.8
mips.8
+mountpoint
parisc32.8
parisc64.8
parisc.8
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
--- /dev/null
+.\" -*- 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/.
+