|
|
05ad79 |
From 2555bd3bad9ea8e7ae40a727f59bb546d2aa2717 Mon Sep 17 00:00:00 2001
|
|
|
05ad79 |
From: Karel Zak <kzak@redhat.com>
|
|
|
05ad79 |
Date: Fri, 28 Mar 2014 10:36:05 +0100
|
|
|
05ad79 |
Subject: [PATCH 69/84] findfs: add ability to work with PART{UUID,LABEL}= too
|
|
|
05ad79 |
|
|
|
05ad79 |
Upstream: http://github.com/karelzak/util-linux/commit/c48508c2faa356c48c26d7d0070a6f20ae4ba9a0
|
|
|
05ad79 |
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=1335671
|
|
|
05ad79 |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
05ad79 |
---
|
|
|
05ad79 |
misc-utils/findfs.8 | 51 +++++++++++++++++++++++++++++++++++++++------------
|
|
|
05ad79 |
misc-utils/findfs.c | 17 +++++------------
|
|
|
05ad79 |
2 files changed, 44 insertions(+), 24 deletions(-)
|
|
|
05ad79 |
|
|
|
05ad79 |
diff --git a/misc-utils/findfs.8 b/misc-utils/findfs.8
|
|
|
05ad79 |
index 8a6bca1..b92cd45 100644
|
|
|
05ad79 |
--- a/misc-utils/findfs.8
|
|
|
05ad79 |
+++ b/misc-utils/findfs.8
|
|
|
05ad79 |
@@ -7,19 +7,45 @@
|
|
|
05ad79 |
findfs \- find a filesystem by label or UUID
|
|
|
05ad79 |
.SH SYNOPSIS
|
|
|
05ad79 |
.B findfs
|
|
|
05ad79 |
-.BI LABEL= label
|
|
|
05ad79 |
-.sp
|
|
|
05ad79 |
-.B findfs
|
|
|
05ad79 |
-.BI UUID= uuid
|
|
|
05ad79 |
+.BI NAME= value
|
|
|
05ad79 |
.SH DESCRIPTION
|
|
|
05ad79 |
.B findfs
|
|
|
05ad79 |
-will search the disks in the system looking for a filesystem which has
|
|
|
05ad79 |
-a label matching
|
|
|
05ad79 |
-.I label
|
|
|
05ad79 |
-or a UUID equal to
|
|
|
05ad79 |
-.IR uuid .
|
|
|
05ad79 |
-If the filesystem is found, the device name for the filesystem will
|
|
|
05ad79 |
-be printed on stdout.
|
|
|
05ad79 |
+will search the block devices in the system looking for a filesystem or
|
|
|
05ad79 |
+partition with specified tag. The currently supported tags are:
|
|
|
05ad79 |
+.TP
|
|
|
05ad79 |
+.B LABEL=<label>
|
|
|
05ad79 |
+Specifies filesystem label.
|
|
|
05ad79 |
+.TP
|
|
|
05ad79 |
+.B UUID=<uuid>
|
|
|
05ad79 |
+Specifies filesystem UUID.
|
|
|
05ad79 |
+.TP
|
|
|
05ad79 |
+.B PARTUUID=<uuid>
|
|
|
05ad79 |
+Specifies partition UUID. This partition identifier is supported for example for
|
|
|
05ad79 |
+GUID Partition Table (GPT) partition tables.
|
|
|
05ad79 |
+.TP
|
|
|
05ad79 |
+.B PARTLABEL=<label>
|
|
|
05ad79 |
+Specifies partition label (name). The partition labels are supported for example for
|
|
|
05ad79 |
+GUID Partition Table (GPT) or MAC partition tables.
|
|
|
05ad79 |
+.PP
|
|
|
05ad79 |
+If the filesystem or partition is found, the device name will be printed on
|
|
|
05ad79 |
+stdout.
|
|
|
05ad79 |
+
|
|
|
05ad79 |
+The complete overview about filesystems and partitions you can get for example
|
|
|
05ad79 |
+by
|
|
|
05ad79 |
+.RS
|
|
|
05ad79 |
+
|
|
|
05ad79 |
+.br
|
|
|
05ad79 |
+.BI "lsblk \-\-fs"
|
|
|
05ad79 |
+.br
|
|
|
05ad79 |
+
|
|
|
05ad79 |
+.BI "partx --show <disk>"
|
|
|
05ad79 |
+.br
|
|
|
05ad79 |
+
|
|
|
05ad79 |
+.BI blkid
|
|
|
05ad79 |
+.br
|
|
|
05ad79 |
+
|
|
|
05ad79 |
+.RE
|
|
|
05ad79 |
+
|
|
|
05ad79 |
.PP
|
|
|
05ad79 |
.SH AUTHOR
|
|
|
05ad79 |
.B findfs
|
|
|
05ad79 |
@@ -30,7 +56,8 @@ the util-linux package by Karel Zak (kzak@redhat.com).
|
|
|
05ad79 |
enables debug output.
|
|
|
05ad79 |
.SH SEE ALSO
|
|
|
05ad79 |
.BR blkid (8),
|
|
|
05ad79 |
-.BR fsck (8)
|
|
|
05ad79 |
+.BR lsblk (8),
|
|
|
05ad79 |
+.BR partx (8)
|
|
|
05ad79 |
.SH AVAILABILITY
|
|
|
05ad79 |
The findfs command is part of the util-linux package and is available from
|
|
|
05ad79 |
ftp://ftp.kernel.org/pub/linux/utils/util-linux/.
|
|
|
05ad79 |
diff --git a/misc-utils/findfs.c b/misc-utils/findfs.c
|
|
|
05ad79 |
index bc4a843..29ca1cb 100644
|
|
|
05ad79 |
--- a/misc-utils/findfs.c
|
|
|
05ad79 |
+++ b/misc-utils/findfs.c
|
|
|
05ad79 |
@@ -19,8 +19,7 @@ static void __attribute__((__noreturn__)) usage(int rc)
|
|
|
05ad79 |
{
|
|
|
05ad79 |
FILE *out = rc ? stderr : stdout;
|
|
|
05ad79 |
fputs(USAGE_HEADER, out);
|
|
|
05ad79 |
- fprintf(out, _(" %1$s [options] LABEL=<label>\n"
|
|
|
05ad79 |
- " %1$s [options] UUID=<uuid>\n"),
|
|
|
05ad79 |
+ fprintf(out, _(" %s [options] {LABEL,UUID,PARTUUID,PARTLABEL}=<value>\n"),
|
|
|
05ad79 |
program_invocation_short_name);
|
|
|
05ad79 |
fputs(USAGE_OPTIONS, out);
|
|
|
05ad79 |
fputs(USAGE_HELP, out);
|
|
|
05ad79 |
@@ -31,7 +30,7 @@ static void __attribute__((__noreturn__)) usage(int rc)
|
|
|
05ad79 |
|
|
|
05ad79 |
int main(int argc, char **argv)
|
|
|
05ad79 |
{
|
|
|
05ad79 |
- char *dev, *tk, *vl;
|
|
|
05ad79 |
+ char *dev;
|
|
|
05ad79 |
|
|
|
05ad79 |
setlocale(LC_ALL, "");
|
|
|
05ad79 |
bindtextdomain(PACKAGE, LOCALEDIR);
|
|
|
05ad79 |
@@ -43,23 +42,17 @@ int main(int argc, char **argv)
|
|
|
05ad79 |
* with version from e2fsprogs */
|
|
|
05ad79 |
usage(2);
|
|
|
05ad79 |
|
|
|
05ad79 |
- if (!strncmp(argv[1], "LABEL=", 6)) {
|
|
|
05ad79 |
- tk = "LABEL";
|
|
|
05ad79 |
- vl = argv[1] + 6;
|
|
|
05ad79 |
- } else if (!strncmp(argv[1], "UUID=", 5)) {
|
|
|
05ad79 |
- tk = "UUID";
|
|
|
05ad79 |
- vl = argv[1] + 5;
|
|
|
05ad79 |
- } else if (strcmp(argv[1], "-V") == 0 ||
|
|
|
05ad79 |
+ if (strcmp(argv[1], "-V") == 0 ||
|
|
|
05ad79 |
strcmp(argv[1], "--version") == 0) {
|
|
|
05ad79 |
printf(UTIL_LINUX_VERSION);
|
|
|
05ad79 |
return EXIT_SUCCESS;
|
|
|
05ad79 |
} else if (strcmp(argv[1], "-h") == 0 ||
|
|
|
05ad79 |
strcmp(argv[1], "--help") == 0) {
|
|
|
05ad79 |
usage(EXIT_SUCCESS);
|
|
|
05ad79 |
- } else
|
|
|
05ad79 |
+ } else if (argv[1][0] == '-')
|
|
|
05ad79 |
usage(2);
|
|
|
05ad79 |
|
|
|
05ad79 |
- dev = blkid_evaluate_tag(tk, vl, NULL);
|
|
|
05ad79 |
+ dev = blkid_evaluate_tag(argv[1], NULL, NULL);
|
|
|
05ad79 |
if (!dev)
|
|
|
05ad79 |
errx(EXIT_FAILURE, _("unable to resolve '%s'"), argv[1]);
|
|
|
05ad79 |
|
|
|
05ad79 |
--
|
|
|
05ad79 |
2.7.4
|
|
|
05ad79 |
|