diff options
-rwxr-xr-x | init.d/halt.sh | 2 | ||||
-rwxr-xr-x | init.d/localmount | 10 | ||||
-rwxr-xr-x | sh.Linux/init.sh | 2 | ||||
-rw-r--r-- | src/mountinfo.c | 16 |
4 files changed, 18 insertions, 12 deletions
diff --git a/init.d/halt.sh b/init.d/halt.sh index 2a735613..ae369796 100755 --- a/init.d/halt.sh +++ b/init.d/halt.sh @@ -35,7 +35,7 @@ if [ "${RC_SYS}" = "VPS" ] ; then fi # If $svcdir is still mounted, preserve it if we can -if mountinfo "${RC_SVCDIR}" >/dev/null && [ -w "${RC_LIBDIR}" ] ; then +if mountinfo -q "${RC_SVCDIR}" && [ -w "${RC_LIBDIR}" ] ; then f_opts="-m -c" [ "${RC_UNAME}" = "Linux" ] && f_opts="-c" if [ -n "$(fuser ${f_opts} "${svcdir}" 2>/dev/null)" ] ; then diff --git a/init.d/localmount b/init.d/localmount index 7e20c3df..06a1979f 100755 --- a/init.d/localmount +++ b/init.d/localmount @@ -81,7 +81,7 @@ start() { fi # Setup Kernel Support for the NFS daemon status - if [ -d /proc/fs/nfsd ] && ! mountinfo /proc/fs/nfsd >/dev/null ; then + if [ -d /proc/fs/nfsd ] && ! mountinfo -q /proc/fs/nfsd ; then if grep -qs nfsd /proc/filesystems ; then ebegin "Mounting nfsd filesystem" mount -t nfsd -o nodev,noexec,nosuid \ @@ -91,7 +91,7 @@ start() { fi # Setup Kernel Support for miscellaneous Binary Formats - if [ -d /proc/sys/fs/binfmt_misc ] && ! mountinfo /proc/sys/fs/binfmt_misc >/dev/null ; then + if [ -d /proc/sys/fs/binfmt_misc ] && ! mountinfo -q /proc/sys/fs/binfmt_misc ; then if grep -qs binfmt_misc /proc/filesystems ; then ebegin "Mounting misc binary format filesystem" mount -t binfmt_misc -o nodev,noexec,nosuid \ @@ -101,7 +101,7 @@ start() { fi # Setup Kernel Support for securityfs - if [ -d /sys/kernel/security ] && ! mountinfo /sys/kernel/security >/dev/null ; then + if [ -d /sys/kernel/security ] && ! mountinfo -q /sys/kernel/security ; then if grep -qs securityfs /proc/filesystems ; then ebegin "Mounting security filesystem" mount -t securityfs securityfs /sys/kernel/security \ @@ -111,7 +111,7 @@ start() { fi # Setup Kernel Support for debugfs - if [ -d /sys/kernel/debug ] && ! mountinfo /sys/kernel/debug >/dev/null ; then + if [ -d /sys/kernel/debug ] && ! mountinfo -q /sys/kernel/debug ; then if grep -qs debugfs /proc/filesystems ; then ebegin "Mounting debug filesystem" mount -t debugfs debugfs /sys/kernel/debug \ @@ -121,7 +121,7 @@ start() { fi # Setup Kernel Support for SELinux - if [ -d /selinux ] && ! mountinfo /selinux >/dev/null ; then + if [ -d /selinux ] && ! mountinfo -q /selinux ; then if grep -qs selinuxfs /proc/filesystems ; then ebegin "Mounting SELinux filesystem" mount -t selinuxfs selinuxfs /selinux diff --git a/sh.Linux/init.sh b/sh.Linux/init.sh index e9fd98ba..bc4fd9d7 100755 --- a/sh.Linux/init.sh +++ b/sh.Linux/init.sh @@ -199,7 +199,7 @@ fi # Mount the new fancy pants /dev/pts whenever possible if grep -Eq "[[:space:]]+devpts$" /proc/filesystems && \ - ! mountinfo /dev/pts > /dev/null ; then + ! mountinfo -q /dev/pts ; then if [ ! -d /dev/pts ] && \ [ "${devfs}" = "yes" -o "${udev}" = "yes" ] ; then # Make sure we have /dev/pts diff --git a/src/mountinfo.c b/src/mountinfo.c index 0461ee13..2c317f33 100644 --- a/src/mountinfo.c +++ b/src/mountinfo.c @@ -159,7 +159,7 @@ static regex_t *get_regex (char *string) } #include "_usage.h" -#define getoptstring "f:F:n:N:p:P:os" getoptstring_COMMON +#define getoptstring "f:F:n:N:op:P:qs" getoptstring_COMMON static struct option longopts[] = { { "fstype-regex", 1, NULL, 'f'}, { "skip-fstype-regex", 1, NULL, 'F'}, @@ -169,6 +169,7 @@ static struct option longopts[] = { { "skip-point-regex", 1, NULL, 'P'}, { "node", 0, NULL, 'o'}, { "fstype", 0, NULL, 's'}, + { "quiet", 0, NULL, 'q'}, longopts_COMMON { NULL, 0, NULL, 0} }; @@ -189,6 +190,7 @@ int mountinfo (int argc, char **argv) bool fstype = false; char **mounts = NULL; int opt; + bool quiet = false; int result; #define DO_REG(_var) \ @@ -211,15 +213,18 @@ int mountinfo (int argc, char **argv) case 'N': DO_REG (skip_node_regex); break; + case 'o': + node = true; + fstype = false; + break; case 'p': DO_REG (point_regex); break; case 'P': DO_REG (skip_point_regex); break; - case 'o': - node = true; - fstype = false; + case 'q': + quiet = true; break; case 's': node = false; @@ -257,7 +262,8 @@ int mountinfo (int argc, char **argv) continue; if (skip_point_regex && regexec (skip_point_regex, n, 0, NULL, 0) == 0) continue; - printf ("%s\n", n); + if (! quiet) + printf ("%s\n", n); result = EXIT_SUCCESS; } rc_strlist_free (nodes); |