diff --git a/debian/changelog b/debian/changelog index ac4178a5..60d394d8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -37,6 +37,16 @@ byobu (4.30) unreleased; urgency=low * usr/bin/byobu-config: - migrate to toggling on/off the list of status items - fix initial seeding of status config + * experimental/byobu-aggregate-status, usr/bin/byobu-status, + usr/lib/byobu/logo, usr/lib/byobu/Makefile.am, + usr/lib/byobu/mem_available => usr/lib/byobu/memory, + usr/lib/byobu/mem_used, usr/lib/byobu/.shutil, + usr/share/byobu/status/status, usr/share/man/man1/byobu.1: + - drop experimental code, no longer necessary + - test non-zero cache file + - combine mem_* to memory + - decrease raid status frequency + - add trailing space to logo -- Dustin Kirkland Thu, 11 Aug 2011 10:31:31 -0500 diff --git a/experimental/byobu-aggregate-status b/experimental/byobu-aggregate-status deleted file mode 100755 index 08ae0831..00000000 --- a/experimental/byobu-aggregate-status +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/sh - -PKG="byobu" - -hput() { - eval "$1""$2"='$3' -} - -hget() { - eval echo '${'"$1$2"'#hash}' -} - - -hput freq apport 67 -hput freq arch 9999999 -hput freq battery 61 -hput freq color 9999999 -hput freq cpu_count 5 -hput freq cpu_freq 2 -hput freq cpu_temp 19 -hput freq custom 5 -hput freq date 28793 -hput freq disk 13 -hput freq disk_io 3 -hput freq ec2_cost 601 -hput freq fan_speed 23 -hput freq hostname 607 -hput freq ip_address 127 -hput freq load_average 2 -hput freq logo 9999999 -hput freq mail 5 -hput freq mem_available 47 -hput freq mem_used 13 -hput freq menu 9999999 -hput freq network 3 -hput freq notify_osd 0 -hput freq processes 7 -hput freq raid 7 -hput freq rcs_cost 613 -hput freq reboot_required 5 -hput freq release 599 -hput freq services 53 -hput freq swap 19 -hput freq time 9999999 -hput freq time_binary 23 -hput freq time_utc 11 -hput freq trash 9999999 -hput freq updates_available 7 -hput freq uptime 29 -hput freq users 11 -hput freq whoami 86029 -hput freq wifi_quality 17 - -# Update -NOW=$(date +%s) -for i in /usr/lib/$PKG/*; do - j=${i##*/} - #byobu-status "$j" > "$BYOBU_RUN_DIR/$j.status" - CACHE="$BYOBU_RUN_DIR/$j.status" - [ -r "$CACHE.last" ] && read lastrun < "$CACHE.last" || lastrun=0 - freq=$(hget freq $j) - expiration=$(($lastrun+$freq)) - if [ $NOW -ge $expiration ]; then - byobu-status "$j" > "$CACHE" 2>/dev/null - echo "${NOW}" > "$CACHE.last" - fi -done - -# Print -sed -e ':a;N;$!ba;s/\n//g' "$BYOBU_RUN_DIR/"*.status > "$BYOBU_RUN_DIR/status" - -# vi: syntax=sh ts=4 noexpandtab diff --git a/usr/bin/byobu-status b/usr/bin/byobu-status index 09531612..f0058095 100755 --- a/usr/bin/byobu-status +++ b/usr/bin/byobu-status @@ -49,7 +49,9 @@ get_status() { "__$1" > "$cachepath" echo "$NOW" > "$lastpath" fi - IFS= read line < "$cachepath"; printf "$line" + if [ -s "$cachepath" ]; then + IFS= read line < "$cachepath"; printf "$line" + fi } case "$1" in diff --git a/usr/lib/byobu/.shutil b/usr/lib/byobu/.shutil index 30392b21..dc13c3a5 100755 --- a/usr/lib/byobu/.shutil +++ b/usr/lib/byobu/.shutil @@ -232,13 +232,12 @@ status_freq() { load_average) _RET=2 ;; logo) _RET=9999999 ;; mail) _RET=5 ;; - mem_available) _RET=47 ;; - mem_used) _RET=13 ;; + memory) _RET=13 ;; menu) _RET=9999999 ;; network) _RET=3 ;; notify_osd) _RET=9999999 ;; processes) _RET=7 ;; - raid) _RET=7 ;; + raid) _RET=59 ;; rcs_cost) _RET=613 ;; reboot_required) _RET=5 ;; release) _RET=599 ;; diff --git a/usr/lib/byobu/Makefile.am b/usr/lib/byobu/Makefile.am index 9ee94913..ea20c203 100644 --- a/usr/lib/byobu/Makefile.am +++ b/usr/lib/byobu/Makefile.am @@ -1,3 +1,3 @@ libdirdir = $(prefix)/lib/@PACKAGE@ -libdir_SCRIPTS = apport arch battery cpu_count cpu_freq cpu_temp color custom date disk disk_io ec2_cost fan_speed hostname ip_address load_average logo mail mem_available mem_used menu network .notify_osd notify_osd processes raid rcs_cost reboot_required release services swap time time_binary time_utc trash updates_available uptime users whoami wifi_quality .common .constants .dirs .shutil +libdir_SCRIPTS = apport arch battery cpu_count cpu_freq cpu_temp color custom date disk disk_io ec2_cost fan_speed hostname ip_address load_average logo mail memory menu network .notify_osd notify_osd processes raid rcs_cost reboot_required release services swap time time_binary time_utc trash updates_available uptime users whoami wifi_quality .common .constants .dirs .shutil diff --git a/usr/lib/byobu/logo b/usr/lib/byobu/logo index debff1b5..ced229ee 100755 --- a/usr/lib/byobu/logo +++ b/usr/lib/byobu/logo @@ -116,6 +116,7 @@ __logo() { $MARKUP && printf "$(color b k W)%s$(color -)" "$logo" || printf " $logo " ;; esac + printf " " } # vi: syntax=sh ts=4 noexpandtab diff --git a/usr/lib/byobu/mem_available b/usr/lib/byobu/mem_available deleted file mode 100755 index ffb01cf5..00000000 --- a/usr/lib/byobu/mem_available +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh -e -# -# mem_available: grab the current memory and usage -# -# Copyright (C) 2008 Canonical Ltd. -# Copyright (C) 2011 Dustin Kirkland -# -# 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 . - -__mem_available_detail() { - free -} - -__mem_available() { - local mem_used comma whitespace unit mem name - [ "$mem_used" = "1" ] && comma="," || whitespace=" " - read name mem unit < /proc/meminfo - if [ $mem -ge 1048576 ]; then - fpdiv "$mem" 1048567 1 - mem=${_RET} - unit="GB" - elif [ $mem -ge 1024 ]; then - fpdiv "$mem" 1024 0 - mem=${_RET} - unit="MB" - else - mem="$mem" - unit="KB" - fi - color b g W; printf "%s" "$mem"; color -; color g W; printf "%s%s" "$unit" "$comma"; color -; printf "%s" "$whitespace" -} - -# vi: syntax=sh ts=4 noexpandtab diff --git a/usr/lib/byobu/mem_used b/usr/lib/byobu/memory similarity index 60% rename from usr/lib/byobu/mem_used rename to usr/lib/byobu/memory index c6d50818..f831563c 100755 --- a/usr/lib/byobu/mem_used +++ b/usr/lib/byobu/memory @@ -1,6 +1,6 @@ #!/bin/sh -e # -# mem_used: grab the current memory usage +# mem_available: grab the current memory and usage # # Copyright (C) 2008 Canonical Ltd. # Copyright (C) 2011 Dustin Kirkland @@ -19,16 +19,11 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -__mem_used_detail() { - cat /proc/meminfo +__memory() { + free } -__mem_used() { - # originally, this script did: - # f=$(free | awk '/buffers\/cache:/ {printf "%.0f", 100*$3/($3 + $4)}') - # this method is more dependent on /proc/meminfo, but uses the same formula - # for deriving the output of 'free' that is used in procps 'free.c' - # kb_main_free, kb_main_total, kb_main_buffers, kb_main_cached +__memory() { local free="" total="" buffers="" cached="" local kb_main_used=0 buffers_plus_cached=0 fo_buffers=0 fo_cached=0 while read tok val unit; do @@ -40,14 +35,25 @@ __mem_used() { esac [ -n "${free}" -a -n "${total}" -a -n "${buffers}" -a -n "${cached}" ] && break; done < /proc/meminfo - kb_main_used=$(($total-$free)) - buffers_plus_cached=$(($buffers+$cached)) - # "free output" buffers and cache (output from 'free') - fo_buffers=$(($kb_main_used - $buffers_plus_cached)) - fo_cached=$(($kb_main_free + $buffers_plus_cached)) - fpdiv $((100*${fo_buffers})) "${total}" 0; - f=${_RET} - color b g W; printf "%s" "$f"; color -; color g W; printf "%s" "$PCT"; color -- + kb_main_used=$(($total-$free)) + buffers_plus_cached=$(($buffers+$cached)) + # "free output" buffers and cache (output from 'free') + fo_buffers=$(($kb_main_used - $buffers_plus_cached)) + fo_cached=$(($kb_main_free + $buffers_plus_cached)) + fpdiv $((100*${fo_buffers})) "${total}" 0; + f=${_RET} + if [ $total -ge 1048576 ]; then + fpdiv "$total" 1048567 1 + total=${_RET} + unit="GB" + elif [ $total -ge 1024 ]; then + fpdiv "$total" 1024 0 + total=${_RET} + unit="MB" + else + unit="KB" + fi + color b g W; printf "%s" "$total"; color -; color g W; printf "%s," "$unit"; color -; color b g W; printf "%s" "$f"; color -; color g W; printf "%s" "$PCT"; color -- } # vi: syntax=sh ts=4 noexpandtab diff --git a/usr/share/byobu/status/status b/usr/share/byobu/status/status index d83d30b3..2a55ced4 100644 --- a/usr/share/byobu/status/status +++ b/usr/share/byobu/status/status @@ -24,8 +24,8 @@ screen_upper_left="color" screen_upper_right="color whoami hostname ip_address menu" screen_lower_left="color logo release #arch" -screen_lower_right="color network #disk_io custom raid reboot_required updates_available #apport #services #mail users uptime #ec2_cost #rcs_cost #fan_speed #cpu_temp battery wifi_quality #processes load_average cpu_count cpu_freq mem_available mem_used #swap #disk #time_utc date time" +screen_lower_right="color network #disk_io custom raid reboot_required updates_available #apport #services #mail users uptime #ec2_cost #rcs_cost #fan_speed #cpu_temp battery wifi_quality #processes load_average cpu_count cpu_freq memory #swap #disk #time_utc date time" # Tmux has one status line, with 2 halves for status tmux_left="logo release #arch" -tmux_right="network #disk_io custom raid reboot_required updates_available #apport #services #mail users uptime #ec2_cost #rcs_cost #fan_speed #cpu_temp battery wifi_quality #processes load_average cpu_count cpu_freq mem_available mem_used #swap #disk #whoami #hostname #ip_address #time_utc date time" +tmux_right="network #disk_io custom raid reboot_required updates_available #apport #services #mail users uptime #ec2_cost #rcs_cost #fan_speed #cpu_temp battery wifi_quality #processes load_average cpu_count cpu_freq memory #swap #disk #whoami #hostname #ip_address #time_utc date time" diff --git a/usr/share/man/man1/byobu.1 b/usr/share/man/man1/byobu.1 index bda4841b..152e831c 100644 --- a/usr/share/man/man1/byobu.1 +++ b/usr/share/man/man1/byobu.1 @@ -57,9 +57,7 @@ Note that BYOBU_CONFIG_DIR=\fI$HOME/.byobu\fP. \fBmail\fP \- system mail for the current user; the letter '[M]' is displayed in the lower bar toward the left in black text on a grey background -\fBmem_available\fP \- total memory available in the system; displayed in the lower bar toward the right in white text on a green background - -\fBmem_used\fP \- total memory used in the system as a percentage of the total memory available; displayed in the lower bar toward the right in white text on a green background with a trailing '%' sign +\fBmemory\fP \- total memory available and used in the system; displayed in the lower bar toward the right in white text on a green background \fBmenu\fP \- a simple indicator directing new users to use the F9 keybinding to access the byobu menu