mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-22 14:24:39 -07:00
* 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:
parent
233dab6eb7
commit
525f3e5754
2 changed files with 18 additions and 27 deletions
40
byobu-status
40
byobu-status
|
@ -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
|
fi
|
||||||
# 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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# 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
5
debian/changelog
vendored
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue