* byobu-status: move all of the cleanup hacks to byobu-janitor; create

a find_script() function that allows for scripts in both /usr/lib and
    $HOME/.byobu


Signed-off-by: Dustin Kirkland <kirkland@canonical.com>
This commit is contained in:
Dustin Kirkland 2009-06-19 17:51:09 -05:00
commit 525f3e5754
2 changed files with 18 additions and 27 deletions

View file

@ -19,32 +19,19 @@
PKG="byobu" PKG="byobu"
migrate() { find_script () {
OLDPKG="screen-profiles" # Allow for local status scripts
# Rename the config dir if [ -x "$HOME/.$PKG/bin/$1" ]; then
mv "$HOME/.$OLDPKG" "$HOME/.$PKG" echo "$HOME/.$PKG/bin/$1"
ln -s "$HOME/.$PKG" "$HOME/.$OLDPKG" elif [ -x "/usr/lib/$PKG/$1" ]; then
# Replace all instances of the old package name with the new echo "/usr/lib/$PKG/$1"
find "$HOME/.$PKG" -type f | xargs sed -i "s/$OLDPKG/$PKG/g" else
# Fix the chosen profile symlink echo "/bin/true"
if [ -h "$HOME/.$PKG/profile" ]; then
# Determine the chosen profile color
profile=`stat "$HOME/.$PKG/profile" | head -n1 | sed "s:^.*[/-]::" | sed "s:'$::"`
# Try to set that color, if it exists, otherwise default to light
select-screen-profile -s "$profile" || select-screen-profile -s "light"
fi fi
} }
# If the old config dir exists, but the new one doesn't, provide a migration mechanism. # Source configuration
[ -d "$HOME/.$OLDPKG" ] && [ ! -d "$HOME/.$PKG" ] && migrate
# Allow for local status scripts
DIR="/usr/lib/$PKG"
[ -d "$HOME/.$PKG/bin" ] && DIR="$HOME/.$PKG/bin"
# Source global status configuration
[ -r "/etc/$PKG/statusrc" ] && . "/etc/$PKG/statusrc" [ -r "/etc/$PKG/statusrc" ] && . "/etc/$PKG/statusrc"
# Source local status configuration
[ -r "$HOME/.$PKG/status" ] && . "$HOME/.$PKG/status" [ -r "$HOME/.$PKG/status" ] && . "$HOME/.$PKG/status"
export P="$1" export P="$1"
@ -56,13 +43,14 @@ if [ "$P" = "--detail" ]; then
printf "$PKG$VER Detailed Status Navigation\n Expand all - zr\t\tCollapse all - zm\n Expand one - zo\t\tCollapse one - zc\n\n" printf "$PKG$VER Detailed Status Navigation\n Expand all - zr\t\tCollapse all - zm\n Expand one - zo\t\tCollapse one - zc\n\n"
for i in `ls "$DIR"`; do for i in `ls "$DIR"`; do
[ "$i" = "menu" ] && continue [ "$i" = "menu" ] && continue
short=`"$DIR"/$i --short | sed 's/^\s*//' | sed 's/\s*$//' | sed 's/.{[^}]*}//g'` || true script=`find_script $i`
detail=`"$DIR"/$i --detail | sed '/^$/d' | sed 's/^/\t/g'` || true short=`$script --short | sed 's/^\s*//' | sed 's/\s*$//' | sed 's/.{[^}]*}//g'` || true
detail=`$script --detail | sed '/^$/d' | sed 's/^/\t/g'` || true
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
else else
eval x=\$$P || exit 1 eval x=\$$P || exit 1
[ "$x" = "1" ] || exit 0 [ "$x" = "1" ] || exit 0
[ -x "$DIR/$P" ] && exec "$DIR/$P" exec $(find_script "$P")
fi fi

5
debian/changelog vendored
View file

@ -10,11 +10,14 @@ byobu (2.13) unreleased; urgency=low
status states, rather than the big case statement, performance status states, rather than the big case statement, performance
improvement for all status, also reduces the number of places to improvement for all status, also reduces the number of places to
touch when a new status script is added touch when a new status script is added
* byobu-status: move all of the cleanup hacks to byobu-janitor; create
a find_script() function that allows for scripts in both /usr/lib and
$HOME/.byobu
[ 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 16:21:27 -0500 -- Dustin Kirkland <kirkland@ubuntu.com> Fri, 19 Jun 2009 17:50:59 -0500
byobu (2.12-0ubuntu1) karmic; urgency=low byobu (2.12-0ubuntu1) karmic; urgency=low