From 8bac2133e2795c90898db82dad2dcae4f39b80bb Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Wed, 17 Jun 2009 15:23:04 -0500 Subject: [PATCH] remove old references to disk_used, disk_available Signed-off-by: Dustin Kirkland --- bin/{disk_available => disk} | 9 ++++----- bin/disk_used | 34 ---------------------------------- byobu-config | 3 +-- byobu-status | 2 +- debian/changelog | 6 +++++- profiles/common | 4 ++-- profiles/profile.skel | 2 +- rpm/byobu.spec | 3 +-- 8 files changed, 15 insertions(+), 48 deletions(-) rename bin/{disk_available => disk} (82%) delete mode 100755 bin/disk_used diff --git a/bin/disk_available b/bin/disk similarity index 82% rename from bin/disk_available rename to bin/disk index b39fdfb9..2cb7eaa2 100755 --- a/bin/disk_available +++ b/bin/disk @@ -24,11 +24,10 @@ if [ "$1" = "--detail" ]; then exit 0 fi -. "$HOME/.$PKG/status" 2>/dev/null || true -[ "$disk_used" = "1" ] && comma="," || whitespace=" " - # Default to /, but let users override [ -r "$HOME/.$PKG/disk" ] && MP=`cat "$HOME/.$PKG/disk"` || MP="/" +case $MP in + /dev/*) MP=`grep "$MP" /proc/mounts | awk '{print $2}'` ;; +esac -d=`df -h -P "$MP" | tail -n 1 | awk '{print $2}'` -printf "\005{= MW}%sB%s\005{-}%s" "$d" "$comma" "$whitespace" +df -h -P "$MP" | tail -n 1 | awk '{printf "\005{= MW}%sB,%s\005{-}", $2, $5}' diff --git a/bin/disk_used b/bin/disk_used deleted file mode 100755 index 3a4d217a..00000000 --- a/bin/disk_used +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -e -# -# disk_used: print the current disk usage -# Copyright (C) 2008 Canonical Ltd. -# -# Authors: Dustin Kirkland -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, version 3 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -PKG="byobu" - -if [ "$1" = "--detail" ]; then - df -h -P - exit 0 -fi - -. "$HOME/.$PKG/status" 2>/dev/null || true -[ "$date" = "1" ] && trailer=" " - -# Default to /, but let users override -[ -r "$HOME/.$PKG/disk" ] && MP=`cat "$HOME/.$PKG/disk"` || MP="/" - -used=`df -h -P "$MP" | tail -n 1 | sed "s/%.*$/%/" | sed "s/^.* //"` -printf "\005{= MW}%s\005{-}%s" "$used" "$trailer" diff --git a/byobu-config b/byobu-config index 64993b0a..aa18e785 100755 --- a/byobu-config +++ b/byobu-config @@ -255,8 +255,7 @@ def readstatus(): status["cpu_count"]=1 status["cpu_freq"]=1 status["date"]=1 - status["disk_available"]=0 - status["disk_used"]=0 + status["disk"]=0 status["ec2_cost"]=0 status["hostname"]=0 status["ip_address"]=0 diff --git a/byobu-status b/byobu-status index 1b16f87f..4e9ba248 100755 --- a/byobu-status +++ b/byobu-status @@ -74,7 +74,7 @@ case "$P" in [ "$x" = "0" ] && exit 0 ;; # default = off, user must override to turn on - arch|battery|disk_available|disk_used|ec2_cost|hostname|ip_address|mail|network|processes|users|temp_c|temp_f|whoami|wifi_quality) + arch|battery|disk|ec2_cost|hostname|ip_address|mail|network|processes|users|temp_c|temp_f|whoami|wifi_quality) [ "$x" = "1" ] || exit 0 ;; --detail) diff --git a/debian/changelog b/debian/changelog index 8f2a7874..4304ec2b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -37,6 +37,10 @@ byobu (2.12) unreleased; urgency=low improvement * bin/network: pull network bytes directly from /proc/net/dev, performance improvement + * bin/disk, bin/disk_used, profiles/common, profiles/profile.skel: + collapse disk usage down to a single status script for performance, + support disk partitions as well as mountpoints in ~/.byobu/disk, + LP: #388053 * byobu-config: have ESC be a hotkey for 'cancel', LP: #373473 @@ -50,7 +54,7 @@ byobu (2.12) unreleased; urgency=low profiles/profile.skel, rpm/byobu.spec: add a mail status notification, LP: #387936 - -- Dustin Kirkland Wed, 17 Jun 2009 14:55:33 -0500 + -- Dustin Kirkland Wed, 17 Jun 2009 15:20:30 -0500 byobu (2.11-0ubuntu1) karmic; urgency=low diff --git a/profiles/common b/profiles/common index 277cb179..978fdc2e 100644 --- a/profiles/common +++ b/profiles/common @@ -50,8 +50,8 @@ backtick 119 10 10 byobu-status wifi_quality backtick 120 86400 86400 byobu-status date backtick 121 86400 86400 byobu-status time backtick 122 600 600 byobu-status ip_address -backtick 123 86400 86400 byobu-status disk_available -backtick 124 30 30 byobu-status disk_used +backtick 123 30 30 byobu-status disk +backtick 124 86400 86400 byobu-status true backtick 125 30 30 byobu-status temp_c backtick 126 30 30 byobu-status temp_f backtick 127 10 10 byobu-status mail diff --git a/profiles/profile.skel b/profiles/profile.skel index d86acc99..833d6f0e 100644 --- a/profiles/profile.skel +++ b/profiles/profile.skel @@ -26,7 +26,7 @@ source /usr/share/byobu/profiles/common caption always "%{kW}%?%-Lw%?%{bw}%n*%f %t%?(%u)%?%{kW}%?%+Lw%? %= %{= Wk}%110`%109`%122`%111`" # Status string, last line -hardstatus string '%99`%{= Wk} %100`%112`%= %102`%101`%127`%114`%115`%108`%125`%126`%113`%119`%117`%116`%106`%104`%103`%105`%107`%123`%124`%120`%121`' +hardstatus string '%99`%{= Wk} %100`%112`%= %102`%101`%127`%114`%115`%108`%125`%126`%113`%119`%117`%116`%106`%104`%103`%105`%107`%123`%120`%121`' # NOTE: Older version of screen have an arbitrary limit of only being able # to change colors 16 times in this 'hardstatus string'. diff --git a/rpm/byobu.spec b/rpm/byobu.spec index c05a4de3..55deb022 100644 --- a/rpm/byobu.spec +++ b/rpm/byobu.spec @@ -101,8 +101,7 @@ rm -rf $RPM_BUILD_ROOT /usr/lib/byobu/cpu_count /usr/lib/byobu/cpu_freq /usr/lib/byobu/date -/usr/lib/byobu/disk_available -/usr/lib/byobu/disk_used +/usr/lib/byobu/disk /usr/lib/byobu/ec2_cost /usr/lib/byobu/hostname /usr/lib/byobu/ip_address