mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-22 14:24:39 -07:00
* byobu-status, byobu-export, debian/install: source default status
states, rather than the big case statement, performance improvement for all status, also reduces the number of places to touch when a new status script is added Signed-off-by: Dustin Kirkland <kirkland@canonical.com>
This commit is contained in:
parent
06ef2ffc2e
commit
36f3a4c6fe
4 changed files with 32 additions and 78 deletions
18
byobu-export
18
byobu-export
|
@ -85,22 +85,6 @@ choose() {
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
status_config() {
|
|
||||||
# Generate the status configuration
|
|
||||||
# Disable the menu, since configurator is not available
|
|
||||||
# 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)
|
|
||||||
echo "$i=1"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "$i=0"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
hr() {
|
hr() {
|
||||||
echo "###############################################################################"
|
echo "###############################################################################"
|
||||||
}
|
}
|
||||||
|
@ -233,7 +217,7 @@ cp -a /usr/bin/$PKG-status "$DIR/.$PKG"
|
||||||
# Generate the monolithic profile
|
# Generate the monolithic profile
|
||||||
header > "$PROFILE"
|
header > "$PROFILE"
|
||||||
sources >> "$PROFILE"
|
sources >> "$PROFILE"
|
||||||
status_config > "$STATUS"
|
cp /etc/$PKG/statusrc > "$STATUS"
|
||||||
|
|
||||||
# Some gardening
|
# Some gardening
|
||||||
# Drop additional "source" calls
|
# Drop additional "source" calls
|
||||||
|
|
63
byobu-status
63
byobu-status
|
@ -17,15 +17,6 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
###########################################################
|
|
||||||
# We should be really "nice" about gathering status:
|
|
||||||
#renice 10 $$ >/dev/null 2>&1 || true
|
|
||||||
#ionice -c3 -p $$ >/dev/null 2>&1 || true
|
|
||||||
# However, this *really* slows down startup.
|
|
||||||
# We need a good way of only doing this for updates,
|
|
||||||
# but not at screen startup.
|
|
||||||
###########################################################
|
|
||||||
|
|
||||||
PKG="byobu"
|
PKG="byobu"
|
||||||
|
|
||||||
migrate() {
|
migrate() {
|
||||||
|
@ -44,41 +35,20 @@ migrate() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# If the old config dir exists, but the new one doesn't, provide a migration mechanism
|
# If the old config dir exists, but the new one doesn't, provide a migration mechanism.
|
||||||
[ -d "$HOME/.$OLDPKG" -a ! -d "$HOME/.$PKG" ] && migrate
|
[ -d "$HOME/.$OLDPKG"] && [ ! -d "$HOME/.$PKG" ] && migrate
|
||||||
|
|
||||||
# Allow for local status scripts
|
# Allow for local status scripts
|
||||||
if [ -d "$HOME/.$PKG/bin" ]; then
|
DIR="/usr/lib/$PKG"
|
||||||
DIR="$HOME/.$PKG/bin"
|
[ -d "$HOME/.$PKG/bin" ] && DIR="$HOME/.$PKG/bin"
|
||||||
elif [ -d "/usr/lib/$PKG" ]; then
|
|
||||||
DIR="/usr/lib/$PKG"
|
|
||||||
else
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Source status file
|
# Source global status configuration
|
||||||
if [ -r "$HOME/.$PKG/status" ]; then
|
. "/etc/$PKG/statusrc" || true
|
||||||
if ! . "$HOME/.$PKG/status" ; then
|
# Source local status configuration
|
||||||
# If sourcing fails, try replacing - with _
|
. "$HOME/.$PKG/status" || sed -i "s/-/_/g" "$HOME/.$PKG/status" || true
|
||||||
sed -i "s/-/_/g" "$HOME/.$PKG/status"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
P="$1"
|
export P="$1"
|
||||||
case "$P" in
|
if [ "$P" = "--detail" ]; then
|
||||||
# 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)
|
|
||||||
eval x=\$$P
|
|
||||||
export $P
|
|
||||||
[ "$x" = "0" ] && exit 0
|
|
||||||
;;
|
|
||||||
# default = off, user must override to turn on
|
|
||||||
arch|battery|disk|ec2_cost|hostname|ip_address|mail|network|processes|users|temp_c|temp_f|whoami|wifi_quality)
|
|
||||||
eval x=\$$P
|
|
||||||
export $P
|
|
||||||
[ "$x" = "1" ] || exit 0
|
|
||||||
;;
|
|
||||||
--detail)
|
|
||||||
VER=
|
VER=
|
||||||
if which dpkg-query >/dev/null; then
|
if which dpkg-query >/dev/null; then
|
||||||
VER=`dpkg-query --show $PKG | awk '{print "-" $2 }'`
|
VER=`dpkg-query --show $PKG | awk '{print "-" $2 }'`
|
||||||
|
@ -91,13 +61,8 @@ case "$P" in
|
||||||
printf "%s\n\t(%s)\n" "$short" "$i"
|
printf "%s\n\t(%s)\n" "$short" "$i"
|
||||||
[ -n "$detail" ] && printf "%s\n" "$detail"
|
[ -n "$detail" ] && printf "%s\n" "$detail"
|
||||||
done
|
done
|
||||||
exit 0
|
else
|
||||||
;;
|
eval x=\$$P || exit 1
|
||||||
*)
|
[ "$x" = "1" ] || exit 0
|
||||||
exit 1
|
[ -x "$DIR"/"$P" ] exec "$DIR"/"$P"
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -f "$DIR"/"$P" -a -x "$DIR"/"$P" ]; then
|
|
||||||
exec "$DIR"/"$P"
|
|
||||||
fi
|
fi
|
||||||
|
|
6
debian/changelog
vendored
6
debian/changelog
vendored
|
@ -6,11 +6,15 @@ byobu (2.13) unreleased; urgency=low
|
||||||
screen-launcher
|
screen-launcher
|
||||||
* byobu-config: improve the verbage of some of the menus, per
|
* byobu-config: improve the verbage of some of the menus, per
|
||||||
review with the Canonical Design Team
|
review with the Canonical Design Team
|
||||||
|
* byobu-status, byobu-export, debian/install: source default status
|
||||||
|
states, rather than the big case statement, performance improvement
|
||||||
|
for all status, also reduces the number of places to touch when a
|
||||||
|
new status script is added
|
||||||
|
|
||||||
[ Ciemon Dunville ]
|
[ Ciemon Dunville ]
|
||||||
* byobu.1: reflect the keybinding toggle change to Ctrl-a-!
|
* byobu.1: reflect the keybinding toggle change to Ctrl-a-!
|
||||||
|
|
||||||
-- Dustin Kirkland <kirkland@ubuntu.com> Fri, 19 Jun 2009 14:59:28 -0500
|
-- Dustin Kirkland <kirkland@ubuntu.com> Fri, 19 Jun 2009 16:18:53 -0500
|
||||||
|
|
||||||
byobu (2.12-0ubuntu1) karmic; urgency=low
|
byobu (2.12-0ubuntu1) karmic; urgency=low
|
||||||
|
|
||||||
|
|
1
debian/install
vendored
1
debian/install
vendored
|
@ -7,6 +7,7 @@ profiles/black usr/share/byobu/profiles
|
||||||
profiles/dark usr/share/byobu/profiles
|
profiles/dark usr/share/byobu/profiles
|
||||||
profiles/light usr/share/byobu/profiles
|
profiles/light usr/share/byobu/profiles
|
||||||
keybindings/* usr/share/byobu/keybindings
|
keybindings/* usr/share/byobu/keybindings
|
||||||
|
statusrc etc/byobu
|
||||||
windows/common usr/share/byobu/windows
|
windows/common usr/share/byobu/windows
|
||||||
select-screen-profile usr/bin
|
select-screen-profile usr/bin
|
||||||
byobu usr/bin
|
byobu usr/bin
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue