* usr/lib/byobu/distro, usr/lib/byobu/Makefile.am,

usr/lib/byobu/release, usr/lib/byobu/.shutil,
  usr/share/byobu/status/status, usr/share/man/man1/byobu.1:
  - split the OS distribution name and version to two separate status
    items;  enable the version (but not the name) in the compact tmux
    status line
This commit is contained in:
Dustin Kirkland 2011-09-30 12:10:27 -04:00
commit 521b15bea9
7 changed files with 95 additions and 23 deletions

6
debian/changelog vendored
View file

@ -8,6 +8,12 @@ byobu (4.38) unreleased; urgency=low
- set the pane listing colors
- set the inactive pane to light grey/white
- set the clock color
* usr/lib/byobu/distro, usr/lib/byobu/Makefile.am,
usr/lib/byobu/release, usr/lib/byobu/.shutil,
usr/share/byobu/status/status, usr/share/man/man1/byobu.1:
- split the OS distribution name and version to two separate status
items; enable the version (but not the name) in the compact tmux
status line
-- Dustin Kirkland <kirkland@ubuntu.com> Thu, 29 Sep 2011 14:46:58 -0400

View file

@ -236,6 +236,7 @@ status_freq() {
date) [ "$BYOBU_BACKEND" = "tmux" ] && _RET=1 || _RET=28793 ;;
disk) _RET=13 ;;
disk_io) _RET=3 ;;
distro) _RET=9999999 ;;
ec2_cost) _RET=601 ;;
fan_speed) _RET=23 ;;
hostname) _RET=607 ;;

View file

@ -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 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
libdir_SCRIPTS = apport arch battery cpu_count cpu_freq cpu_temp color custom date disk disk_io distro 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

67
usr/lib/byobu/distro Executable file
View file

@ -0,0 +1,67 @@
#!/bin/sh -e
#
# distro: grab the distro/os
#
# Copyright (C) 2008 Canonical Ltd.
# Copyright (C) 2011 Dustin Kirkland
#
# Authors: Dustin Kirkland <kirkland@ubuntu.com>
#
# 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 <http://www.gnu.org/licenses/>.
__distro_detail() {
lsb_release -a 2>/dev/null
}
__distro() {
local DISTRO="${DISTRO}"
if [ -n "$DISTRO" ]; then
# user defined
true
elif [ -r "/etc/issue" ]; then
# lsb_release is *really* slow; try to use /etc/issue first
local issue
read issue < /etc/issue
case "$issue" in
Ubuntu*)
DISTRO="Ubuntu";
;;
Debian*)
DISTRO="Debian"
;;
*)
# assume first field is what we want
DISTRO="${issue%% *}";
;;
esac
elif command -v lsb_release >/dev/null 2>&1; then
# If lsb_release is available, use it
local r=$(lsb_release -s -d)
case "$r" in
Ubuntu*)
# Use the -d if an Ubuntu LTS
DISTRO="Ubuntu"
;;
*)
# But for other distros the description
# is too long, so build from -i and -r
DISTRO=$(lsb_release -s -i)
;;
esac
else
DISTRO="Byobu"
fi
color bold2; printf "%s" "$DISTRO"; color --
}
# vi: syntax=sh ts=4 noexpandtab

View file

@ -1,6 +1,6 @@
#!/bin/sh -e
#
# release: grab the os/distro release
# release: grab the os/distro release version
#
# Copyright (C) 2008 Canonical Ltd.
# Copyright (C) 2011 Dustin Kirkland
@ -24,48 +24,44 @@ __release_detail() {
}
__release() {
local DISTRO="${DISTRO}" issue ver r i
if [ -n "$DISTRO" ]; then
local RELEASE="${RELEASE}"
if [ -n "$RELEASE" ]; then
# user defined
true
elif [ -r "/etc/issue" ]; then
# lsb_release is *really* slow; try to use /etc/issue first
local issue
read issue < /etc/issue
case "$issue" in
Ubuntu*)
set -- $issue;
DISTRO="$1 $2";
RELEASE="$2";
;;
Debian*)
local ver
read ver < /etc/debian_version
DISTRO="Debian $ver"
;;
*)
# assume first 2 fields are what we want
set -- $issue;
DISTRO="$1 $2";
RELEASE="$ver"
;;
esac
elif command -v lsb_release >/dev/null 2>&1; then
fi
if [ -z "$RELEASE" ] && command -v lsb_release >/dev/null 2>&1; then
# If lsb_release is available, use it
r=$(lsb_release -s -d)
local r=$(lsb_release -s -d)
case "$r" in
Ubuntu*.*.*)
Ubuntu*)
# Use the -d if an Ubuntu LTS
DISTRO="$r"
RELEASE="$r"
;;
*)
# But for other distros the description
# is too long, so build from -i and -r
i=$(lsb_release -s -i)
local i=$(lsb_release -s -i)
r=$(lsb_release -s -r)
DISTRO="$i $r"
RELEASE="$i $r"
;;
esac
else
DISTRO="Byobu"
fi
color bold2; printf "%s" "$DISTRO"; color --
color bold2; printf "%s" "$RELEASE"; color --
}
# vi: syntax=sh ts=4 noexpandtab

View file

@ -25,9 +25,9 @@
# Screen has two status lines, with 4 quadrants for status
screen_upper_left="color"
screen_upper_right="color whoami hostname ip_address menu"
screen_lower_left="color logo release #arch"
screen_lower_left="color logo distro 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 memory #swap #disk #time_utc date time"
# Tmux has one status line, with 2 halves for status
tmux_left="logo release #arch"
tmux_left="logo #distro 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 memory #swap #disk #whoami #hostname #ip_address #time_utc date time"

View file

@ -39,6 +39,8 @@ Note that BYOBU_CONFIG_DIR=\fI$XDG_CONFIG_HOME/byobu\fP if defined, and \fI$HOME
\fBdisk_io\fP \- instantaneous read/write througput in kB/s or MB/s over the last 3 seconds; displayed in the lower bar toward the right in white text on a light purple background with a leading '<' sign indicating 'read speed' and '>' sign indicating 'write speed'; override the default monitored disk by specifying an alternate device with MONITORED_DISK=/dev/sdb, and override the default DISK_IO_THRESHOLD=50 (kB/s) in \fI$BYOBU_CONFIG_DIR/statusrc\fP
\fBdistro\fP \- OS/distribution name of 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; you may override the detected release with DISTRO=Whatever in \fI$BYOBU_CONFIG_DIR/statusrc\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 black background; there is a leading '~' to indicate that this is an estimation, and the monetary units are US Dollars '$'
\fBraid\fP \- note very prominently if there is a RAID failure detected, in red blinking text on a white background; the term 'RAID' notes that there is something wrong with the RAID, and if there is a rebuild/resync in progress, the percent complete is also shown
@ -69,7 +71,7 @@ Note that BYOBU_CONFIG_DIR=\fI$XDG_CONFIG_HOME/byobu\fP if defined, and \fI$HOME
\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 '(R)'; additionally, reboot_required will print '<F5>' in white text on a blue background, if Byobu requires you to reload your profile to affect some changes; it will also detect if your system is currently in \fBpowernap\fP(8) state and if so print '.zZ'.
\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; you may override the detected release with DISTRO=Whatever in \fI$BYOBU_CONFIG_DIR/statusrc\fP
\fBrelease\fP \- OS/distribution name of 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; you may override the detected release with RELEASE=Whatever in \fI$BYOBU_CONFIG_DIR/statusrc\fP
\fBservices\fP \- users can configure a list of services to monitor, define the SERVICES variable in \fI$BYOBU_CONFIG_DIR/statusrc\fP, a whitespace separated of services, each service should include the init name of the service, then a pipe, and then an abbreviated name or symbol to display when running (e.g. SERVICES="ssh|ssh apache2|http"); displayed in the lower bar toward the center in cyan on a white background