* 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"
migrate() {
OLDPKG="screen-profiles"
# Rename the config dir
mv "$HOME/.$OLDPKG" "$HOME/.$PKG"
ln -s "$HOME/.$PKG" "$HOME/.$OLDPKG"
# Replace all instances of the old package name with the new
find "$HOME/.$PKG" -type f | xargs sed -i "s/$OLDPKG/$PKG/g"
# Fix the chosen profile symlink
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"
find_script () {
# Allow for local status scripts
if [ -x "$HOME/.$PKG/bin/$1" ]; then
echo "$HOME/.$PKG/bin/$1"
elif [ -x "/usr/lib/$PKG/$1" ]; then
echo "/usr/lib/$PKG/$1"
else
echo "/bin/true"
fi
}
# If the old config dir exists, but the new one doesn't, provide a migration mechanism.
[ -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
# Source configuration
[ -r "/etc/$PKG/statusrc" ] && . "/etc/$PKG/statusrc"
# Source local status configuration
[ -r "$HOME/.$PKG/status" ] && . "$HOME/.$PKG/status"
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"
for i in `ls "$DIR"`; do
[ "$i" = "menu" ] && continue
short=`"$DIR"/$i --short | sed 's/^\s*//' | sed 's/\s*$//' | sed 's/.{[^}]*}//g'` || true
detail=`"$DIR"/$i --detail | sed '/^$/d' | sed 's/^/\t/g'` || true
script=`find_script $i`
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"
[ -n "$detail" ] && printf "%s\n" "$detail"
done
else
eval x=\$$P || exit 1
[ "$x" = "1" ] || exit 0
[ -x "$DIR/$P" ] && exec "$DIR/$P"
exec $(find_script "$P")
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
improvement for all status, also reduces the number of places to
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 ]
* 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