From 13cd75ab3811ddf0ebb4c3853babb20f1edbc0e4 Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Wed, 8 May 2013 13:06:03 -0500 Subject: [PATCH] * debian/control, usr/bin/byobu-select-profile: LP: #1166416 - hardcode a use of gawk (for hex calculations) --- debian/changelog | 2 ++ debian/control | 3 ++- usr/bin/byobu-select-profile | 6 +++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index a23031dd..1183befb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,8 @@ byobu (5.40) unreleased; urgency=low - use byobu's tmux-screen-keys.conf * debian/postinst: LP: #1174537 - drop the env python changes in the postinst + * debian/control, usr/bin/byobu-select-profile: LP: #1166416 + - hardcode a use of gawk (for hex calculations) -- Dustin Kirkland Tue, 07 May 2013 22:01:40 -0500 diff --git a/debian/control b/debian/control index ced99a1e..2d328da9 100644 --- a/debian/control +++ b/debian/control @@ -17,7 +17,8 @@ Depends: gettext-base, python, python-newt (>= 0.52.2-11), - tmux (>= 1.5) | screen + tmux (>= 1.5) | screen, + gawk Recommends: screen, tmux (>= 1.5), diff --git a/usr/bin/byobu-select-profile b/usr/bin/byobu-select-profile index cecf93b4..1dcb3d21 100755 --- a/usr/bin/byobu-select-profile +++ b/usr/bin/byobu-select-profile @@ -186,8 +186,12 @@ setcolor_screen() { get_contrast() { # See section 2.2: http://www.w3.org/TR/AERT + local awk="awk" + if $BYOBU_TEST gawk >/dev/null 2>&1; then + awk="gawk" + fi local hex="$(echo "$1" | sed -e "s/\(..\)\(..\)\(..\)/\1 \2 \3/")" - local bright=$(echo $hex | awk --non-decimal-data '{printf "%0.0f",(("0x"$1)*299+("0x"$2)*587+("0x"$3)*114)/1000}') + local bright=$(echo $hex | $awk --non-decimal-data '{printf "%0.0f",(("0x"$1)*299+("0x"$2)*587+("0x"$3)*114)/1000}') if [ $bright -ge 130 ]; then _RET="black" else