usr/lib/byobu/disk_io: improve MONITORED_DISK overriding

This commit is contained in:
Dustin Kirkland 2010-04-26 18:25:50 -05:00
commit 0536f042d2
2 changed files with 9 additions and 7 deletions

1
debian/changelog vendored
View file

@ -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 <kirkland@ubuntu.com> Thu, 22 Apr 2010 12:31:20 -0500

View file

@ -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"