summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac11
-rw-r--r--libmount/samples/.gitignore1
-rw-r--r--libmount/samples/Makefile.am2
-rw-r--r--sys-utils/.gitignore1
-rw-r--r--sys-utils/Makefile.am7
-rw-r--r--sys-utils/mountpoint.143
-rw-r--r--sys-utils/mountpoint.c (renamed from libmount/samples/mountpoint.c)0
7 files changed, 63 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index 52eade9e1..a02b5e31f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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)
diff --git a/libmount/samples/.gitignore b/libmount/samples/.gitignore
index 6008ee321..fde647739 100644
--- a/libmount/samples/.gitignore
+++ b/libmount/samples/.gitignore
@@ -1,2 +1 @@
mount
-mountpoint
diff --git a/libmount/samples/Makefile.am b/libmount/samples/Makefile.am
index ee13d8b77..b0c655f1a 100644
--- a/libmount/samples/Makefile.am
+++ b/libmount/samples/Makefile.am
@@ -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
diff --git a/sys-utils/.gitignore b/sys-utils/.gitignore
index b8af98f1a..3ae7e4a7b 100644
--- a/sys-utils/.gitignore
+++ b/sys-utils/.gitignore
@@ -18,6 +18,7 @@ lscpu
mips32.8
mips64.8
mips.8
+mountpoint
parisc32.8
parisc64.8
parisc.8
diff --git a/sys-utils/Makefile.am b/sys-utils/Makefile.am
index d916d3d04..53cdc3718 100644
--- a/sys-utils/Makefile.am
+++ b/sys-utils/Makefile.am
@@ -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
index 000000000..be17c42dd
--- /dev/null
+++ b/sys-utils/mountpoint.1
@@ -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/.
+
diff --git a/libmount/samples/mountpoint.c b/sys-utils/mountpoint.c
index 92d283054..92d283054 100644
--- a/libmount/samples/mountpoint.c
+++ b/sys-utils/mountpoint.c