debian/profile: establish symlinks for the color profiles to ensure

smooth upgrades; all point to the common profile now
This commit is contained in:
Dustin Kirkland 2009-12-04 15:21:14 -06:00
commit a7a762ceda
3 changed files with 28 additions and 23 deletions

View file

@ -56,34 +56,36 @@ if [ -d "$HOME/.$OLDPKG" ] && [ ! -e "$HOME/.$PKG" ]; then
sed -i "s/$OLDPKG/$PKG/g" "$HOME/.$PKG"/* || true
fi
# Affects: First runs with no configuration, or broken profile symlinks
# Affects: First runs with no configuration
# Seed the configuration
[ -d "$HOME/.$PKG" ] || mkdir -p "$HOME/.$PKG"
if [ ! -r "$PROFILE" ]; then
byobu-select-profile -b W -f k >/dev/null 2>&1
# Affects: Symlinks pointing to color profiles
if [ -h "$PROFILE" ] && \
stat "$PROFILE" | grep -qs "File:.*->.*/usr/share/byobu/profiles/" && \
! stat "$PROFILE" | grep -qs "File:.*->.*/usr/share/byobu/profiles/common" ; then
# Set default colors
BG=W
FG=k
if [ -h "$PROFILE" ]; then
# Symlink is broken; try to guess chosen colors
color=$(ls -l "$PROFILE" | sed "s/^.* //")
case $color in
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
fi
color=$(ls -l "$PROFILE" | sed "s/^.*\///")
case $color in
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
byobu-select-profile -b $BG -f $FG >/dev/null 2>&1
rm -f "$PROFILE" 2>/dev/null
ln -s /usr/share/$PKG/profiles/common "$PROFILE"

2
debian/changelog vendored
View file

@ -37,6 +37,8 @@ byobu (2.40) unreleased; urgency=low
* byobu-select-profile, byobu-select-profile.1: deprecate the --set
option, only support --background and --foreground now; update the
documentation
* debian/profile: establish symlinks for the color profiles to ensure
smooth upgrades; all point to the common profile now
-- Dustin Kirkland <kirkland@ubuntu.com> Tue, 10 Nov 2009 10:18:20 -0600

1
debian/rules vendored
View file

@ -46,6 +46,7 @@ install: build install-po
#dh_link usr/bin/byobu-status usr/bin/screen-profiles-status
#dh_link usr/bin/byobu-launcher usr/bin/screen-launcher
dh_link usr/share/byobu/keybindings/f-keys usr/share/byobu/keybindings/common
for i in black dark dark_blue dark_cyan dark_green dark_purple dark_red dark_yellow light light_blue light_cyan light_green light_purple light_red light_yellow; do dh_link usr/share/byobu/profiles/common usr/share/byobu/profiles/$${i}; done
dh_install -X.bzr
# Everything else is handled by dh_install