projects
/
feisty_meow.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
dropping retired get_x_auth script
[feisty_meow.git]
/
scripts
/
system
/
report_disk_type.sh
diff --git
a/scripts/system/report_disk_type.sh
b/scripts/system/report_disk_type.sh
index 8236788b751d14d3935b6cac7417425e2c3f761f..7bfa0b4db4554bfbccb689c6e24a32ed564a92b2 100644
(file)
--- a/
scripts/system/report_disk_type.sh
+++ b/
scripts/system/report_disk_type.sh
@@
-1,7
+1,7
@@
#!/bin/bash
#!/bin/bash
-# reports whether
the disk partition provided
is spinning physical media or solid state.
-# if no
partition
is specified, then /dev/sda is the default.
+# reports whether
a disk
is spinning physical media or solid state.
+# if no
drive
is specified, then /dev/sda is the default.
source "$FEISTY_MEOW_SCRIPTS/core/functions.sh"
source "$FEISTY_MEOW_SCRIPTS/core/functions.sh"
@@
-10,7
+10,9
@@
drive="$1"; shift
# plug in a default drive if none is provided.
if [ -z "$drive" ]; then drive="sda"; fi
# plug in a default drive if none is provided.
if [ -z "$drive" ]; then drive="sda"; fi
-# chop off the /dev/ portion of the disk partition name, if it exists.
+# chop off the /dev/ portion of the disk name, if it exists. also chop off
+# any partition numbers, since the script can only check whole drives (where,
+# so far at least, all partitions on a drive are the same type).
if [[ "$drive" =~ ^/dev/.*$ ]]; then
drive="$(echo "$drive" | sed -e 's/^\/dev\///')"
# echo "after mangle, drive is: '$drive'"
if [[ "$drive" =~ ^/dev/.*$ ]]; then
drive="$(echo "$drive" | sed -e 's/^\/dev\///')"
# echo "after mangle, drive is: '$drive'"
@@
-32,3
+34,4
@@
else
echo "drive $drive is a spinning physical disk."
fi
echo "drive $drive is a spinning physical disk."
fi
+