diff --git a/debian/changelog b/debian/changelog index b518c58d..19cdcb6b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,6 +9,7 @@ byobu (2.72) UNRELEASED; urgency=low share/man/man1/byobu.1: added a disk throughput notification * usr/bin/byobu-janitor: add hyphenation to the regex to allow for disk_io + * usr/lib/byobu/disk_io: improve MONITORED_DISK overriding -- Dustin Kirkland Thu, 22 Apr 2010 12:31:20 -0500 diff --git a/usr/lib/byobu/disk_io b/usr/lib/byobu/disk_io index 55734ac3..b5e30cb6 100755 --- a/usr/lib/byobu/disk_io +++ b/usr/lib/byobu/disk_io @@ -20,15 +20,16 @@ PKG="byobu" color 2>/dev/null || color() { true; } -# Allow interface overrides in $HOME/.$PKG/status -if [ -n "$MONITORED_DISK" ]; then - disk="$MONITORED_DISK" -else - disk=$(df -h / | tail -n1 | sed -e "s/[0-9].*$//" -e "s:^.*/::") -fi +# Default to disk providing /, but let users override with MONITORED_DISK +[ -z "$MONITORED_DISK" ] && MP="/" || MP="$MONITORED_DISK" +case $MP in + /dev/*) disk="$MP" ;; + *) disk=$(grep -m 1 " $MP " /etc/mtab | sed -e "s: .*$::") ;; +esac +disk=$(echo "$disk" | sed -e "s: .*$::" -e "s:^.*/::" -e "s:[0-9]*$::") if [ "$1" = "--detail" ]; then - if [ -x /usr/bin/iostat ]; then + if which iostat >/dev/null; then iostat -d -m -h else echo "Please install iostat if you want detailed information on your disk throughput"