File: block-attr

package info (click to toggle)
debian-installer-utils 1.132%2Bdeb10u1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 916 kB
  • sloc: sh: 988; ansic: 160; makefile: 61
file content (33 lines) | stat: -rwxr-xr-x 495 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#! /bin/sh

usage () {
	echo "Usage: $0 --type|--label|--uuid <device>"
}

case $1 in
	--type)
		vol_id_opt=--type
		blkid_tag=TYPE
		;;
	--label)
		vol_id_opt=--label
		blkid_tag=LABEL
		;;
	--uuid)
		vol_id_opt=--uuid
		blkid_tag=UUID
		;;
	*)
		usage >&2
		exit 1
		;;
esac
shift

if (export PATH="/lib/udev:$PATH"; type vol_id) >/dev/null 2>&1; then
	PATH="/lib/udev:$PATH" vol_id "$vol_id_opt" "$1"
elif type blkid >/dev/null 2>&1; then
	blkid -o value -s "$blkid_tag" "$1"
else
	exit 1
fi