* bin/cpu_count, bin/cpu_freq, bin/disk_available, bin/disk_used,

bin/ec2_cost, bin/ip_address, bin/load_average, bin/mem_available,
    bin/mem_used, bin/network_down, bin/network_up, bin/reboot_required,
    bin/temp_c, bin/temp_f, bin/updates_available, bin/wifi_quality,
    byobu-config, byobu-export, byobu-status, byobu.1, debian/control,
    doc/help.txt, profiles/common, rpm/byobu.spec: massive changeset, moving
    all status scripts from *-* to *_*; this allows us to source the
    ~/.byobu/status file, rather than grepping through it for configuration
    information, yielding significant performance improvements, LP: #386546


Signed-off-by: Dustin Kirkland <kirkland@canonical.com>
This commit is contained in:
Dustin Kirkland 2009-06-16 14:46:26 -05:00
commit 7a52dff182
25 changed files with 114 additions and 98 deletions

View file

@ -1,6 +1,6 @@
#!/bin/sh -e
#
# cpu-count: count cpu's on a systems
# cpu_count: count cpu's on a systems
# Copyright (C) 2008 Canonical Ltd.
#
# Authors: Dustin Kirkland <kirkland@canonical.com>

View file

@ -1,6 +1,6 @@
#!/bin/sh -e
#
# cpu-freq: calculate current cpu frequency
# cpu_freq: calculate current cpu frequency
# Copyright (C) 2008 Canonical Ltd.
#
# Authors: Dustin Kirkland <kirkland@canonical.com>

View file

@ -1,6 +1,6 @@
#!/bin/sh -e
#
# disk-available: print the current disk space available
# disk_available: print the current disk space available
# Copyright (C) 2008 Canonical Ltd.
#
# Authors: Dustin Kirkland <kirkland@canonical.com>
@ -27,7 +27,7 @@ fi
comma=
whitespace=
if [ -r "$HOME/.$PKG/status" ]; then
grep -qs "^disk-used=1$" "$HOME/.$PKG/status" && comma="," || whitespace=" "
grep -qs "^disk_used=1$" "$HOME/.$PKG/status" && comma="," || whitespace=" "
else
comma=","
fi

View file

@ -1,6 +1,6 @@
#!/bin/sh -e
#
# disk-used: print the current disk usage
# disk_used: print the current disk usage
# Copyright (C) 2008 Canonical Ltd.
#
# Authors: Dustin Kirkland <kirkland@canonical.com>

View file

@ -1,6 +1,6 @@
#!/bin/sh
#
# ec2-cost: approximate EC2 cost (USD) of the current instance
# ec2_cost: approximate EC2 cost (USD) of the current instance
# Copyright (C) 2008 Canonical Ltd.
#
# Authors: Dustin Kirkland <kirkland@canonical.com>

View file

@ -1,6 +1,6 @@
#!/bin/sh -e
#
# ip-address - report a host's ip-address
# ip_address - report a host's ip address
# Copyright (C) 2008 Canonical Ltd.
#
# Authors: Dustin Kirkland <kirkland@canonical.com>

View file

@ -1,6 +1,6 @@
#!/bin/sh -e
#
# load-average: grab the current load average
# load_average: grab the current load average
# Copyright (C) 2008 Canonical Ltd.
#
# Authors: Dustin Kirkland <kirkland@canonical.com>

View file

@ -1,6 +1,6 @@
#!/bin/sh -e
#
# mem-available: grab the current memory available
# mem_available: grab the current memory available
# Copyright (C) 2008 Canonical Ltd.
#
# Authors: Dustin Kirkland <kirkland@canonical.com>
@ -27,7 +27,7 @@ fi
comma=
whitespace=
if [ -r "$HOME/.$PKG/status" ]; then
grep -qs "^mem-used=1$" "$HOME/.$PKG/status" && comma="," || whitespace=" "
grep -qs "^mem_used=1$" "$HOME/.$PKG/status" && comma="," || whitespace=" "
else
comma=","
fi

View file

@ -1,6 +1,6 @@
#!/bin/sh -e
#
# mem-used: grab the current memory used
# mem_used: grab the current memory used
# Copyright (C) 2008 Canonical Ltd.
#
# Authors: Dustin Kirkland <kirkland@canonical.com>

View file

@ -1,6 +1,6 @@
#!/bin/sh -e
#
# network-down: calculate the network receive rate
# network_down: calculate the network receive rate
# Copyright (C) 2008 Canonical Ltd.
#
# Authors: Dustin Kirkland <kirkland@canonical.com>
@ -19,7 +19,7 @@
PKG="byobu"
cache="/var/run/screen/S-$USER/$PKG.network-down"
cache="/var/run/screen/S-$USER/$PKG.network_down"
unit="kB/s"
# Allow interface overrides in configuration directory

View file

@ -1,6 +1,6 @@
#!/bin/sh -e
#
# network-up: calculate the network transmit rate
# network_up: calculate the network transmit rate
# Copyright (C) 2008 Canonical Ltd.
#
# Authors: Dustin Kirkland <kirkland@canonical.com>
@ -19,7 +19,7 @@
PKG="byobu"
cache="/var/run/screen/S-$USER/$PKG.network-up"
cache="/var/run/screen/S-$USER/$PKG.network_up"
unit="kB/s"
# Allow interface overrides in configuration directory

View file

@ -1,6 +1,6 @@
#!/bin/sh -e
#
# reboot-required: determine if a reboot is required
# reboot_required: determine if a reboot is required
# Copyright (C) 2008 Canonical Ltd.
#
# Authors: Dustin Kirkland <kirkland@canonical.com>

View file

@ -1,6 +1,6 @@
#!/bin/sh -e
#
# temp-c: cpu temperature in celsius
# temp_c: cpu temperature in celsius
# Copyright (C) 2008 Canonical Ltd.
#
# Authors: Dustin Kirkland <kirkland@canonical.com>

View file

@ -1,6 +1,6 @@
#!/bin/sh -e
#
# temp-f: cpu temperature in farenheit
# temp_f: cpu temperature in farenheit
# Copyright (C) 2008 Canonical Ltd.
#
# Authors: Dustin Kirkland <kirkland@canonical.com>

View file

@ -1,6 +1,6 @@
#!/bin/sh -e
#
# updates-available: calculate and cache the number of updates available
# updates_available: calculate and cache the number of updates available
# Copyright (C) 2008 Canonical Ltd.
#
# Authors: Dustin Kirkland <kirkland@canonical.com>

View file

@ -1,6 +1,6 @@
#!/bin/sh -e
#
# wifi-quality: display wifi signal quality
# wifi_quality: display wifi signal quality
# Copyright (C) 2008 Canonical Ltd.
#
# Authors: Dustin Kirkland <kirkland@canonical.com>

View file

@ -247,32 +247,32 @@ def readstatus():
status={}
status["arch"]=0
status["battery"]=0
status["cpu-count"]=1
status["cpu-freq"]=1
status["cpu_count"]=1
status["cpu_freq"]=1
status["date"]=1
status["disk-available"]=0
status["disk-used"]=0
status["ec2-cost"]=0
status["disk_available"]=0
status["disk_used"]=0
status["ec2_cost"]=0
status["hostname"]=0
status["ip-address"]=0
status["load-average"]=1
status["ip_address"]=0
status["load_average"]=1
status["logo"]=1
status["mem-available"]=1
status["mem-used"]=1
status["mem_available"]=1
status["mem_used"]=1
status["menu"]=1
status["network-down"]=0
status["network-up"]=0
status["network_down"]=0
status["network_up"]=0
status["processes"]=0
status["reboot-required"]=1
status["reboot_required"]=1
status["release"]=1
status["temp-c"]=0
status["temp-f"]=0
status["temp_c"]=0
status["temp_f"]=0
status["time"]=1
status["users"]=0
status["updates-available"]=1
status["updates_available"]=1
status["uptime"]=1
status["whoami"]=0
status["wifi-quality"]=0
status["wifi_quality"]=0
if os.path.exists(HOME+'/.'+PKG+'/status'):
f=open(HOME+'/.'+PKG+'/status', 'r')
for line in f.readlines():

View file

@ -91,7 +91,7 @@ status_config() {
# Enable user@host in its place
for i in $(ls /usr/lib/$PKG/); do
case "$i" in
cpu-count|cpu-freq|date|hostname|load-average|logo|mem-available|mem-used|reboot-required|release|time|updates-available|whoami)
cpu_count|cpu_freq|date|hostname|load_average|logo|mem_available|mem_used|reboot_required|release|time|updates_available|whoami)
echo "$i=1"
;;
*)

View file

@ -47,6 +47,7 @@ migrate() {
# If the old config dir exists, but the new one doesn't, provide a migration mechanism
[ -d "$HOME/.$OLDPKG" -a ! -d "$HOME/.$PKG" ] && migrate
# Allow for local status scripts
if [ -d "$HOME/.$PKG/bin" ]; then
DIR="$HOME/.$PKG/bin"
elif [ -d "/usr/lib/$PKG" ]; then
@ -55,16 +56,25 @@ else
exit 1
fi
# Source status file
if [ -r "$HOME/.$PKG/status" ]; then
if ! . "$HOME/.$PKG/status" ; then
# If sourcing fails, try replacing - with _
sed -i "s/-/_/g" "$HOME/.$PKG/status"
fi
fi
P="$1"
eval x=\$$P
case "$P" in
# default = on, user must override to turn off
cpu-count|cpu-freq|date|load-average|logo|mem-available|mem-used|menu|reboot-required|release|time|updates-available|uptime)
grep -qs -m1 "^$P=0$" "$HOME/.$PKG/status" && exit 0
cpu_count|cpu_freq|date|load_average|logo|mem_available|mem_used|menu|reboot_required|release|time|updates_available|uptime)
[ "$x" = "0" ] && exit 0
;;
# default = off, user must override to turn on
arch|battery|disk-available|disk-used|ec2-cost|hostname|ip-address|network-down|network-up|processes|users|temp-c|temp-f|whoami|wifi-quality)
grep -qs -m1 "^$P=1$" "$HOME/.$PKG/status" || exit 0
arch|battery|disk_available|disk_used|ec2_cost|hostname|ip_address|network_down|network_up|processes|users|temp_c|temp_f|whoami|wifi_quality)
[ "$x" = "1" ] || exit 0
;;
--detail)
VER=

30
byobu.1
View file

@ -13,47 +13,47 @@ byobu \- wrapper script for seeding a user's byobu configuration and launching s
\fBbattery\fP \- battery information; display on the lower bar toward the right; |\-| indicates discharging, |+| indicates charging, |=| indicates fully charged; when charging or discharging, the current battery capacity as a percentage is displayed; the colours green, yellow, and red are used to give further indication of the battery's charge state
\fBcpu-count\fP \- the number of cpu's or cores on the system; displayed in the lower bar toward the right in the default text color on the default background, followed by a trailing 'x'
\fBcpu_count\fP \- the number of cpu's or cores on the system; displayed in the lower bar toward the right in the default text color on the default background, followed by a trailing 'x'
\fBcpu-freq\fP \- the current frequency of the cpu in GHz; displayed in the lower bar toward the right in white text on a light blue background
\fBcpu_freq\fP \- the current frequency of the cpu in GHz; displayed in the lower bar toward the right in white text on a light blue background
\fBdate\fP \- the system date in YYYY-MM-DD formate; displayed in the lower on the far right in the default text color on the default background
\fBdisk-available\fP \- disk space available on / directory; displayed in the lower bar on the far right in white text on a light purple background; override the default directory by specifying an alternate mount point in \fI$HOME/.byobu/disk\fP
\fBdisk_available\fP \- disk space available on / directory; displayed in the lower bar on the far right in white text on a light purple background; override the default directory by specifying an alternate mount point in \fI$HOME/.byobu/disk\fP
\fBmem-used\fP \- disk space used on / directory as a percentage of the total space available on /; displayed in the lower bar on the far right in white text on a light purple background with a trailing '%' sign; override the default directory by specifying an alternate mount point in \fI$HOME/.byobu/disk\fP
\fBmem_used\fP \- disk space used on / directory as a percentage of the total space available on /; displayed in the lower bar on the far right in white text on a light purple background with a trailing '%' sign; override the default directory by specifying an alternate mount point in \fI$HOME/.byobu/disk\fP
\fBec2-cost\fP \- an estimation of the cost of the current boot of the system in terms of the Amazon EC2 billing model; displayed in the lower bar toward the right in green text on a grey background; there is a leading '~' to indicate that this is an estimation, and the monetary units are US Dollars '$'
\fBec2_cost\fP \- an estimation of the cost of the current boot of the system in terms of the Amazon EC2 billing model; displayed in the lower bar toward the right in green text on a grey background; there is a leading '~' to indicate that this is an estimation, and the monetary units are US Dollars '$'
\fBhostname\fP \- the hostname of the system; displayed in the upper bar on the far right in bold black text on a grey background; there is a leading '@' symbol if the username status is also enabled
\fBip-address\fP \- the ip address of the system in dotted decimal form; displayed in the upper bar on the far right in bold black text on a grey background
\fBip_address\fP \- the ip address of the system in dotted decimal form; displayed in the upper bar on the far right in bold black text on a grey background
\fBload-average\fP \- the system load average over the last 1 minute; displayed in the lower bar toward the right in black text on a yellow background
\fBload_average\fP \- the system load average over the last 1 minute; displayed in the lower bar toward the right in black text on a yellow background
\fBlogo\fP \- an approximation of the current operating system's logo; displayed in the lower bar on the far left; you may customize this logo by setting a chosen logo in \fI$HOME/.byobu/logo\fP, or you may manually choose your operating system by setting this in \fI$HOME/.byobu/distro\fP
\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_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
\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
\fBmenu\fP \- a simple indicator directing new users to use the F9 keybinding to access the byobu menu
\fBnetwork-down\fP \- instaneous download bandwidth in kB/s over the last 2 seconds; displayed in the lower bar toward the right in white text on a purple background with a leading 'v' sign indicating 'down'; override the default interface by specifying an alternate interface in \fI$HOME/.byobu/network\fP
\fBnetwork_down\fP \- instaneous download bandwidth in kB/s over the last 2 seconds; displayed in the lower bar toward the right in white text on a purple background with a leading 'v' sign indicating 'down'; override the default interface by specifying an alternate interface in \fI$HOME/.byobu/network\fP
\fBnetwork-up\fP \- instantaneous upload bandwidth in kB/s over the last 2 seconds; displayed in the lower bar toward the right in white text on a purple background with a leading '^' sign indicating 'up'; override the default interface by specifying an alternate interface in \fI$HOME/.byobu/network\fP
\fBnetwork_up\fP \- instantaneous upload bandwidth in kB/s over the last 2 seconds; displayed in the lower bar toward the right in white text on a purple background with a leading '^' sign indicating 'up'; override the default interface by specifying an alternate interface in \fI$HOME/.byobu/network\fP
\fBprocesses\fP \- total number of processes running on the system; displayed in the lower bar in black text on a dark yellow background with a trailing '&' indicating 'background processes'
\fBreboot-required\fP \- symbol present if a reboot is required following a system update; displayed in the lower bar white text on a blue background by the symbol '(@)' which visually looks like a 'cycle your machine' logo
\fBreboot_required\fP \- symbol present if a reboot is required following a system update; displayed in the lower bar white text on a blue background by the symbol '(@)' which visually looks like a 'cycle your machine' logo
\fBrelease\fP \- distribution and version information about the release running on the current system as reported by \fBlsb_release(1)\fP or \fI/etc/issue\fP; displayed in the lower bar in bold black text toward the left on a grey background
\fBtemp\-c\fP, \fBtemp\-f\fP \- the cpu temperature in celsius or farenheit; displayed in the lower bar toward the right in yellow text on a black background
\fBtemp_c\fP, \fBtemp_f\fP \- the cpu temperature in celsius or farenheit; displayed in the lower bar toward the right in yellow text on a black background
\fBtime\fP \- the system time in HH:MM:SS format; displayed in the lower bar on the far right in the default text and default background colors
\fBupdates-available\fP \- the number of updates available on the system; displayed in the lower bar toward the right in white text on a red background with a trailing '!' sign; if any updates are marked 'security updates', then there will be a total of two trailing exclamation points, '!!'
\fBupdates_available\fP \- the number of updates available on the system; displayed in the lower bar toward the right in white text on a red background with a trailing '!' sign; if any updates are marked 'security updates', then there will be a total of two trailing exclamation points, '!!'
\fBuptime\fP \- the total system uptime since last boot; displayed in the lower bar toward the right in blue text on a grey background
@ -61,7 +61,7 @@ byobu \- wrapper script for seeding a user's byobu configuration and launching s
\fBwhoami\fP \- the name of the user who owns the screen session; displayed in the upper bar toward the far right in bold black text on a grey background
\fBwifi-quality\fP \- the connection rate and signal quality of the wifi connection; displayed in the lower bar toward the right in black text on a cyan background; the connection rate is in 'Mb/s' and the signal quality is as a percentage with a trailing '%'
\fBwifi_quality\fP \- the connection rate and signal quality of the wifi connection; displayed in the lower bar toward the right in black text on a cyan background; the connection rate is in 'Mb/s' and the signal quality is as a percentage with a trailing '%'
\fBwindows\fP \- each open window in the screen session appears is displayed in the upper bar toward the far right in blue text on a grey background

12
debian/changelog vendored
View file

@ -1,8 +1,16 @@
byobu (2.12) unreleased; urgency=low
* UNRELEASED
* bin/cpu_count, bin/cpu_freq, bin/disk_available, bin/disk_used,
bin/ec2_cost, bin/ip_address, bin/load_average, bin/mem_available,
bin/mem_used, bin/network_down, bin/network_up, bin/reboot_required,
bin/temp_c, bin/temp_f, bin/updates_available, bin/wifi_quality,
byobu-config, byobu-export, byobu-status, byobu.1, debian/control,
doc/help.txt, profiles/common, rpm/byobu.spec: massive changeset, moving
all status scripts from *-* to *_*; this allows us to source the
~/.byobu/status file, rather than grepping through it for configuration
information, yielding significant performance improvements, LP: #386546
-- Dustin Kirkland <kirkland@ubuntu.com> Mon, 15 Jun 2009 22:49:37 -0500
-- Dustin Kirkland <kirkland@ubuntu.com> Tue, 16 Jun 2009 14:44:43 -0500
byobu (2.11-0ubuntu1) karmic; urgency=low

4
debian/control vendored
View file

@ -21,8 +21,8 @@ Description: a set of useful profiles and a profile-switcher for GNU screen
These profiles are quite useful on server machines which are not running
a graphical desktop. The 'screen' command provides a number of advanced
features are not necessarily exposed in the default profile. These profiles
provide features such as status bars, clocks, notifiers (reboot-required,
updates-available), etc. The profile-switcher allows users to quickly switch
provide features such as status bars, clocks, notifiers (reboot required,
updates available), etc. The profile-switcher allows users to quickly switch
their .screenrc to any of the available profiles.
.
update-notifier-common provides a more efficient and standard mechanism for

View file

@ -1,8 +1,8 @@
Screen is a powerful program that allows your terminal session to use
multiple windows and retain context among multiple logins.
A task bar at the bottom shows: open windows, OS-version, reboot-req,
updates-available, system-load, cpu-info, memory-info, and date/time.
A task bar at the bottom shows: open windows, OS version, reboot req,
updates available, system load, cpu info, memory info, and date/time.
F2 Create a new window | F6 Detach from the session
F3 Go to the prev window | F7 Enter scrollback mode

View file

@ -28,14 +28,14 @@ msgwait 1
# Define status commands
backtick 99 86400 86400 byobu-status logo
backtick 100 3600 3600 byobu-status release
backtick 101 10 10 byobu-status updates-available
backtick 102 2 2 byobu-status reboot-required
backtick 103 2 2 byobu-status cpu-freq
backtick 104 86400 86400 byobu-status cpu-count
backtick 105 86400 86400 byobu-status mem-available
backtick 106 2 2 byobu-status load-average
backtick 107 2 2 byobu-status mem-used
backtick 108 600 600 byobu-status ec2-cost
backtick 101 10 10 byobu-status updates_available
backtick 102 2 2 byobu-status reboot_required
backtick 103 2 2 byobu-status cpu_freq
backtick 104 86400 86400 byobu-status cpu_count
backtick 105 86400 86400 byobu-status mem_available
backtick 106 2 2 byobu-status load_average
backtick 107 2 2 byobu-status mem_used
backtick 108 600 600 byobu-status ec2_cost
backtick 109 3600 3600 byobu-status hostname
backtick 110 86400 86400 byobu-status whoami
backtick 111 86400 86400 byobu-status menu
@ -44,16 +44,16 @@ backtick 113 30 30 byobu-status battery
backtick 114 10 10 byobu-status users
backtick 115 60 60 byobu-status uptime
backtick 116 2 2 byobu-status processes
backtick 117 2 2 byobu-status network-up
backtick 118 2 2 byobu-status network-down
backtick 119 2 2 byobu-status wifi-quality
backtick 117 2 2 byobu-status network_up
backtick 118 2 2 byobu-status network_down
backtick 119 2 2 byobu-status wifi_quality
backtick 120 86400 86400 byobu-status date
backtick 121 86400 86400 byobu-status time
backtick 122 3600 3600 byobu-status ip-address
backtick 123 86400 86400 byobu-status disk-available
backtick 124 2 2 byobu-status disk-used
backtick 125 30 30 byobu-status temp-c
backtick 126 30 30 byobu-status temp-f
backtick 122 3600 3600 byobu-status ip_address
backtick 123 86400 86400 byobu-status disk_available
backtick 124 2 2 byobu-status disk_used
backtick 125 30 30 byobu-status temp_c
backtick 126 30 30 byobu-status temp_f
hardstatus alwayslastline

View file

@ -27,8 +27,8 @@ byobu includes a set of profiles for the GNU screen window manager.
These profiles are quite useful on server machines which are not running
a graphical desktop. The 'screen' command provides a number of advanced
features are not necessarily exposed in the default profile. These profiles
provide features such as status bars, clocks, notifiers (reboot-required,
updates-available), etc. The profile-switcher allows users to quickly switch
provide features such as status bars, clocks, notifiers (reboot required,
updates available), etc. The profile-switcher allows users to quickly switch
their .screenrc to any of the available profiles.
update-notifier-common provides a more efficient and standard mechanism for
@ -98,34 +98,32 @@ rm -rf $RPM_BUILD_ROOT
/usr/bin/select-screen-profile
/usr/lib/byobu/arch
/usr/lib/byobu/battery
/usr/lib/byobu/cpu-count
/usr/lib/byobu/cpu-freq
/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/ec2-cost
/usr/lib/byobu/disk_available
/usr/lib/byobu/disk_used
/usr/lib/byobu/ec2_cost
/usr/lib/byobu/hostname
/usr/lib/byobu/ip-address
/usr/lib/byobu/load-average
/usr/lib/byobu/ip_address
/usr/lib/byobu/load_average
/usr/lib/byobu/logo
/usr/lib/byobu/mem-available
/usr/lib/byobu/mem-used
/usr/lib/byobu/mem_available
/usr/lib/byobu/mem_used
/usr/lib/byobu/menu
/usr/lib/byobu/network-down
/usr/lib/byobu/network-up
/usr/lib/byobu/network_down
/usr/lib/byobu/network_up
/usr/lib/byobu/processes
/usr/lib/byobu/reboot-required
/usr/lib/byobu/reboot_required
/usr/lib/byobu/release
/usr/lib/byobu/temp-c
/usr/lib/byobu/temp-f
/usr/lib/byobu/temp_c
/usr/lib/byobu/temp_f
/usr/lib/byobu/time
/usr/lib/byobu/updates-available
/usr/lib/byobu/updates_available
/usr/lib/byobu/uptime
/usr/lib/byobu/users
/usr/lib/byobu/whoami
/usr/lib/byobu/wifi-quality
/usr/lib/byobu/disk-available
/usr/lib/byobu/disk-used
/usr/lib/byobu/wifi_quality
/usr/share/locale/es/LC_MESSAGES/byobu.mo
/usr/share/locale/fr/LC_MESSAGES/byobu.mo
/usr/share/byobu/keybindings/common