From 70be0471566d9a83336e9bf65c192156b79e18ae Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Sat, 28 Jan 2012 12:45:36 -0600 Subject: [PATCH] * experimental/byobu-classroom, usr/bin/byobu-config, usr/bin/byobu- ctrl-a, usr/bin/byobu-janitor, usr/bin/byobu-launcher-uninstall, usr/bin/byobu-quiet, usr/bin/byobu-silent, usr/bin/byobu-status, usr/lib/byobu/cpu_temp, usr/lib/byobu/custom, usr/lib/byobu/ec2_cost, usr/lib/byobu/include/constants, usr/lib/byobu/logo, usr/lib/byobu/menu, usr/lib/byobu/network, usr/share/byobu/keybindings/f-keys: LP: #920661 - byobu should not set environment variable 'SED' - use BYOBU_SED instead --- debian/changelog | 9 +++++++++ experimental/byobu-classroom | 2 +- usr/bin/byobu-config | 20 ++++++++++---------- usr/bin/byobu-ctrl-a | 4 ++-- usr/bin/byobu-janitor | 6 +++--- usr/bin/byobu-launcher-uninstall | 2 +- usr/bin/byobu-quiet | 2 +- usr/bin/byobu-silent | 2 +- usr/bin/byobu-status | 4 ++-- usr/lib/byobu/cpu_temp | 2 +- usr/lib/byobu/custom | 2 +- usr/lib/byobu/ec2_cost | 2 +- usr/lib/byobu/include/constants | 2 +- usr/lib/byobu/logo | 2 +- usr/lib/byobu/menu | 2 +- usr/lib/byobu/network | 2 +- usr/share/byobu/keybindings/f-keys | 2 +- 17 files changed, 38 insertions(+), 29 deletions(-) diff --git a/debian/changelog b/debian/changelog index aefc4789..6eccc502 100644 --- a/debian/changelog +++ b/debian/changelog @@ -13,6 +13,15 @@ byobu (5.6) unreleased; urgency=low - easy to change with F8 - need to save characters in default tmux launch to get it to fit in 80x24 terminals + * experimental/byobu-classroom, usr/bin/byobu-config, usr/bin/byobu- + ctrl-a, usr/bin/byobu-janitor, usr/bin/byobu-launcher-uninstall, + usr/bin/byobu-quiet, usr/bin/byobu-silent, usr/bin/byobu-status, + usr/lib/byobu/cpu_temp, usr/lib/byobu/custom, + usr/lib/byobu/ec2_cost, usr/lib/byobu/include/constants, + usr/lib/byobu/logo, usr/lib/byobu/menu, usr/lib/byobu/network, + usr/share/byobu/keybindings/f-keys: LP: #920661 + - byobu should not set environment variable 'SED' + - use BYOBU_SED instead [ Ryan Thompson ] * usr/bin/byobu-select-session: LP: #919391 diff --git a/experimental/byobu-classroom b/experimental/byobu-classroom index 84f11c63..68889058 100755 --- a/experimental/byobu-classroom +++ b/experimental/byobu-classroom @@ -125,7 +125,7 @@ while [ $(grep -c "#byobu-classrom" /etc/ssh/sshd_config) != "4" ]; do c=$(head -n1) case "$c" in y|Y) - $SED -i -e '/#byobu-classroom/d' /etc/ssh/sshd_config || true + $BYOBU_SED -i -e '/#byobu-classroom/d' /etc/ssh/sshd_config || true echo " PasswordAuthentication yes #byobu-classroom AllowTcpForwarding no #byobu-classroom diff --git a/usr/bin/byobu-config b/usr/bin/byobu-config index 343ef616..0f7b5610 100755 --- a/usr/bin/byobu-config +++ b/usr/bin/byobu-config @@ -47,9 +47,9 @@ ESC = '' snack.hotkeys[ESC] = ord(ESC) snack.hotkeys[ord(ESC)] = ESC if commands.getstatusoutput('which gsed')[0] == 0: - SED = "gsed" + BYOBU_SED = "gsed" else: - SED = "sed" + BYOBU_SED = "sed" gettext.bindtextdomain(PKG, SHARE+'/po') gettext.textdomain(PKG) _ = gettext.gettext @@ -121,7 +121,7 @@ def help(snackScreen, size, config): text=f.read() f.close() text=text.replace("", getesckey(), 1) - text=text.replace("_VER_", commands.getoutput("byobu -v | head -n1 | " + SED + " 's/.* //'"), 1) + text=text.replace("_VER_", commands.getoutput("byobu -v | head -n1 | " + BYOBU_SED + " 's/.* //'"), 1) t = Textbox(67, 16, text, scroll=1, wrap=1) bb = ButtonBar(snackScreen, ((_("Menu"), "menu", ESC),), compact = 1) g = GridForm(snackScreen, _("Byobu Help"), 2, 4) @@ -177,16 +177,16 @@ def writestatus(items): path = BYOBU_CONFIG_DIR+'/status' for i in items: status[i[1]] = i[0] - # SED is hacky here, but effective + # BYOBU_SED is hacky here, but effective if BYOBU_BACKEND == "tmux": for key in ["tmux_left", "tmux_right"]: val = genstatusstring(key, status) - commands.getoutput("%s -i -e '/^%s=/d' %s" % (SED, key, path)) + commands.getoutput("%s -i -e '/^%s=/d' %s" % (BYOBU_SED, key, path)) commands.getoutput("echo '%s=\"%s\"' >> %s" % (key, val, path)) else: for key in ["screen_upper_left", "screen_upper_right", "screen_lower_left", "screen_lower_right"]: val = genstatusstring(key, status) - commands.getoutput("%s -i -e '/^%s=/d' %s" % (SED, key, path)) + commands.getoutput("%s -i -e '/^%s=/d' %s" % (BYOBU_SED, key, path)) commands.getoutput("echo '%s=\"%s\"' >> %s" % (key, val, path)) def togglestatus(snackScreen, size): @@ -257,13 +257,13 @@ def setesckey(key): u = key[0].upper() l = key[0].lower() if os.path.exists(path): - out = commands.getoutput(SED+" -i -e 's/^escape.*$//' "+path) + out = commands.getoutput(BYOBU_SED+" -i -e 's/^escape.*$//' "+path) appendtofile(path, "escape ^"+u+l+"\n") - out = commands.getoutput(SED+" -i -e 's/^register.*$//' "+path) + out = commands.getoutput(BYOBU_SED+" -i -e 's/^register.*$//' "+path) out = commands.getoutput("grep -sh '^register x' "+SHARE+"/keybindings/*keys") appendtofile(path, out+"\n") - out = commands.getoutput(SED+" -i -e 's/\"^^/\"\^"+l+"/g' "+path) - out = commands.getoutput(SED+" -i -e '/^$/d' "+path) + out = commands.getoutput(BYOBU_SED+" -i -e 's/\"^^/\"\^"+l+"/g' "+path) + out = commands.getoutput(BYOBU_SED+" -i -e '/^$/d' "+path) def chgesc(snackScreen, size): esc=Entry(2, text=getesckey(), returnExit=1) diff --git a/usr/bin/byobu-ctrl-a b/usr/bin/byobu-ctrl-a index 98ad4fbf..9db0c5fc 100755 --- a/usr/bin/byobu-ctrl-a +++ b/usr/bin/byobu-ctrl-a @@ -70,13 +70,13 @@ done case "$bind_to" in emacs) - $SED -i -e "/^register a /d" -e "/^bindkey \"^A\"/d" -e "/^escape escape \^Aa/d" "$keybindings" + $BYOBU_SED -i -e "/^register a /d" -e "/^bindkey \"^A\"/d" -e "/^escape escape \^Aa/d" "$keybindings" echo 'bindkey "^A"' >> "$keybindings" echo "INFO: ctrl-a will now operate in emacs mode" echo > "$keybindings.tmux" ;; screen) - $SED -i -e "/^register a /d" -e "/^bindkey \"^A\"/d" -e "/^escape /d" "$keybindings" + $BYOBU_SED -i -e "/^register a /d" -e "/^bindkey \"^A\"/d" -e "/^escape /d" "$keybindings" echo 'escape "^Aa"' >> "$keybindings" echo 'register x "^A"' >> "$keybindings" echo 'bindkey "^A"' >> "$keybindings" diff --git a/usr/bin/byobu-janitor b/usr/bin/byobu-janitor index 1846dbfd..a93a7f62 100755 --- a/usr/bin/byobu-janitor +++ b/usr/bin/byobu-janitor @@ -77,7 +77,7 @@ for f in status statusrc; do cp -f "$BYOBU_PREFIX/share/$PKG/status/$f" "$BYOBU_CONFIG_DIR/$f" # Enable ec2_cost, if we're in ec2 and seeding a new setup if metadata_available; then - $SED -i -e "s/#ec2_cost/ec2_cost/g" "$($READLINK -f $BYOBU_CONFIG_DIR/$f)" + $BYOBU_SED -i -e "s/#ec2_cost/ec2_cost/g" "$($READLINK -f $BYOBU_CONFIG_DIR/$f)" fi fi done @@ -91,7 +91,7 @@ fi # Affects: Upgrades from <= byobu-2.78 which might have "motd+shell" # in their window list; update this to just "shell" if grep -qs "motd+shell" "$BYOBU_CONFIG_DIR/windows"; then - $SED -i -e "s/motd+shell/shell/g" "$($READLINK -f $BYOBU_CONFIG_DIR/windows)" || true + $BYOBU_SED -i -e "s/motd+shell/shell/g" "$($READLINK -f $BYOBU_CONFIG_DIR/windows)" || true fi # Affects: Upgrades from <= byobu 4.3, remove ec2_rates @@ -99,7 +99,7 @@ rm -f "$BYOBU_CONFIG_DIR/ec2_rates" # Affects: Upgrades from <= byobu 4.4, update "shell" -> "byobu-shell" if grep -qs " shell$" "$BYOBU_CONFIG_DIR/windows"; then - $SED -i -e "s/ shell$/ $PKG-shell/g" "$($READLINK -f $BYOBU_CONFIG_DIR/windows)" || true + $BYOBU_SED -i -e "s/ shell$/ $PKG-shell/g" "$($READLINK -f $BYOBU_CONFIG_DIR/windows)" || true fi # Affects: Upgrades from <= byobu 4.22 diff --git a/usr/bin/byobu-launcher-uninstall b/usr/bin/byobu-launcher-uninstall index f2a5ab9c..6a100d14 100755 --- a/usr/bin/byobu-launcher-uninstall +++ b/usr/bin/byobu-launcher-uninstall @@ -27,7 +27,7 @@ remove_launcher() { dest=$1 if [ -w "$dest" ]; then # keep any comments, and remove lines invoking byobu: - $SED -i -e '/^\s*#/n' -e "/\b$PKG-launch\$/d" -e "/ screen-launch/d" "$dest" + $BYOBU_SED -i -e '/^\s*#/n' -e "/\b$PKG-launch\$/d" -e "/ screen-launch/d" "$dest" fi } diff --git a/usr/bin/byobu-quiet b/usr/bin/byobu-quiet index bdbfefad..b7f2390e 100755 --- a/usr/bin/byobu-quiet +++ b/usr/bin/byobu-quiet @@ -25,7 +25,7 @@ PKG="byobu" FLAG="$BYOBU_CONFIG_DIR/status.disable" # Clean up environment -$SED -i "/hardstatus/d" "$BYOBU_CONFIG_DIR/keybindings" || true +$BYOBU_SED -i "/hardstatus/d" "$BYOBU_CONFIG_DIR/keybindings" || true if [ "$1" = "--undo" ]; then rm -f "$FLAG" else diff --git a/usr/bin/byobu-silent b/usr/bin/byobu-silent index 8d0b4aa4..10caf08b 100755 --- a/usr/bin/byobu-silent +++ b/usr/bin/byobu-silent @@ -25,7 +25,7 @@ PKG="byobu" FLAG="$BYOBU_CONFIG_DIR/status.disable" # Clean up environment -$SED -i "/caption/d" "$BYOBU_CONFIG_DIR/keybindings" || true +$BYOBU_SED -i "/caption/d" "$BYOBU_CONFIG_DIR/keybindings" || true if [ "$1" = "--undo" ]; then rm -f "$FLAG" else diff --git a/usr/bin/byobu-status b/usr/bin/byobu-status index e178daf7..1cae24b5 100755 --- a/usr/bin/byobu-status +++ b/usr/bin/byobu-status @@ -100,8 +100,8 @@ case "$1" in include|menu|notify_osd|time_binary) continue ;; esac find_script "$i" && . "${_RET}" - short=$(eval "__${i}" | $SED -e 's/^\s*//' -e 's/\s*$//' -e 's/.{[^}]*}//g') - detail=$(eval "__${i}_detail" 2>/dev/null | $SED -e '/^$/d' -e 's/^/\t/g') + short=$(eval "__${i}" | $BYOBU_SED -e 's/^\s*//' -e 's/\s*$//' -e 's/.{[^}]*}//g') + detail=$(eval "__${i}_detail" 2>/dev/null | $BYOBU_SED -e '/^$/d' -e 's/^/\t/g') printf "%s\n\t(%s)\n" "$short" "$i" [ -n "$detail" ] && printf "%s\n" "$detail" done diff --git a/usr/lib/byobu/cpu_temp b/usr/lib/byobu/cpu_temp index 5bc2748c..8dbdfed6 100755 --- a/usr/lib/byobu/cpu_temp +++ b/usr/lib/byobu/cpu_temp @@ -36,7 +36,7 @@ __cpu_temp() { [ -s "$i" ] && read t < "$i" && t=$(($t/1000)) ;; *) - [ -s "$i" ] && t=$($SED -e "s/^[^0-9]\+//" -e "s/\s.*$//" "$i") + [ -s "$i" ] && t=$($BYOBU_SED -e "s/^[^0-9]\+//" -e "s/\s.*$//" "$i") ;; esac if [ -n "$t" ] && [ "$t" -gt 0 ]; then diff --git a/usr/lib/byobu/custom b/usr/lib/byobu/custom index f14c2032..0a61d9d6 100755 --- a/usr/lib/byobu/custom +++ b/usr/lib/byobu/custom @@ -53,7 +53,7 @@ __custom() { ;; esac done - printf "$output" | $SED ':a;N;$!ba;s/\n//g' + printf "$output" | $BYOBU_SED ':a;N;$!ba;s/\n//g' } # vi: syntax=sh ts=4 noexpandtab diff --git a/usr/lib/byobu/ec2_cost b/usr/lib/byobu/ec2_cost index 4318336b..43e2d4cb 100755 --- a/usr/lib/byobu/ec2_cost +++ b/usr/lib/byobu/ec2_cost @@ -42,7 +42,7 @@ __ec2_cost() { . "$BYOBU_PREFIX/share/$PKG/ec2/rates.${zone%?}" [ -s "$cache.type" ] || wget -q -O "$cache.type" http://169.254.169.254/latest/meta-data/instance-type 2>/dev/null & sleep 0.02 - [ -s "$cache.type" ] && type=$($SED -e "s/\./_/g" "$cache.type") + [ -s "$cache.type" ] && type=$($BYOBU_SED -e "s/\./_/g" "$cache.type") eval rate="\$$type" file_to_stat="$cache.type" fi diff --git a/usr/lib/byobu/include/constants b/usr/lib/byobu/include/constants index 8d70bc6e..1dc24eaf 100755 --- a/usr/lib/byobu/include/constants +++ b/usr/lib/byobu/include/constants @@ -94,7 +94,7 @@ case "$BYOBU_BACKEND" in esac # MacOS Support -command -v gsed >/dev/null 2>&1 && export SED="gsed" || export SED="sed" +command -v gsed >/dev/null 2>&1 && export BYOBU_SED="gsed" || export BYOBU_SED="sed" command -v greadlink >/dev/null 2>&1 && export READLINK="greadlink" || export READLINK="readlink" command -v sensible-pager >/dev/null 2>&1 && export BYOBU_PAGER="sensible-pager" || export BYOBU_PAGER="less" diff --git a/usr/lib/byobu/logo b/usr/lib/byobu/logo index 51ce38c3..0596d6e5 100755 --- a/usr/lib/byobu/logo +++ b/usr/lib/byobu/logo @@ -50,7 +50,7 @@ __logo() { return fi get_distro - local distro="$(echo "$_RET" | $SED 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/')" + local distro="$(echo "$_RET" | $BYOBU_SED 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/')" case "$distro" in *ubuntu*) if $MARKUP; then diff --git a/usr/lib/byobu/menu b/usr/lib/byobu/menu index 949fee02..3bde2934 100755 --- a/usr/lib/byobu/menu +++ b/usr/lib/byobu/menu @@ -27,7 +27,7 @@ __menu() { local bindings esc key text [ -r "$BYOBU_CONFIG_DIR/keybindings" ] && bindings="$BYOBU_CONFIG_DIR/keybindings" || bindings="$HOME/.screenrc" if grep -qs "^source.*screen-escape-keys$" $bindings 2>/dev/null || [ "$1" = "--disable-f-keys" ]; then - esc=`grep "^escape" $bindings | $SED "s/.*^\(.\).*/\1/"` + esc=`grep "^escape" $bindings | $BYOBU_SED "s/.*^\(.\).*/\1/"` [ -n "$esc" ] && key="^$esc-@" || key="^a-@" elif grep -qs "^source.*none$" $bindings 2>/dev/null; then key="byobu-config" diff --git a/usr/lib/byobu/network b/usr/lib/byobu/network index 2dfa3318..c2398290 100755 --- a/usr/lib/byobu/network +++ b/usr/lib/byobu/network @@ -21,7 +21,7 @@ __network_detail() { get_network_interface; local interface="$_RET" - LC_ALL=C /sbin/ifconfig "$interface" | $SED 's/\s*$//' + LC_ALL=C /sbin/ifconfig "$interface" | $BYOBU_SED 's/\s*$//' } __network() { diff --git a/usr/share/byobu/keybindings/f-keys b/usr/share/byobu/keybindings/f-keys index 5e018624..d70d0a06 100644 --- a/usr/share/byobu/keybindings/f-keys +++ b/usr/share/byobu/keybindings/f-keys @@ -44,7 +44,7 @@ bind $ $BYOBU_BACKEND -t status 0 byobu-status-detail # F12 $ | show detailed st bind @ $BYOBU_BACKEND -t config 0 byobu-config # F12 @ | Configuration bind R process r # F12 R | Reload profile register s "[g G$>^h" # Goes with F12 ~ definition -bind ~ eval 'process x' 'process s' 'exec $SED -i -e "/./,/^$/!d" $BYOBU_RUN_DIR/printscreen' '$BYOBU_BACKEND -t PRINTSCREEN view $BYOBU_RUN_DIR/printscreen' # F12 ~ | write the buffer to file, open in a new window +bind ~ eval 'process x' 'process s' 'exec $BYOBU_SED -i -e "/./,/^$/!d" $BYOBU_RUN_DIR/printscreen' '$BYOBU_BACKEND -t PRINTSCREEN view $BYOBU_RUN_DIR/printscreen' # F12 ~ | write the buffer to file, open in a new window # Hotkeys for splits (gnome-terminal) bindkey "^[O1;2Q" eval 'split' 'focus down' 'next' 'focus up' 'layout save byobu' 'layout autosave' # shift-F2 | horizontal split