From 4e74effcbdb0b21372a8bdaaa05b04a8e3380f52 Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Tue, 19 Jul 2011 13:18:06 -0500 Subject: [PATCH] * debian/install, etc/byobu/Makefile.am, etc/byobu/statusrc => usr/share/byobu/status/statusrc, usr/bin/byobu-janitor, usr/bin/byobu-status, usr/bin/byobu-statusd, usr/share/byobu/status/Makefile.am, usr/share/byobu/status/status: - LP: #803509 - rework usage of status and statusrc - status now contains the enable/disable bits for each status item - statusrc contains auxilliary configuration information - remove this stuff from /etc/byobu/statusrc altogether, and move it to /usr/share - standardize the seeding of the local user's configuration --- debian/changelog | 11 ++++ debian/install | 1 - etc/byobu/Makefile.am | 2 +- usr/bin/byobu-janitor | 61 ++++--------------- usr/bin/byobu-status | 7 +-- usr/bin/byobu-statusd | 4 +- usr/share/byobu/status/Makefile.am | 2 +- .../statusrc => usr/share/byobu/status/status | 25 ++------ usr/share/byobu/status/statusrc | 33 ++++++++++ 9 files changed, 68 insertions(+), 78 deletions(-) rename etc/byobu/statusrc => usr/share/byobu/status/status (67%) create mode 100644 usr/share/byobu/status/statusrc diff --git a/debian/changelog b/debian/changelog index 5a00cc4f..9638e5b0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -100,6 +100,17 @@ byobu (4.18) unreleased; urgency=low - prevent profile from getting sourced twice (thanks, Scott Moser) * usr/bin/byobu-launch: LP: #806609 - support zsh history append + * debian/install, etc/byobu/Makefile.am, etc/byobu/statusrc => + usr/share/byobu/status/statusrc, usr/bin/byobu-janitor, + usr/bin/byobu-status, usr/bin/byobu-statusd, + usr/share/byobu/status/Makefile.am, usr/share/byobu/status/status: + - LP: #803509 + - rework usage of status and statusrc + - status now contains the enable/disable bits for each status item + - statusrc contains auxilliary configuration information + - remove this stuff from /etc/byobu/statusrc altogether, and move + it to /usr/share + - standardize the seeding of the local user's configuration [ James Spencer ] * usr/lib/byobu/.constants: diff --git a/debian/install b/debian/install index 4f0ff406..10a59b85 100644 --- a/debian/install +++ b/debian/install @@ -1,5 +1,4 @@ /usr ../../etc/byobu/socketdir etc/byobu/ -../../etc/byobu/statusrc etc/byobu/ ../../debian/source_byobu.py usr/share/apport/package-hooks ../../debian/lintian/byobu usr/share/lintian/overrides diff --git a/etc/byobu/Makefile.am b/etc/byobu/Makefile.am index 5cf87afb..916234db 100644 --- a/etc/byobu/Makefile.am +++ b/etc/byobu/Makefile.am @@ -1,2 +1,2 @@ etcdir = $(datadir)/@PACKAGE@/profiles -etc_DATA = statusrc socketdir +etc_DATA = socketdir diff --git a/usr/bin/byobu-janitor b/usr/bin/byobu-janitor index 56fb5bed..d377fc68 100755 --- a/usr/bin/byobu-janitor +++ b/usr/bin/byobu-janitor @@ -51,59 +51,20 @@ fi # Affects: First runs with no configuration # Seed the configuration +# Setup initial local user configuration [ -r "$BYOBU_CONFIG_DIR/color" ] || printf "BACKGROUND=k\nFOREGROUND=w\nMONOCHROME=0" > "$BYOBU_CONFIG_DIR/color" -[ -r "$PROFILE" ] || ln -sf $BYOBU_PREFIX/share/$PKG/profiles/common "$PROFILE" - -# Affects: Symlinks pointing to color profiles -if [ -h "$PROFILE" ]; then - PROFILE_FP=$($READLINK -f "$PROFILE") - case "${PROFILE_FP}" in - $BYOBU_PREFIX/share/byobu/profiles/*) - # Set default colors - BG=W - FG=k - color=${PROFILE_FP##*/} - case "$color" in - common) BG=; FG=;; - black|dark) BG=k; FG=W;; - dark_blue) BG=b; FG=W;; - dark_cyan) BG=c; FG=W;; - dark_green) BG=g; FG=W;; - dark_purple) BG=m; FG=W;; - dark_red) BG=r; FG=W;; - dark_yellow) BG=y; FG=W;; - light) BG=W; FG=k;; - light_blue) BG=B; FG=k;; - light_cyan) BG=C; FG=k;; - light_green) BG=G; FG=k;; - light_purple) BG=M; FG=k;; - light_red) BG=R; FG=k;; - light_yellow) BG=Y; FG=k;; - *) BG=W; FG=k;; - esac - if [ -n "$BG" ] && [ -n "$FG" ]; then - rm -f "$PROFILE" 2>/dev/null - byobu-select-profile -b $BG -f $FG >/dev/null 2>&1 - fi - ;; - esac -fi - -[ -s "$BYOBU_CONFIG_DIR/keybindings" ] || echo "source $BYOBU_PREFIX/share/$PKG/keybindings/common" > "$BYOBU_CONFIG_DIR/keybindings" -if [ ! -r "$BYOBU_CONFIG_DIR/status" ]; then - if [ -r /etc/$PKG/statusrc ]; then - skel=/etc/$PKG/statusrc - elif [ -r "$BYOBU_PREFIX/share/$PKG/profiles/statusrc" ]; then - skel="$BYOBU_PREFIX/share/$PKG/profiles/statusrc" - else - skel=/dev/null - fi - grep -A 999999 BEGIN_CUT_HERE $skel | grep -B 999999 END_CUT_HERE | grep -v CUT > "$BYOBU_CONFIG_DIR/status" - # If it looks like we're running in ec2, enable ec2_cost by default - [ -x /usr/sbin/update-grub-legacy-ec2 ] && $SED -i "s/ec2_cost=.*/ec2_cost=1/" "$BYOBU_CONFIG_DIR/status" -fi +[ -r "$BYOBU_CONFIG_DIR/profile" ] || echo "source $BYOBU_PREFIX/share/$PKG/profiles/common" > "$BYOBU_CONFIG_DIR/profile" +[ -r "$BYOBU_CONFIG_DIR/keybindings" ] || echo "source $BYOBU_PREFIX/share/$PKG/keybindings/common" > "$BYOBU_CONFIG_DIR/keybindings" [ -r "$BYOBU_CONFIG_DIR/windows" ] || touch "$BYOBU_CONFIG_DIR/windows" +[ -r "$BYOBU_CONFIG_DIR/status" ] || touch "$BYOBU_CONFIG_DIR/status" +[ -r "$BYOBU_CONFIG_DIR/statusrc" ] || touch "$BYOBU_CONFIG_DIR/statusrc" [ -r "$HOME/.screenrc" ] || touch "$HOME/.screenrc" +for f in status statusrc; do + if [ ! -r "$BYOBU_CONFIG_DIR/$f" ]; then + # Copy from skeleton, if possible + [ -r "/etc/$PKG/$f" ] && cp -f /etc/$PKG/$f "$BYOBU_CONFIG_DIR/$f" + fi +done # Affects: Upgrades from <= byobu-2.11 # The status scripts used to have hyphens in their name, but now use diff --git a/usr/bin/byobu-status b/usr/bin/byobu-status index 91e85f9f..e9e3821f 100755 --- a/usr/bin/byobu-status +++ b/usr/bin/byobu-status @@ -44,10 +44,9 @@ color() { } # Source configurations -[ -r "$BYOBU_CONFIG_DIR/color" ] && . "$BYOBU_CONFIG_DIR/color" -[ -r "/etc/$PKG/statusrc" ] && . "/etc/$PKG/statusrc" -[ -r "$BYOBU_CONFIG_DIR/status" ] && . "$BYOBU_CONFIG_DIR/status" -[ -r "$BYOBU_CONFIG_DIR/statusrc" ] && . "$BYOBU_CONFIG_DIR/statusrc" +for i in "${BYOBU_PREFIX}/share/$PKG/status/status" "${BYOBU_PREFIX}/share/$PKG/status/statusrc" "$BYOBU_CONFIG_DIR/status" "$BYOBU_CONFIG_DIR/statusrc" "$BYOBU_CONFIG_DIR/color"; do + [ -r "$i" ] && . "$i" +do export P="$1" case "$P" in diff --git a/usr/bin/byobu-statusd b/usr/bin/byobu-statusd index d30e88be..b18688b7 100755 --- a/usr/bin/byobu-statusd +++ b/usr/bin/byobu-statusd @@ -27,7 +27,7 @@ rm -rf "$BYOBU_RUN_DIR/status" "$BYOBU_RUN_DIR/.last" mkdir -p "$BYOBU_RUN_DIR/status" "$BYOBU_RUN_DIR/.last" # Source configurations -for i in "/etc/$PKG/statusrc" "$BYOBU_CONFIG_DIR/status" "$BYOBU_CONFIG_DIR/statusrc"; do +for i in "${BYOBU_PREFIX}/share/$PKG/status/status" "${BYOBU_PREFIX}/share/$PKG/status/statusrc" "$BYOBU_CONFIG_DIR/status" "$BYOBU_CONFIG_DIR/statusrc" "$BYOBU_CONFIG_DIR/color"; do [ -r "$i" ] && . "$i" done @@ -40,7 +40,7 @@ while true; do fi now=$(date +%s) # Re-source configuration, if changed since last run - for i in "/etc/$PKG/statusrc" "$BYOBU_CONFIG_DIR/status" "$BYOBU_CONFIG_DIR/statusrc"; do + for i in "${BYOBU_PREFIX}/share/$PKG/status/status" "${BYOBU_PREFIX}/share/$PKG/status/statusrc" "$BYOBU_CONFIG_DIR/status" "$BYOBU_CONFIG_DIR/statusrc" "$BYOBU_CONFIG_DIR/color"; do [ -r "$i" ] && [ "$i" -nt "$BYOBU_RUN_DIR/status" ] && . "$i" done for i in "$BYOBU_PREFIX/lib/$PKG/"*; do diff --git a/usr/share/byobu/status/Makefile.am b/usr/share/byobu/status/Makefile.am index 00fedfba..a346cd3a 100644 --- a/usr/share/byobu/status/Makefile.am +++ b/usr/share/byobu/status/Makefile.am @@ -1,2 +1,2 @@ statusdir = $(datadir)/@PACKAGE@/status -status_DATA = 1 2 3 4 +status_DATA = 1 2 3 4 status statusrc diff --git a/etc/byobu/statusrc b/usr/share/byobu/status/status similarity index 67% rename from etc/byobu/statusrc rename to usr/share/byobu/status/status index 9d91778f..ec7a2aa2 100644 --- a/etc/byobu/statusrc +++ b/usr/share/byobu/status/status @@ -1,8 +1,10 @@ -# statusrc -# Byobu's default status notifications -# Override these in $BYOBU_CONFIG_DIR/status +# status - Byobu's default status enabled/disabled settings # -# Copyright (C) 2009 Canonical Ltd. +# Override these in $BYOBU_CONFIG_DIR/status +# where BYOBU_CONFIG_DIR is XDG_CONFIG_HOME if defined, +# and $HOME/.byobu otherwise. +# +# Copyright (C) 2009-2011 Canonical Ltd. # # Authors: Dustin Kirkland # @@ -18,8 +20,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# BEGIN_CUT_HERE -# Toggle status notifications apport=0 arch=0 battery=1 @@ -58,16 +58,3 @@ updates_available=1 uptime=1 whoami=1 wifi_quality=1 - -# Configurations that you can override; if you leave these commented out, -# Byobu will auto-detect them. -#LOGO="\o/" -#MONITORED_DISK=/ -#DISK_IO_THRESHOLD=50 -#MONITORED_INTERFACE=eth0 -#NETWORK_THRESHOLD=20 -#MONITORED_TEMP=/proc/acpi/thermal_zone/THM0/temperature -#TEMP=F -#DISTRO=Ubuntu -#SERVICES="eucalyptus-nc|NC eucalyptus-cloud|CLC eucalyptus-walrus eucalyptus-cc|CC eucalyptus-sc|SC" -# END_CUT_HERE diff --git a/usr/share/byobu/status/statusrc b/usr/share/byobu/status/statusrc new file mode 100644 index 00000000..58385855 --- /dev/null +++ b/usr/share/byobu/status/statusrc @@ -0,0 +1,33 @@ +# statusrc - Byobu's default status configurations +# +# Override these in $BYOBU_CONFIG_DIR/statusrc +# where BYOBU_CONFIG_DIR is XDG_CONFIG_HOME if defined, +# and $HOME/.byobu otherwise. +# +# Copyright (C) 2009-2011 Canonical Ltd. +# +# 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 . + +# Configurations that you can override; if you leave these commented out, +# Byobu will try to auto-detect them. +#LOGO="\o/" +#MONITORED_DISK=/ +#DISK_IO_THRESHOLD=50 +#MONITORED_INTERFACE=eth0 +#NETWORK_THRESHOLD=20 +#MONITORED_TEMP=/proc/acpi/thermal_zone/THM0/temperature +#TEMP=F +#DISTRO=Ubuntu +#SERVICES="eucalyptus-nc|NC eucalyptus-cloud|CLC eucalyptus-walrus eucalyptus-cc|CC eucalyptus-sc|SC"