diff --git a/debian/changelog b/debian/changelog index c5997e4f..3764e593 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 Thu, 29 Sep 2011 14:46:58 -0400 diff --git a/usr/lib/byobu/.shutil b/usr/lib/byobu/.shutil index e2b90ab5..4af7f7fd 100755 --- a/usr/lib/byobu/.shutil +++ b/usr/lib/byobu/.shutil @@ -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 ;; diff --git a/usr/lib/byobu/Makefile.am b/usr/lib/byobu/Makefile.am index ea20c203..4e789ac3 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 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 diff --git a/usr/lib/byobu/distro b/usr/lib/byobu/distro new file mode 100755 index 00000000..08bd07d7 --- /dev/null +++ b/usr/lib/byobu/distro @@ -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 +# +# 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 . + +__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 diff --git a/usr/lib/byobu/release b/usr/lib/byobu/release index f69e446e..4a6412e5 100755 --- a/usr/lib/byobu/release +++ b/usr/lib/byobu/release @@ -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 diff --git a/usr/share/byobu/status/status b/usr/share/byobu/status/status index c66f9d74..7528a4f6 100644 --- a/usr/share/byobu/status/status +++ b/usr/share/byobu/status/status @@ -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" diff --git a/usr/share/man/man1/byobu.1 b/usr/share/man/man1/byobu.1 index 1d20ad86..d0e44b50 100644 --- a/usr/share/man/man1/byobu.1 +++ b/usr/share/man/man1/byobu.1 @@ -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 '' 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