~siretart/cryptsetup/debian

2 by Reinhard Tartler
import cryptsetup_1.0.4+svn29-1.dsc
1
#!/bin/sh
2
# this script depends on /lib/udev/vol_id from the udev package
3
4
# usage: un_vol_id <device> <fs_type>
5
# <device> may be any device that should be checked.
6
# if no <fs_type> is given, the check fails for any valid filesystem
7
# if <fs_type> is given, the check fails when a filesystem type <fs_type>
8
# is found on the device.
9
5 by Reinhard Tartler
cryptsetup_1.0.5-2.dsc
10
# note that the 'minix' fs is filtered out if checking for any valid fs,
11
# as it has been reported that this fs my be detected erroneously by vol_id.
12
2 by Reinhard Tartler
import cryptsetup_1.0.4+svn29-1.dsc
13
if test ! -x "/lib/udev/vol_id"; then
14
  echo " - WARNING: vol_id from udev is not available, impossible to run checks."
15
  exit 0
16
fi
17
18
dev=$1
19
fs=$2
20
21
vol_id=`/lib/udev/vol_id -t $dev 2>&1`
22
11 by Reinhard Tartler
import cryptsetup_1.0.6-1.dsc
23
if [ "$vol_id" != "$dev: unknown volume type" ] && [ "$vol_id" != "minix" ] && [ -z "$fs" ]; then
2 by Reinhard Tartler
import cryptsetup_1.0.4+svn29-1.dsc
24
  echo " - The device $dev contains a valid filesystem type $vol_id."
25
  exit 1
11 by Reinhard Tartler
import cryptsetup_1.0.6-1.dsc
26
elif [ -n "$fs" ] && [ "$vol_id" = "$fs" ]; then
2 by Reinhard Tartler
import cryptsetup_1.0.4+svn29-1.dsc
27
  echo " - The device $dev contains a filesystem type $fs."
28
  exit 1
29
fi