From 4b70dcf392327a1afbb8c8b40d386c606bd6c9c2 Mon Sep 17 00:00:00 2001 From: digital-freak Date: Thu, 24 Mar 2016 20:07:15 +0500 Subject: [PATCH] Added to obtain information about the mounted file systems located on the RAW-devices (eg portable MP3-players). --- hdd.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/hdd.sh b/hdd.sh index 4397935..a7de310 100755 --- a/hdd.sh +++ b/hdd.sh @@ -23,6 +23,16 @@ get_device_capacity() { grep "User Capacity" | \ awk -F\[ '{print $2}' | \ sed 's/]//' ) + + if [ -z "${DEVICE_CAPACITY}" ]; then + DEVICE_CAPACITY=$( camcontrol readcap ${1} -H -s 2>/dev/null | \ + awk '{print $3,$4}' ) + + if [ -n "${DEVICE_CAPACITY}" ]; then + DEVICE_CAPACITY="${DEVICE_CAPACITY}B" + fi + fi + echo ${DEVICE_CAPACITY} } @@ -34,9 +44,14 @@ get_device_temperature() { } get_device_partitions() { - PARTITIONS=$( gpart show -p ${1} | \ + PARTITIONS=$( gpart show -p ${1} 2>/dev/null | \ grep -Ev "GPT|MBR|- free -" | \ awk '{print $3}' ) + + if [ "${PARTITIONS}" == "" ]; then + PARTITIONS="`gvfs-mount -l | grep ${1} | awk '{print $2}'`" + fi + echo "${PARTITIONS}" }