blob: 4a820771f4448695cccd6cad1ed1a442ade43051 [file] [log] [blame]
Denis Vlasenkobff06fe2008-10-19 17:47:31 +00001/* vi: set sw=4 ts=4: */
2/*
3 * Print UUIDs on all filesystems
4 *
5 * Copyright (C) 2008 Denys Vlasenko.
6 *
Denys Vlasenko0ef64bd2010-08-16 20:14:46 +02007 * Licensed under GPLv2, see file LICENSE in this source tree.
Denis Vlasenkobff06fe2008-10-19 17:47:31 +00008 */
Denys Vlasenkodd898c92016-11-23 11:46:32 +01009//config:config BLKID
Denys Vlasenkob097a842018-12-28 03:20:17 +010010//config: bool "blkid (12 kb)"
Denys Vlasenkodd898c92016-11-23 11:46:32 +010011//config: default y
Denys Vlasenkodd898c92016-11-23 11:46:32 +010012//config: select VOLUMEID
13//config: help
Denys Vlasenko72089cf2017-07-21 09:50:55 +020014//config: Lists labels and UUIDs of all filesystems.
Denys Vlasenkodd898c92016-11-23 11:46:32 +010015//config:
16//config:config FEATURE_BLKID_TYPE
17//config: bool "Print filesystem type"
Denys Vlasenkobf182392017-08-06 20:16:28 +020018//config: default y
Denys Vlasenkodd898c92016-11-23 11:46:32 +010019//config: depends on BLKID
20//config: help
Denys Vlasenko72089cf2017-07-21 09:50:55 +020021//config: Show TYPE="filesystem type"
Denys Vlasenkodd898c92016-11-23 11:46:32 +010022
Denys Vlasenkobf182392017-08-06 20:16:28 +020023//applet:IF_BLKID(APPLET_NOEXEC(blkid, blkid, BB_DIR_SBIN, BB_SUID_DROP, blkid))
Denys Vlasenkodd898c92016-11-23 11:46:32 +010024
25//kbuild:lib-$(CONFIG_BLKID) += blkid.o
Denis Vlasenkobff06fe2008-10-19 17:47:31 +000026
Pere Orga5bc8c002011-04-11 03:29:49 +020027//usage:#define blkid_trivial_usage
Denys Vlasenko2f8ccc12011-12-06 15:09:27 +010028//usage: "[BLOCKDEV]..."
Pere Orga5bc8c002011-04-11 03:29:49 +020029//usage:#define blkid_full_usage "\n\n"
30//usage: "Print UUIDs of all filesystems"
31
Denis Vlasenkobff06fe2008-10-19 17:47:31 +000032#include "libbb.h"
33#include "volume_id.h"
34
Denis Vlasenkobff06fe2008-10-19 17:47:31 +000035int blkid_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
Denys Vlasenko90615a02010-12-30 00:40:11 +010036int blkid_main(int argc UNUSED_PARAM, char **argv)
Denis Vlasenkobff06fe2008-10-19 17:47:31 +000037{
Denys Vlasenkoe8cfc3f2012-03-03 15:09:07 +010038 int scan_devices = 1;
39
Denys Vlasenko90615a02010-12-30 00:40:11 +010040 while (*++argv) {
41 /* Note: bogus device names don't cause any error messages */
42 add_to_uuid_cache(*argv);
Denys Vlasenkoe8cfc3f2012-03-03 15:09:07 +010043 scan_devices = 0;
Denys Vlasenko90615a02010-12-30 00:40:11 +010044 }
45
Denys Vlasenkoe8cfc3f2012-03-03 15:09:07 +010046 display_uuid_cache(scan_devices);
Denis Vlasenkobff06fe2008-10-19 17:47:31 +000047 return 0;
48}