Follow block device symlinks

This commit is contained in:
Kris Lamoureux 2022-11-30 01:54:20 -05:00
parent 7ea2454c70
commit df45e39d42
Signed by: kris
GPG Key ID: 3EDA9C3441EDA925

View File

@ -20,7 +20,9 @@ function usage () {
}
function disk_check () {
DISK_TYPE=$(file "$1" | awk '{ print $2$3 }')
DISK="$1"
[ -L "$DISK" ] && DISK=$(readlink -f "$DISK")
DISK_TYPE=$(file "$DISK" | awk '{ print $2$3 }')
if [ "$DISK_TYPE" != "blockspecial" ]; then
echo "ERROR: Disk '$1' is not a block device"
exit 1