Merge lp:~jefferyto/byobu/misc-updates into lp:byobu

Proposed by Jeffery To
Status: Needs review
Proposed branch: lp:~jefferyto/byobu/misc-updates
Merge into: lp:byobu
Diff against target: 1406 lines (+467/-282)
29 files modified
debian/changelog (+96/-0)
usr/bin/byobu-ctrl-a.in (+149/-76)
usr/bin/byobu-export.in (+1/-1)
usr/bin/byobu-janitor.in (+13/-7)
usr/bin/byobu-launch.in (+1/-1)
usr/bin/byobu-select-profile.in (+102/-75)
usr/bin/byobu-status-detail.in (+1/-1)
usr/bin/byobu-status.in (+6/-7)
usr/bin/byobu.in (+14/-20)
usr/lib/byobu/battery (+1/-1)
usr/lib/byobu/disk_io (+1/-1)
usr/lib/byobu/hostname (+1/-1)
usr/lib/byobu/include/common (+7/-3)
usr/lib/byobu/include/constants (+6/-10)
usr/lib/byobu/include/dirs.in (+23/-14)
usr/lib/byobu/include/shutil (+4/-4)
usr/lib/byobu/ip_address (+2/-2)
usr/lib/byobu/memory (+1/-1)
usr/lib/byobu/release (+2/-2)
usr/lib/byobu/updates_available (+14/-14)
usr/lib/byobu/users (+10/-2)
usr/lib/byobu/whoami (+3/-3)
usr/lib/byobu/wifi_quality (+4/-4)
usr/share/byobu/keybindings/f-keys.screen (+1/-1)
usr/share/byobu/keybindings/f-keys.tmux (+1/-1)
usr/share/byobu/profiles/Makefile.am (+1/-1)
usr/share/byobu/profiles/byoburc (+0/-27)
usr/share/byobu/profiles/screenrc (+1/-1)
usr/share/byobu/profiles/tmuxrc (+1/-1)
To merge this branch: bzr merge lp:~jefferyto/byobu/misc-updates
Reviewer Review Type Date Requested Status
Dustin Kirkland  Pending
Review via email: mp+368934@code.launchpad.net

Description of the change

There isn't a major theme to these changes, just things I noticed while working on porting byobu to OpenWrt (but aren't critical enough that I needed to patch right away).

There is one fix (trailing "#" sign for usr/lib/byobu/users). Originally it was working for screen but broken for tmux, then I fixed tmux but (unwittingly) broke screen. Now it should work for both.

I imagine the "create new config dir in ~/.config" change may be somewhat controversial. I think at this point most users will have a ~/.config directory and keeping $HOME clean(er) is a good thing.

To post a comment you must log in.
Revision history for this message
Jeffery To (jefferyto) wrote :

Should I separate these changes into separate branches/merge requests?

Revision history for this message
Dustin Kirkland  (kirkland) wrote :

Hi Jeffrey,

Yeah, these are a lot of changes. I'm struggling to review all of them, as a monolith.

Revision history for this message
Jeffery To (jefferyto) wrote :

> Hi Jeffrey,
>
> Yeah, these are a lot of changes. I'm struggling to review all of them, as a
> monolith.

I can submit them one at a time (the first one is at https://code.launchpad.net/~jefferyto/byobu/fix-trailing-hash/+merge/379412) but I would prefer not to wait 6 months for a review.

Revision history for this message
Jeffery To (jefferyto) wrote :

I can submit all of the changes in separate merge requests all at once, but since they all include an update to debian/changelog, they will all conflict with each other.

Do you want me to submit all of the changes all at once and you will resolve the conflicts, or do you want me to submit them one at a time?

Unmerged revisions

2640. By Jeffery To

* usr/bin/byobu-status-detail.in,
  usr/bin/byobu-status.in:
  - Remove unnecessary backticks; the command returns no output, only
    the exit value is tested

2639. By Jeffery To

* usr/bin/byobu-ctrl-a.in,
  usr/bin/byobu-janitor.in,
  usr/share/byobu/keybindings/f-keys.screen,
  usr/share/byobu/keybindings/f-keys.tmux:
  - Fix ^A unbinding: ^A is bound in f-keys.screen / f-keys.tmux to
    autorun byobu-ctrl-a, but if the user selected a different key in
    byobu-config, it would unbind the custom key instead of ^A
  - Use functions to help make the logic easier to understand
  - Add "custom" and "manual" modes, that only unbind ^A ("emacs" mode
    would also set prefix to F12 for tmux, possibly overriding the
    user's custom prefix); "custom" when it is detected that the user
    has customized their prefix before byobu-ctrl-a was run for the
    first time, "manual" when the user just wants to disable the
    autorun
  - Add an "autorun" command line option, used when byobu-ctrl-a is
    triggered by the user pressing ^A; in this case, byobu-ctrl-a will
    wait for the user to press enter/return before exiting, so that
    the user can read the text output before the window auto-closes
  - Add a quit option, so that the user can exit byobu-ctrl-a without
    making any changes

2638. By Jeffery To

* usr/bin/byobu-status.in:
  - Include $BYOBU_CONFIG_DIR/datetime.tmux in the sourcing for loop

2637. By Jeffery To

* usr/bin/byobu-select-profile.in:
  - Update help message
  - Remove $BYOBU_CONFIG_DIR/profile test, it is not used directly in
    the script
  - Restore list colors functionality
  - Use local variables in functions
  - Simplify color calculation
  - Exit when --list / --help / invalid options are specified, before
    making changes
  - Removed -- option, command utilities that have a -- option expect
    data to come after the --

2636. By Jeffery To

* usr/bin/byobu-janitor.in:
  - Remove unused variables

2635. By Jeffery To

* usr/bin/byobu-export.in,
  usr/bin/byobu-janitor.in,
  usr/bin/byobu-launch.in,
  usr/bin/byobu-select-profile.in,
  usr/bin/byobu-status-detail.in,
  usr/bin/byobu-status.in,
  usr/bin/byobu.in,
  usr/lib/byobu/battery,
  usr/lib/byobu/disk_io,
  usr/lib/byobu/hostname,
  usr/lib/byobu/include/common,
  usr/lib/byobu/include/constants,
  usr/lib/byobu/include/shutil,
  usr/lib/byobu/ip_address,
  usr/lib/byobu/memory,
  usr/lib/byobu/release,
  usr/lib/byobu/updates_available,
  usr/lib/byobu/whoami,
  usr/lib/byobu/wifi_quality:
  - Add (and use) a byobu_test function to wrap $BYOBU_TEST

2634. By Jeffery To

* usr/bin/byobu.in:
  - Remove exporting of $BYOBU_BACKEND, this is already done in
    usr/lib/byobu/include/constants

2633. By Jeffery To

* usr/lib/byobu/include/constants:
  - Remove sourcing of files looking for $BYOBU_BACKEND, this is
    already done in usr/lib/byobu/include/common

2632. By Jeffery To

* usr/bin/byobu-status-detail.in:
  - Use $BYOBU_TEST

2631. By Jeffery To

* usr/bin/byobu.in:
  - Replace $HOME/.$PKG with $BYOBU_CONFIG_DIR

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2019-06-12 23:41:10 +0000
+++ debian/changelog 2019-06-17 20:09:21 +0000
@@ -2,6 +2,102 @@
22
3 * UNRELEASED3 * UNRELEASED
44
5 [ Jeffery To ]
6 * usr/bin/byobu-ctrl-a.in,
7 usr/bin/byobu-janitor.in,
8 usr/share/byobu/keybindings/f-keys.screen,
9 usr/share/byobu/keybindings/f-keys.tmux:
10 - Fix ^A unbinding: ^A is bound in f-keys.screen / f-keys.tmux to
11 autorun byobu-ctrl-a, but if the user selected a different key in
12 byobu-config, it would unbind the custom key instead of ^A
13 - Use functions to help make the logic easier to understand
14 - Add "custom" and "manual" modes, that only unbind ^A ("emacs" mode
15 would also set prefix to F12 for tmux, possibly overriding the
16 user's custom prefix); "custom" when it is detected that the user
17 has customized their prefix before byobu-ctrl-a was run for the
18 first time, "manual" when the user just wants to disable the
19 autorun
20 - Add an "autorun" command line option, used when byobu-ctrl-a is
21 triggered by the user pressing ^A; in this case, byobu-ctrl-a will
22 wait for the user to press enter/return before exiting, so that
23 the user can read the text output before the window auto-closes
24 - Add a quit option, so that the user can exit byobu-ctrl-a without
25 making any changes
26 * usr/bin/byobu-export.in,
27 usr/bin/byobu-janitor.in,
28 usr/bin/byobu-launch.in,
29 usr/bin/byobu-select-profile.in,
30 usr/bin/byobu-status-detail.in,
31 usr/bin/byobu-status.in,
32 usr/bin/byobu.in,
33 usr/lib/byobu/battery,
34 usr/lib/byobu/disk_io,
35 usr/lib/byobu/hostname,
36 usr/lib/byobu/include/common,
37 usr/lib/byobu/include/constants,
38 usr/lib/byobu/include/shutil,
39 usr/lib/byobu/ip_address,
40 usr/lib/byobu/memory,
41 usr/lib/byobu/release,
42 usr/lib/byobu/updates_available,
43 usr/lib/byobu/whoami,
44 usr/lib/byobu/wifi_quality:
45 - Add (and use) a byobu_test function to wrap $BYOBU_TEST
46 * usr/bin/byobu.in:
47 - Use "sh -n" to check $HOME/.byoburc, to avoid sourcing a
48 partially valid file
49 - Remove redundant sourcing of $HOME/.byoburc
50 - Set BYOBU_BACKEND before sourcing usr/lib/byobu/include/common, so
51 the latter doesn't need to look for a backend
52 - Remove sourcing of $BYOBU_CONFIG_DIR/backend, it is already
53 sourced by usr/lib/byobu/include/common
54 - Remove exporting of $BYOBU_BACKEND, this is already done in
55 usr/lib/byobu/include/constants
56 - Replace $HOME/.$PKG with $BYOBU_CONFIG_DIR
57 * usr/bin/byobu.in,
58 usr/share/byobu/profiles/byoburc,
59 usr/share/byobu/profiles/Makefile.am:
60 - Remove usr/share/byobu/profile/byoburc, since there are no longer
61 separate ".screenrc" and ".byoburc" configurations and it is
62 exactly the same as usr/share/byobu/profile/screenrc
63 * usr/bin/byobu-janitor.in:
64 - Remove unused variables
65 * usr/bin/byobu-status-detail.in:
66 - Use $BYOBU_TEST
67 * usr/bin/byobu-status-detail.in,
68 usr/bin/byobu-status.in:
69 - Remove unnecessary backticks; the command returns no output, only
70 the exit value is tested
71 * usr/bin/byobu-status.in:
72 - Include $BYOBU_CONFIG_DIR/datetime.tmux in the sourcing for loop
73 * usr/bin/byobu-status.in,
74 usr/lib/byobu/include/common,
75 usr/lib/byobu/include/dirs.in:
76 - Remove unnecessary directory existence test before "mkdir -p"
77 * usr/bin/byobu-select-profile.in:
78 - Update help message
79 - Remove $BYOBU_CONFIG_DIR/profile test, it is not used directly in
80 the script
81 - Restore list colors functionality
82 - Use local variables in functions
83 - Simplify color calculation
84 - Exit when --list / --help / invalid options are specified, before
85 making changes
86 - Removed -- option, command utilities that have a -- option expect
87 data to come after the --
88 * usr/lib/byobu/include/constants:
89 - Remove sourcing of files looking for $BYOBU_BACKEND, this is
90 already done in usr/lib/byobu/include/common
91 * usr/lib/byobu/include/dirs.in:
92 - Use BYOBU_CONFIG_DIR or XDG_CONFIG_HOME even if they do not exist
93 - Create new config dir in ~/.config, if it exists
94 - Use XDG_CACHE_HOME even if it does not exist
95 * usr/lib/byobu/users:
96 - Fix trailing '#' sign for screen
97 * usr/share/byobu/profiles/screenrc,
98 usr/share/byobu/profiles/tmuxrc:
99 - Fix header comment
100
5 -- Dustin Kirkland <kirkland@ubuntu.com> Wed, 12 Jun 2019 18:41:09 -0500101 -- Dustin Kirkland <kirkland@ubuntu.com> Wed, 12 Jun 2019 18:41:09 -0500
6102
7byobu (5.129-0ubuntu1) eoan; urgency=medium103byobu (5.129-0ubuntu1) eoan; urgency=medium
8104
=== modified file 'usr/bin/byobu-ctrl-a.in'
--- usr/bin/byobu-ctrl-a.in 2017-08-15 06:51:04 +0000
+++ usr/bin/byobu-ctrl-a.in 2019-06-17 20:09:21 +0000
@@ -17,11 +17,11 @@
17# You should have received a copy of the GNU General Public License17# You should have received a copy of the GNU General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.18# along with this program. If not, see <http://www.gnu.org/licenses/>.
1919
20Usage() {20usage() {
21 cat <<EOF21 cat <<EOF
22Usage: ${0##*/} [mode]22Usage: ${0##*/} [mode]
23 mode is one of 'screen' or 'emacs'23 mode is one of 'screen' or 'emacs'
24 if not specified, prompt the user24 if not specified, prompt the user
25EOF25EOF
26}26}
2727
@@ -30,47 +30,119 @@
30[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="@prefix@" || export BYOBU_PREFIX30[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="@prefix@" || export BYOBU_PREFIX
31. "${BYOBU_PREFIX}/lib/${PKG}/include/common"31. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
3232
33bind_to=""33bind_to=
34is_autorun=
35is_autorun_disabled=
34keybindings="$BYOBU_CONFIG_DIR/keybindings"36keybindings="$BYOBU_CONFIG_DIR/keybindings"
35[ "$BYOBU_BACKEND" = "tmux" ] && keybindings="$keybindings.tmux"37[ "$BYOBU_BACKEND" = "tmux" ] && keybindings="$keybindings.tmux"
36touch "$keybindings"38touch "$keybindings"
3739
40# may not work if a custom key was selected before (with ^${KEY} unbound)
41case $BYOBU_BACKEND in
42 screen) s='^bindkey "\^A"' ;;
43 tmux) s="^unbind-key -n C-a" ;;
44esac
45if grep -qs "$s" "$keybindings"; then
46 is_autorun_disabled=1
47fi
48
49# unbind ^A and not ^${KEY} because it is ^A in f-keys.screen / f-keys.tmux
50disable_autorun() {
51 local binding
52 case $BYOBU_BACKEND in
53 screen) binding='bindkey "^A"' ;;
54 tmux) binding="unbind-key -n C-a" ;;
55 esac
56 echo "$binding" >> "$keybindings"
57}
58
59clear_mode_bindings() {
60 case $BYOBU_BACKEND in
61 screen)
62 $BYOBU_SED_INLINE -e "/^register x /d" -e "/^escape /d" "$keybindings"
63 ;;
64 tmux)
65 $BYOBU_SED_INLINE -e "/^set -g prefix/d" -e "/ send-prefix/d" "$keybindings"
66 ;;
67 esac
68}
69
70set_emacs_mode_bindings() {
71 case $BYOBU_BACKEND in
72 screen)
73 :
74 ;;
75 tmux)
76 echo "set -g prefix F12" >> "$keybindings"
77 ;;
78 esac
79}
80
81set_screen_mode_bindings() {
82 case $BYOBU_BACKEND in
83 screen)
84 echo "escape \"^$KEY$key\"" >> "$keybindings"
85 echo "register x \"^$KEY\"" >> "$keybindings"
86 ;;
87 tmux)
88 if $BYOBU_BACKEND -V | grep " 1.5"; then
89 # tmux 1.5 supports a list of prefixes
90 echo "set -g prefix ^$KEY,F12" >> "$keybindings"
91 else
92 # tmux 1.6 and above supports prefix and prefix2
93 echo "set -g prefix ^$KEY" >> "$keybindings"
94 echo "set -g prefix2 F12" >> "$keybindings"
95 fi
96 echo "bind $key send-prefix" >> "$keybindings"
97 ;;
98 esac
99}
100
101reload_profile() {
102 case $BYOBU_BACKEND in
103 screen)
104 $BYOBU_BACKEND -X at 0 source "$BYOBU_CONFIG_DIR/profile"
105 ;;
106 tmux)
107 $BYOBU_BACKEND source "$BYOBU_PREFIX/share/byobu/profiles/tmuxrc" 2>/dev/null
108 ;;
109 esac
110}
111
38# If the user has already chosen an escape sequence, then112# If the user has already chosen an escape sequence, then
39# presumably they want ctrl-a to operate in emacs mode113# presumably they just want to disable autorun
40case "$BYOBU_BACKEND" in114if [ -z "$is_autorun_disabled" ]; then
41 "screen")115 case $BYOBU_BACKEND in
42 if grep -qs "^escape" "$keybindings"; then116 screen)
43 # Check for escape definition in local keybindings config117 if grep -qs "^escape" "$keybindings"; then
44 bind_to="emacs"118 # Check for escape definition in local keybindings config
45 fi119 bind_to=custom
46 ;;120 fi
47 "tmux")121 ;;
48 if grep -qs "^set -g prefix" "$keybindings"e; then122 tmux)
49 # Check for escape definition in local keybindings config123 if grep -qs "^set -g prefix" "$keybindings"; then
50 bind_to="emacs"124 # Check for escape definition in local keybindings config
51 fi125 bind_to=custom
52 # Check for some other escape sequence in tmux keys126 fi
53 if $BYOBU_BACKEND list-keys 2>/dev/null | grep -qs "^bind-key\s\+[^a]\s\+send-prefix"; then127 # Check for some other escape sequence in tmux keys
54 bind_to="emacs"128 if $BYOBU_BACKEND list-keys 2>/dev/null | grep "\ssend-prefix$" | grep -vqs "\sa\s\+send-prefix$"; then
55 fi129 bind_to=custom
56 ;;130 fi
57esac131 ;;
132 esac
133fi
58134
59case "${1}" in135case $1 in
60 -h|--help) Usage; exit 0;;136 -h|--help) usage; exit 0 ;;
61 screen) bind_to="screen";;137 screen) bind_to=screen ;;
62 emacs) bind_to="emacs";;138 emacs) bind_to=emacs ;;
139 autorun) is_autorun=1 ;;
63 "") :;;140 "") :;;
64 *) { Usage printf "%s\n" "Bad argument $1"; } 1>&2; exit 1;;141 *) { usage; printf "%s\n" "Bad argument: $1"; } 1>&2; exit 1;;
65esac142esac
66143
67if [ "${2}" ]; then144KEY=$(printf "${2:-A}" | $BYOBU_SED 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/')
68 KEY=$(printf "$2" | $BYOBU_SED 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/')145key=$(printf "$KEY" | $BYOBU_SED 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/')
69 key=$(printf "$2" | $BYOBU_SED 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/')
70else
71 KEY="A"
72 key="a"
73fi
74146
75while [ -z "$bind_to" ]; do147while [ -z "$bind_to" ]; do
76 echo148 echo
@@ -79,72 +151,73 @@
79 echo "When you press ctrl-a in Byobu, do you want it to operate in:"151 echo "When you press ctrl-a in Byobu, do you want it to operate in:"
80 echo " (1) Screen mode (GNU Screen's default escape sequence)"152 echo " (1) Screen mode (GNU Screen's default escape sequence)"
81 echo " (2) Emacs mode (go to beginning of line)"153 echo " (2) Emacs mode (go to beginning of line)"
154 if [ -z "$is_autorun_disabled" ]; then
155 echo " (M) Manual (I will configure this manually, don't ask me anymore)"
156 echo " (Q) Quit (ask me again later)"
157 else
158 echo " (Q) Quit (no change)"
159 fi
82 echo160 echo
83 echo "Note that:"161 echo "Note that:"
84 echo " - F12 also operates as an escape in Byobu"162 echo " - F12 also operates as an escape in Byobu"
85 echo " - You can press F9 and choose your escape character"163 echo " - You can press F9 and choose your escape character"
86 echo " - You can run 'byobu-ctrl-a' at any time to change your selection"164 echo " - You can run 'byobu-ctrl-a' at any time to change your selection"
87 echo165 echo
88 printf "Select [1 or 2]: "166 if [ -z "$is_autorun_disabled" ]; then
167 printf "Select [1 / 2 / M / Q]: "
168 else
169 printf "Select [1 / 2 / Q]: "
170 fi
89 s=$(head -n1)171 s=$(head -n1)
90 echo172 echo
91 case "$s" in173 case "$s" in
92 1) bind_to="screen"; break;;174 1) bind_to="screen"; break;;
93 2) bind_to="emacs"; break;;175 2) bind_to="emacs"; break;;
176 q|Q) break;;
177 m|M)
178 if [ -z "$is_autorun_disabled" ]; then
179 bind_to="manual"
180 break
181 fi
182 ;;
94 esac183 esac
95done184done
96185
97case "$bind_to" in186case "$bind_to" in
187 custom)
188 disable_autorun
189 reload_profile
190 echo "INFO: custom settings were found, no change to ctrl-a was made"
191 ;;
192 manual)
193 disable_autorun
194 reload_profile
195 echo "INFO: ctrl-a will no longer cause this prompt to appear"
196 ;;
98 emacs)197 emacs)
99 case "$BYOBU_BACKEND" in198 [ -n "$is_autorun_disabled" ] || disable_autorun
100 screen)199 clear_mode_bindings
101 $BYOBU_SED_INLINE -e "/^register x /d" -e "/^bindkey /d" -e "/^escape /d" "$keybindings"200 set_emacs_mode_bindings
102 echo "bindkey \"^${KEY}\"" >> "$keybindings"201 reload_profile
103 $BYOBU_BACKEND -X at 0 source "$BYOBU_CONFIG_DIR/profile"
104 ;;
105 tmux)
106 $BYOBU_SED_INLINE -e "/^set -g prefix/d" -e "/ send-prefix/d" -e "/^unbind-key -n C-${key}/d" "$keybindings"
107 echo "set -g prefix F12" >> "$keybindings"
108 echo "unbind-key -n C-${key}" >> "$keybindings"
109 $BYOBU_BACKEND source "$BYOBU_PREFIX/share/byobu/profiles/tmuxrc" 2>/dev/null
110 ;;
111 esac
112 echo "INFO: ctrl-a will now operate in emacs mode"202 echo "INFO: ctrl-a will now operate in emacs mode"
113 ;;203 ;;
114 screen)204 screen)
115 case "$BYOBU_BACKEND" in205 [ -n "$is_autorun_disabled" ] || disable_autorun
116 screen)206 clear_mode_bindings
117 $BYOBU_SED_INLINE -e "/^register x /d" -e "/^bindkey \"^\"/d" -e "/^escape /d" "$keybindings"207 set_screen_mode_bindings
118 echo "bindkey \"^${KEY}\"" >> "$keybindings"208 reload_profile
119 echo "escape \"^${KEY}${key}\"" >> "$keybindings"
120 echo "register x \"^${KEY}\"" >> "$keybindings"
121 $BYOBU_BACKEND -X at 0 source "$BYOBU_CONFIG_DIR/profile"
122 ;;
123 tmux)
124 $BYOBU_SED_INLINE -e "/^set -g prefix/d" -e "/ send-prefix/d" -e "/^unbind-key -n C-${key}/d" "$keybindings"
125 echo "unbind-key -n C-${key}" >> "$keybindings"
126 if $BYOBU_BACKEND -V | grep " 1.5"; then
127 # tmux 1.5 supports a list of prefixes
128 echo "set -g prefix ^${KEY},F12" >> "$keybindings"
129 else
130 # tmux 1.6 and above supports prefix and prefix2
131 echo "set -g prefix ^${KEY}" >> "$keybindings"
132 echo "set -g prefix2 F12" >> "$keybindings"
133 fi
134 echo "bind ${key} send-prefix" >> "$keybindings"
135 $BYOBU_BACKEND source "$BYOBU_PREFIX/share/byobu/profiles/tmuxrc" 2>/dev/null
136 ;;
137 esac
138 echo "INFO: ctrl-a will now operate in GNU Screen mode"209 echo "INFO: ctrl-a will now operate in GNU Screen mode"
139 ;;210 ;;
140 *)
141 echo "Error: bad value for binding: $bind_to"
142 ;;
143esac211esac
144212
145if [ -z "${2}" ]; then213if [ "$bind_to" != manual ]; then
146 echo "To modify this behavior again later, run 'byobu-ctrl-a'"214 echo "To modify this behavior again later, run 'byobu-ctrl-a'"
147 echo215 echo
148fi216fi
149217
218if [ -n "$is_autorun" ]; then
219 echo "Press enter/return to close this window..."
220 s=$(head -n1)
221fi
222
150# vi: syntax=sh ts=4 noexpandtab223# vi: syntax=sh ts=4 noexpandtab
151224
=== modified file 'usr/bin/byobu-export.in'
--- usr/bin/byobu-export.in 2019-05-26 19:18:53 +0000
+++ usr/bin/byobu-export.in 2019-06-17 20:09:21 +0000
@@ -22,7 +22,7 @@
22[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="@prefix@" || export BYOBU_PREFIX22[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="@prefix@" || export BYOBU_PREFIX
23. "${BYOBU_PREFIX}/lib/${PKG}/include/common"23. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
2424
25if eval $BYOBU_TEST gettext >/dev/null 2>&1; then25if byobu_test gettext; then
26 command=gettext26 command=gettext
27else27else
28 command=echo28 command=echo
2929
=== modified file 'usr/bin/byobu-janitor.in'
--- usr/bin/byobu-janitor.in 2019-05-26 19:18:06 +0000
+++ usr/bin/byobu-janitor.in 2019-06-17 20:09:21 +0000
@@ -36,13 +36,9 @@
36 exit 036 exit 0
37fi37fi
3838
39# Set the rest of the variables
40DEFAULT_PROFILE="light"
41PROFILE="$BYOBU_CONFIG_DIR/profile"
42
43# Create byobu-exchange buffer file, with secure permissions, if it doesn't exist39# Create byobu-exchange buffer file, with secure permissions, if it doesn't exist
44if ! [ -e "$BYOBU_RUN_DIR/printscreen" ]; then40if ! [ -e "$BYOBU_RUN_DIR/printscreen" ]; then
45 if eval $BYOBU_TEST install >/dev/null 2>&1; then41 if byobu_test install; then
46 install -m 600 /dev/null "$BYOBU_RUN_DIR/printscreen"42 install -m 600 /dev/null "$BYOBU_RUN_DIR/printscreen"
47 else43 else
48 cp /dev/null "$BYOBU_RUN_DIR/printscreen"44 cp /dev/null "$BYOBU_RUN_DIR/printscreen"
@@ -121,11 +117,11 @@
121# Affects: Upgrades from <= byobu 5.50, install byobu prompt if using stock bashrc117# Affects: Upgrades from <= byobu 5.50, install byobu prompt if using stock bashrc
122if [ -r /etc/skel/.bashrc ] && [ -r "$HOME/.bashrc" ] && [ -w "$HOME/.bashrc" ] && \118if [ -r /etc/skel/.bashrc ] && [ -r "$HOME/.bashrc" ] && [ -w "$HOME/.bashrc" ] && \
123 ! (grep -qs "#byobu-prompt#$" "$HOME/.bashrc") && ! [ -e "$BYOBU_CONFIG_DIR/prompt" ]; then119 ! (grep -qs "#byobu-prompt#$" "$HOME/.bashrc") && ! [ -e "$BYOBU_CONFIG_DIR/prompt" ]; then
124 if eval $BYOBU_TEST diff >/dev/null 2>&1; then120 if byobu_test diff; then
125 if diff /etc/skel/.bashrc "$HOME/.bashrc" >/dev/null 2>&1; then121 if diff /etc/skel/.bashrc "$HOME/.bashrc" >/dev/null 2>&1; then
126 printf "[ -r $BYOBU_CONFIG_DIR/prompt ] && . $BYOBU_CONFIG_DIR/prompt #byobu-prompt#\n" >> "$HOME/.bashrc"122 printf "[ -r $BYOBU_CONFIG_DIR/prompt ] && . $BYOBU_CONFIG_DIR/prompt #byobu-prompt#\n" >> "$HOME/.bashrc"
127 fi123 fi
128 elif eval $BYOBU_TEST md5sum >/dev/null 2>&1; then124 elif byobu_test md5sum; then
129 if [ "$(cat /etc/skel/.bashrc | md5sum)" = "$(cat $HOME/.bashrc | md5sum)" ]; then125 if [ "$(cat /etc/skel/.bashrc | md5sum)" = "$(cat $HOME/.bashrc | md5sum)" ]; then
130 printf "[ -r $BYOBU_CONFIG_DIR/prompt ] && . $BYOBU_CONFIG_DIR/prompt #byobu-prompt#\n" >> "$HOME/.bashrc"126 printf "[ -r $BYOBU_CONFIG_DIR/prompt ] && . $BYOBU_CONFIG_DIR/prompt #byobu-prompt#\n" >> "$HOME/.bashrc"
131 fi127 fi
@@ -136,4 +132,14 @@
136# Affects: Upgrades from <= byobu 5.126, clear out ec2/rcs cost statuses132# Affects: Upgrades from <= byobu 5.126, clear out ec2/rcs cost statuses
137rm -f "$BYOBU_RUN_DIR"/cache.tmux/ec2_cost* "$BYOBU_RUN_DIR"/cache.tmux/rcs_cost* "$BYOBU_RUN_DIR"/status.tmux/ec2_cost* "$BYOBU_RUN_DIR"/status.tmux/rcs_cost*133rm -f "$BYOBU_RUN_DIR"/cache.tmux/ec2_cost* "$BYOBU_RUN_DIR"/cache.tmux/rcs_cost* "$BYOBU_RUN_DIR"/status.tmux/ec2_cost* "$BYOBU_RUN_DIR"/status.tmux/rcs_cost*
138134
135# Affects: Upgrades from <= byobu 5.129, fix unbinding of ctrl-a binding (autorun byobu-ctrl-a)
136if grep '^bindkey "\^."$' "$BYOBU_CONFIG_DIR/keybindings" | grep -vqs '^bindkey "\^A"$'; then
137 $BYOBU_SED_INLINE -e '/^bindkey "\^."$/d' "$BYOBU_CONFIG_DIR/keybindings"
138 echo 'bindkey "^A"' >> "$BYOBU_CONFIG_DIR/keybindings"
139fi
140if grep "^unbind-key -n C-.$" "$BYOBU_CONFIG_DIR/keybindings.tmux" | grep -vqs "^unbind-key -n C-a$"; then
141 $BYOBU_SED_INLINE -e "/^unbind-key -n C-.$/d" "$BYOBU_CONFIG_DIR/keybindings.tmux"
142 echo "unbind-key -n C-a" >> "$BYOBU_CONFIG_DIR/keybindings.tmux"
143fi
144
139# vi: syntax=sh ts=4 noexpandtab145# vi: syntax=sh ts=4 noexpandtab
140146
=== modified file 'usr/bin/byobu-launch.in'
--- usr/bin/byobu-launch.in 2019-05-26 19:17:42 +0000
+++ usr/bin/byobu-launch.in 2019-06-17 20:09:21 +0000
@@ -51,7 +51,7 @@
51 *i*)51 *i*)
52 # Attempt to merge shell history across sessions/windows (works with some exceptions)52 # Attempt to merge shell history across sessions/windows (works with some exceptions)
53 for i in shopt setopt; do53 for i in shopt setopt; do
54 if eval $BYOBU_TEST $i >/dev/null; then54 if byobu_test $i; then
55 case $i in55 case $i in
56 shopt) $i -s histappend || true ;;56 shopt) $i -s histappend || true ;;
57 setopt) $i appendhistory || true ;;57 setopt) $i appendhistory || true ;;
5858
=== modified file 'usr/bin/byobu-select-profile.in'
--- usr/bin/byobu-select-profile.in 2018-08-12 14:43:52 +0000
+++ usr/bin/byobu-select-profile.in 2019-06-17 20:09:21 +0000
@@ -51,47 +51,51 @@
5151
52# Find a hash utility52# Find a hash utility
53for i in md5sum md5 sha512sum sha256sum sha1sum shasum shasum5.12 shasum5.10; do53for i in md5sum md5 sha512sum sha256sum sha1sum shasum shasum5.12 shasum5.10; do
54 if eval $BYOBU_TEST $i >/dev/null 2>&1; then54 if byobu_test $i; then
55 HASH="$i"55 HASH="$i"
56 break56 break
57 fi57 fi
58done58done
5959
60usage () {60usage () {
61 cat <<EOT61 cat <<EOF
62Usage: $0 [OPTION]62Usage: ${0##*/} [OPTION]
63 -l,--list list available profiles63 screen options:
64 -l,--list list available colors
64 -b,--background COLOR set the background color65 -b,--background COLOR set the background color
65 -f,--foreground COLOR set the foreground color66 -f,--foreground COLOR set the foreground color
66 -h,--hostnmae set the colors based on a hash of the hostname67
68 tmux options:
69 -h,--hostname set the colors based on a hash of the hostname
67 -i,--ip set the colors based on a hash of the ip70 -i,--ip set the colors based on a hash of the ip
68 -r,--random set the colors randomly71 -r,--random set the colors randomly
72
73 Other options:
69 --help this help74 --help this help
70EOT75
76 If multiple tmux options are specified, only the first one will
77 take effect.
78EOF
71}79}
7280
73# Initialize variables81# Initialize variables
74FILE="$BYOBU_CONFIG_DIR/color"82FILE="$BYOBU_CONFIG_DIR/color"
75PROFILE="$BYOBU_CONFIG_DIR/profile"
76[ -r "$PROFILE" ] || ln -sf $BYOBU_PREFIX/share/$PKG/profiles/common "$PROFILE"
77selected=-1
78color=
7983
80listprofiles() {84listcolors() {
81 # Display list of profiles, one per line85 local x
86 # Display list of colors, one per line
82 for x in $COLORS; do87 for x in $COLORS; do
83 echo "$x"88 echo "$x"
84 done89 done
85}90}
8691
87getletter() {92getletter() {
88 count=$(echo "$1" | wc -c)93 local letter
89 if [ "$count" = "2" ]; then94 if [ "${#1}" -eq 1 ]; then
90 echo "$1"95 echo "$1"
91 return96 return
92 fi97 fi
93 color="$1"98 case $1 in
94 case $color in
95 default_light) letter="d";;99 default_light) letter="d";;
96 default_dark) letter="D";;100 default_dark) letter="D";;
97 black) letter="k";;101 black) letter="k";;
@@ -117,8 +121,9 @@
117}121}
118122
119setcolor_screen() {123setcolor_screen() {
120 which="$1"124 local which="$1"
121 color="$2"125 local color="$2"
126 local FOREGROUND BACKGROUND MONOCHROME
122 [ -r $FILE ] && . $FILE127 [ -r $FILE ] && . $FILE
123 if [ "$which" = "foreground" ]; then128 if [ "$which" = "foreground" ]; then
124 FOREGROUND=$(getletter "$color")129 FOREGROUND=$(getletter "$color")
@@ -126,20 +131,20 @@
126 BACKGROUND=$(getletter "$color")131 BACKGROUND=$(getletter "$color")
127 fi132 fi
128 [ "$MONOCHROME" = "1" ] || MONOCHROME=0133 [ "$MONOCHROME" = "1" ] || MONOCHROME=0
129 printf "FOREGROUND=$FOREGROUND\nBACKGROUND=$BACKGROUND\nMONOCHROME=$MONOCHROME" > $FILE134 printf "FOREGROUND=$FOREGROUND\nBACKGROUND=$BACKGROUND\nMONOCHROME=$MONOCHROME\n" > $FILE
130 touch "$BYOBU_RUN_DIR/reload-required"135 touch "$BYOBU_RUN_DIR/reload-required"
131 $BYOBU_BACKEND -X at 0 source "$BYOBU_CONFIG_DIR/profile"136 screen -X at 0 source "$BYOBU_CONFIG_DIR/profile"
132}137}
133138
134get_contrast() {139get_contrast() {
135 # See section 2.2: http://www.w3.org/TR/AERT#color-contrast140 # See section 2.2: http://www.w3.org/TR/AERT#color-contrast
136 local awk="awk"
137 if eval $BYOBU_TEST gawk >/dev/null 2>&1; then
138 awk="gawk"
139 fi
140 local hex="$(echo "$1" | sed -e "s/\(..\)\(..\)\(..\)/\1 \2 \3/")"141 local hex="$(echo "$1" | sed -e "s/\(..\)\(..\)\(..\)/\1 \2 \3/")"
141 local bright=$(echo $hex | $awk --non-decimal-data '{printf "%0.0f",(("0x"$1)*299+("0x"$2)*587+("0x"$3)*114)/1000}')142 local dec h
142 if [ $bright -ge 130 ]; then143 for h in $hex; do
144 dec="$dec $((0x$h))"
145 done
146 local bright=$(echo $dec | awk '{printf "%0.0f",(($1*299)+($2*587)+($3*114))/1000}')
147 if [ "$bright" -ge 130 ]; then
143 _RET="black"148 _RET="black"
144 else149 else
145 _RET="white"150 _RET="white"
@@ -150,61 +155,83 @@
150 if [ "$BYOBU_BACKEND" != "tmux" ]; then155 if [ "$BYOBU_BACKEND" != "tmux" ]; then
151 echo "WARNING: This functionality is only supported in Byobu with the tmux backend" 1>&2156 echo "WARNING: This functionality is only supported in Byobu with the tmux backend" 1>&2
152 fi157 fi
153 dark="$1"158 local dark="$1"
154 get_contrast "$dark"159 get_contrast "$dark"
155 light="$_RET"160 local light="$_RET"
156 accent="magenta"161 local accent="magenta"
157 highlight="red"162 local highlight="red"
158 monochrome="0"163 local monochrome="0"
159 printf "BYOBU_DARK=\"$dark\"\nBYOBU_LIGHT=$light\nBYOBU_ACCENT=$accent\nBYOBU_HIGHLIGHT=$highlight\nMONOCHROME=$MONOCHROME" > "$FILE".tmux164 printf "BYOBU_DARK=\"#$dark\"\nBYOBU_LIGHT=$light\nBYOBU_ACCENT=$accent\nBYOBU_HIGHLIGHT=$highlight\nMONOCHROME=$monochrome\n" > "$FILE".tmux
160 tmux source "$BYOBU_PREFIX/share/byobu/profiles/tmuxrc"165 tmux source "$BYOBU_PREFIX/share/byobu/profiles/tmuxrc"
161}166}
162167
163if [ $# -eq 0 ]; then168if [ $# -eq 0 ]; then
164 usage169 usage
165else170 exit 0
166 while true; do171fi
167 case "$1" in172
168 -b|--background)173# Check options first, exit early if necessary
169 setcolor_screen "background" "$2"174for opt in "$@"; do
170 shift 2175 if [ -n "$ignore_next" ]; then
171 ;;176 ignore_next=
172 -f|--foreground)177 continue
173 setcolor_screen "foreground" "$2"178 fi
174 shift 2179 case $opt in
175 ;;180 -l|--list) listcolors; exit 0 ;;
176 -h|--hostname)181 -b|--background) ignore_next=1 ;;
177 color=$(hostname | $HASH | head -c 6)182 -f|--foreground) ignore_next=1 ;;
178 setcolor_tmux "$color"183 -h|--hostname) : ;;
179 shift184 -i|--ip) : ;;
180 break185 -r|--random) : ;;
181 ;;186 --help) usage; exit 0 ;;
182 -i|--ip)187 *) usage; exit 1 ;;
183 [ -r "$BYOBU_CONFIG_DIR/statusrc" ] && . "$BYOBU_CONFIG_DIR/statusrc"188 esac
184 . $BYOBU_PREFIX/lib/$PKG/ip_address189done
185 color=$(__ip_address t| $HASH | head -c 6)190
186 setcolor_tmux "$color"191# Was expecting an argument but it wasn't specified
187 shift192if [ -n "$ignore_next" ]; then
188 break193 usage
189 ;;194 exit 1
190 -r|--random)195fi
191 color=$(head -c 10 /dev/urandom | $HASH | head -c 6)196
192 setcolor_tmux "\#$color"197while [ "$#" -gt 0 ]; do
193 shift198 case $1 in
194 break199 -b|--background)
195 ;;200 setcolor_screen "background" "$2"
196 *)201 shift 2
197 usage202 ;;
198 exit 1203 -f|--foreground)
199 ;;204 setcolor_screen "foreground" "$2"
200 --)205 shift 2
201 shift206 ;;
202 break207 -h|--hostname)
203 ;;208 if byobu_test hostname; then
204 esac209 h=$(hostname)
205 [ $# -eq 0 ] && break210 elif [ -r /proc/sys/kernel/hostname ]; then
206 done211 read h < /proc/sys/kernel/hostname
207fi212 fi
213 color=$(echo "$h" | $HASH | head -c 6)
214 setcolor_tmux "$color"
215 break
216 ;;
217 -i|--ip)
218 [ -r "$BYOBU_CONFIG_DIR/statusrc" ] && . "$BYOBU_CONFIG_DIR/statusrc"
219 . $BYOBU_PREFIX/lib/$PKG/ip_address
220 color=$(__ip_address t| $HASH | head -c 6)
221 setcolor_tmux "$color"
222 break
223 ;;
224 -r|--random)
225 color=$(head -c 10 /dev/urandom | $HASH | head -c 6)
226 setcolor_tmux "$color"
227 break
228 ;;
229 *)
230 usage
231 exit 1
232 ;;
233 esac
234done
208235
209exit 0236exit 0
210237
211238
=== modified file 'usr/bin/byobu-status-detail.in'
--- usr/bin/byobu-status-detail.in 2016-04-07 22:07:52 +0000
+++ usr/bin/byobu-status-detail.in 2019-06-17 20:09:21 +0000
@@ -22,7 +22,7 @@
22[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="@prefix@" || export BYOBU_PREFIX22[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="@prefix@" || export BYOBU_PREFIX
23. "${BYOBU_PREFIX}/lib/${PKG}/include/common"23. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
2424
25if which vim >/dev/null && `vim --version | grep -q +folding`; then25if byobu_test vim && vim --version | grep -q +folding; then
26 byobu-status --detail | vim -c "set foldmethod=indent" -c "set foldminlines=0" -c "set foldnestmax=1" -c "set foldcolumn=2" -R -26 byobu-status --detail | vim -c "set foldmethod=indent" -c "set foldminlines=0" -c "set foldnestmax=1" -c "set foldcolumn=2" -R -
27else27else
28 byobu-status --detail | $BYOBU_PAGER28 byobu-status --detail | $BYOBU_PAGER
2929
=== modified file 'usr/bin/byobu-status.in'
--- usr/bin/byobu-status.in 2016-09-15 19:25:51 +0000
+++ usr/bin/byobu-status.in 2019-06-17 20:09:21 +0000
@@ -26,16 +26,15 @@
26# Make sure status is not disabled26# Make sure status is not disabled
27[ -f "$BYOBU_CONFIG_DIR/status.disable" ] && exit 027[ -f "$BYOBU_CONFIG_DIR/status.disable" ] && exit 0
2828
29# Clean and create cache directories29# Create cache directories
30[ -d "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND" ] || mkdir -p "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND"30mkdir -p "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND"
31[ -d "$BYOBU_RUN_DIR/.last.$BYOBU_BACKEND" ] || mkdir -p "$BYOBU_RUN_DIR/.last.$BYOBU_BACKEND"31mkdir -p "$BYOBU_RUN_DIR/.last.$BYOBU_BACKEND"
3232
33# Source configurations33# Source configurations
34. "${BYOBU_PREFIX}/lib/${PKG}/include/icons"34. "${BYOBU_PREFIX}/lib/${PKG}/include/icons"
35for i in "${BYOBU_PREFIX}/share/$PKG/status/status" "${BYOBU_PREFIX}/share/$PKG/status/statusrc" "$BYOBU_CONFIG_DIR/status" "$BYOBU_CONFIG_DIR/statusrc" "$BYOBU_CONFIG_DIR/color" "$BYOBU_CONFIG_DIR/color.tmux"; do35for i in "${BYOBU_PREFIX}/share/$PKG/status/status" "${BYOBU_PREFIX}/share/$PKG/status/statusrc" "$BYOBU_CONFIG_DIR/status" "$BYOBU_CONFIG_DIR/statusrc" "$BYOBU_CONFIG_DIR/color" "$BYOBU_CONFIG_DIR/color.tmux" "$BYOBU_CONFIG_DIR/datetime.tmux"; do
36 [ -r "$i" ] && . "$i"36 [ -r "$i" ] && . "$i"
37done37done
38[ -r "$BYOBU_CONFIG_DIR/datetime.tmux" ] && . "$BYOBU_CONFIG_DIR/datetime.tmux"
3938
40case "$BYOBU_BACKEND" in39case "$BYOBU_BACKEND" in
41 screen)40 screen)
@@ -153,11 +152,11 @@
153 ;;152 ;;
154 --detail)153 --detail)
155 VER=154 VER=
156 if eval $BYOBU_TEST dpkg-query >/dev/null; then155 if byobu_test dpkg-query; then
157 VER=$(set -- $(dpkg-query --show $PKG); printf "%s\n" "$2")156 VER=$(set -- $(dpkg-query --show $PKG); printf "%s\n" "$2")
158 fi157 fi
159 printf "$PKG-$VER Detailed Status Navigation\n"158 printf "$PKG-$VER Detailed Status Navigation\n"
160 if eval $BYOBU_TEST vim >/dev/null && `vim --version | grep -q +folding`; then159 if byobu_test vim && vim --version | grep -q +folding; then
161 printf " Expand all - zr\t\tCollapse all - zm\n Expand one - zo\t\tCollapse one - zc\n\n"160 printf " Expand all - zr\t\tCollapse all - zm\n Expand one - zo\t\tCollapse one - zc\n\n"
162 fi161 fi
163 for i in "$BYOBU_PREFIX/lib/$PKG"/*; do162 for i in "$BYOBU_PREFIX/lib/$PKG"/*; do
164163
=== modified file 'usr/bin/byobu.in'
--- usr/bin/byobu.in 2019-06-12 23:41:10 +0000
+++ usr/bin/byobu.in 2019-06-17 20:09:21 +0000
@@ -35,7 +35,11 @@
35# Source local byobu config35# Source local byobu config
36if [ -r "$HOME/.byoburc" ]; then36if [ -r "$HOME/.byoburc" ]; then
37 # Ensure that this configuration is usable37 # Ensure that this configuration is usable
38 . "$HOME/.byoburc" || mv -f "$HOME/.byoburc" "$HOME/.byoburc".orig38 if sh -n "$HOME/.byoburc" >/dev/null 2>&1; then
39 . "$HOME/.byoburc"
40 else
41 mv -f "$HOME/.byoburc" "$HOME/.byoburc".orig
42 fi
39fi43fi
40if [ -z "${BYOBU_PREFIX}" ]; then44if [ -z "${BYOBU_PREFIX}" ]; then
41 # Find and export the installation location prefix45 # Find and export the installation location prefix
@@ -43,26 +47,22 @@
43 prefix="$(dirname $(dirname $($BYOBU_READLINK -f $0)))"47 prefix="$(dirname $(dirname $($BYOBU_READLINK -f $0)))"
44 if [ "$prefix" != "@prefix@" ]; then48 if [ "$prefix" != "@prefix@" ]; then
45 echo "export BYOBU_PREFIX='$prefix'" >> "$HOME/.byoburc"49 echo "export BYOBU_PREFIX='$prefix'" >> "$HOME/.byoburc"
46 . "$HOME/.byoburc"50 BYOBU_PREFIX="$prefix"
47 fi51 fi
48fi52fi
49export BYOBU_CHARMAP=$(locale charmap)53export BYOBU_CHARMAP=$(locale charmap)
50[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
51[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="@prefix@" || export BYOBU_PREFIX
52. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
5354
54# Override backend if we can determine intentions from argv[0]55# Override backend if we can determine intentions from argv[0]
55[ -r "$HOME/.$PKG/backend" ] && . "$HOME/.$PKG/backend"
56case "$0" in56case "$0" in
57 *byobu-screen) BYOBU_BACKEND="screen" ;;57 *byobu-screen) BYOBU_BACKEND="screen" ;;
58 *byobu-tmux) BYOBU_BACKEND="tmux" ;;58 *byobu-tmux) BYOBU_BACKEND="tmux" ;;
59esac59esac
6060
61# At this point, we're sure BYOBU_BACKEND is properly defined61[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="@prefix@" || export BYOBU_PREFIX
62export BYOBU_BACKEND62. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
6363
64# Store the parent tty64# Store the parent tty
65if eval $BYOBU_TEST tty >/dev/null 2>&1; then65if byobu_test tty; then
66 export BYOBU_TTY=$(tty)66 export BYOBU_TTY=$(tty)
67else67else
68 export BYOBU_TTY=$(readlink /proc/$$/fd/0)68 export BYOBU_TTY=$(readlink /proc/$$/fd/0)
@@ -76,7 +76,7 @@
76 case "$1" in76 case "$1" in
77 -v|--version)77 -v|--version)
78 echo "$PKG version $VERSION"78 echo "$PKG version $VERSION"
79 if eval $BYOBU_TEST bash >/dev/null 2>&1; then79 if byobu_test bash; then
80 # Check ulimits80 # Check ulimits
81 u=$(bash -c "ulimit -n")81 u=$(bash -c "ulimit -n")
82 [ "$u" = "unlimited" ] || [ $u -ge 15 ] || echo "WARNING: ulimit -n is too low" 1>&282 [ "$u" = "unlimited" ] || [ $u -ge 15 ] || echo "WARNING: ulimit -n is too low" 1>&2
@@ -122,7 +122,7 @@
122122
123# Check if our terminfo supports 256 colors123# Check if our terminfo supports 256 colors
124CAN_SHOW_COLORS=124CAN_SHOW_COLORS=
125if eval $BYOBU_TEST tput >/dev/null 2>&1; then125if byobu_test tput; then
126 if [ "$(tput colors 2>/dev/null || echo 0)" = "256" ]; then126 if [ "$(tput colors 2>/dev/null || echo 0)" = "256" ]; then
127 CAN_SHOW_COLORS=1127 CAN_SHOW_COLORS=1
128 fi128 fi
@@ -130,7 +130,7 @@
130130
131# Check if the color terminfo is available131# Check if the color terminfo is available
132HAS_COLOR_TERM=132HAS_COLOR_TERM=
133if eval $BYOBU_TEST infocmp >/dev/null 2>&1; then133if byobu_test infocmp; then
134 if infocmp "$BYOBU_COLOR_TERM" >/dev/null 2>&1; then134 if infocmp "$BYOBU_COLOR_TERM" >/dev/null 2>&1; then
135 HAS_COLOR_TERM=1135 HAS_COLOR_TERM=1
136 fi136 fi
@@ -151,7 +151,7 @@
151 fi151 fi
152 BYOBU_PROFILE="-f $BYOBU_PREFIX/share/$PKG/profiles/tmuxrc"152 BYOBU_PROFILE="-f $BYOBU_PREFIX/share/$PKG/profiles/tmuxrc"
153 # Set default window, unless user has overriden153 # Set default window, unless user has overriden
154 if egrep -qs "default-command|default-shell" $HOME/.$PKG/.tmux.conf >/dev/null 2>&1; then154 if egrep -qs "default-command|default-shell" "$BYOBU_CONFIG_DIR/.tmux.conf" >/dev/null 2>&1; then
155 DEFAULT_WINDOW=155 DEFAULT_WINDOW=
156 else156 else
157 DEFAULT_WINDOW="new-session -n $BYOBU_WINDOW_NAME ${BYOBU_PREFIX}/bin/byobu-shell"157 DEFAULT_WINDOW="new-session -n $BYOBU_WINDOW_NAME ${BYOBU_PREFIX}/bin/byobu-shell"
@@ -191,13 +191,7 @@
191 fi191 fi
192 fi192 fi
193 SCREEN_TERM="-T $BYOBU_TERM"193 SCREEN_TERM="-T $BYOBU_TERM"
194 # Some users want to maintain separate configurations194 BYOBU_PROFILE="-c $BYOBU_PREFIX/share/$PKG/profiles/screenrc"
195 # if they use both GNU Screen and byobu on the same system
196 if [ -r "$BYOBU_CONFIG_DIR/.screenrc" ]; then
197 BYOBU_PROFILE="-c $BYOBU_PREFIX/share/$PKG/profiles/byoburc"
198 else
199 BYOBU_PROFILE="-c $BYOBU_PREFIX/share/$PKG/profiles/screenrc"
200 fi
201 BYOBU_SESSION_NAME="-S $PKG"195 BYOBU_SESSION_NAME="-S $PKG"
202 # Zero out $BYOBU_SESSION_NAME if user has specified a session name196 # Zero out $BYOBU_SESSION_NAME if user has specified a session name
203 for i in "$@"; do197 for i in "$@"; do
204198
=== modified file 'usr/lib/byobu/battery'
--- usr/lib/byobu/battery 2016-09-15 19:25:51 +0000
+++ usr/lib/byobu/battery 2019-06-17 20:09:21 +0000
@@ -77,7 +77,7 @@
77 esac77 esac
78 done78 done
79 # Mac OS X support79 # Mac OS X support
80 if eval $BYOBU_TEST /usr/sbin/ioreg >/dev/null 2>&1; then80 if byobu_test /usr/sbin/ioreg; then
81 # MacOS support81 # MacOS support
82 local key82 local key
83 for key in CurrentCapacity MaxCapacity ExternalChargeCapable FullyCharged; do83 for key in CurrentCapacity MaxCapacity ExternalChargeCapable FullyCharged; do
8484
=== modified file 'usr/lib/byobu/disk_io'
--- usr/lib/byobu/disk_io 2019-06-12 00:01:41 +0000
+++ usr/lib/byobu/disk_io 2019-06-17 20:09:21 +0000
@@ -20,7 +20,7 @@
20# along with this program. If not, see <http://www.gnu.org/licenses/>.20# along with this program. If not, see <http://www.gnu.org/licenses/>.
2121
22__disk_io_detail() {22__disk_io_detail() {
23 if eval $BYOBU_TEST iostat >/dev/null; then23 if byobu_test iostat; then
24 iostat -d -m -h24 iostat -d -m -h
25 else25 else
26 printf "%s\n" "Please install iostat if you want detailed information on your disk throughput"26 printf "%s\n" "Please install iostat if you want detailed information on your disk throughput"
2727
=== modified file 'usr/lib/byobu/hostname'
--- usr/lib/byobu/hostname 2019-05-26 19:12:44 +0000
+++ usr/lib/byobu/hostname 2019-06-17 20:09:21 +0000
@@ -25,7 +25,7 @@
2525
26__hostname() {26__hostname() {
27 local h=27 local h=
28 if eval $BYOBU_TEST hostname >/dev/null 2>&1; then28 if byobu_test hostname; then
29 h=$(hostname -s 2>/dev/null || hostname)29 h=$(hostname -s 2>/dev/null || hostname)
30 elif [ -r /proc/sys/kernel/hostname ]; then30 elif [ -r /proc/sys/kernel/hostname ]; then
31 read h < /proc/sys/kernel/hostname31 read h < /proc/sys/kernel/hostname
3232
=== modified file 'usr/lib/byobu/include/common'
--- usr/lib/byobu/include/common 2016-09-15 19:25:51 +0000
+++ usr/lib/byobu/include/common 2019-06-17 20:09:21 +0000
@@ -27,6 +27,10 @@
27 eval $BYOBU_TEST ls >/dev/null 2>&1 && break || true27 eval $BYOBU_TEST ls >/dev/null 2>&1 && break || true
28 done28 done
2929
30 byobu_test() {
31 eval $BYOBU_TEST "$1" >/dev/null 2>&1
32 }
33
30 # If the backend is already set (eg. running `byobu-tmux`), do nothing.34 # If the backend is already set (eg. running `byobu-tmux`), do nothing.
31 if [ -z "${BYOBU_BACKEND}" ]; then35 if [ -z "${BYOBU_BACKEND}" ]; then
32 [ -r "/etc/$PKG/backend" ] && . "/etc/$PKG/backend"36 [ -r "/etc/$PKG/backend" ] && . "/etc/$PKG/backend"
@@ -34,9 +38,9 @@
34 # Just in case there's no config file at all38 # Just in case there's no config file at all
35 if [ -z "${BYOBU_BACKEND}" ]; then39 if [ -z "${BYOBU_BACKEND}" ]; then
36 # New byobu configuration, default to tmux40 # New byobu configuration, default to tmux
37 if eval $BYOBU_TEST tmux >/dev/null; then41 if byobu_test tmux; then
38 BYOBU_BACKEND="tmux"42 BYOBU_BACKEND="tmux"
39 elif eval $BYOBU_TEST screen >/dev/null; then43 elif byobu_test screen; then
40 BYOBU_BACKEND="screen"44 BYOBU_BACKEND="screen"
41 else45 else
42 printf "%s\n" "ERROR: $PKG won't work without tmux or screen installed" 1>&246 printf "%s\n" "ERROR: $PKG won't work without tmux or screen installed" 1>&2
@@ -45,7 +49,7 @@
45 fi49 fi
4650
47 # Creating backend cache51 # Creating backend cache
48 [ -d "$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND" ] || mkdir -p "$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND"52 mkdir -p "$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND"
4953
50 . "${BYOBU_PREFIX}/lib/${PKG}/include/shutil"54 . "${BYOBU_PREFIX}/lib/${PKG}/include/shutil"
51 . "${BYOBU_PREFIX}/lib/${PKG}/include/constants"55 . "${BYOBU_PREFIX}/lib/${PKG}/include/constants"
5256
=== modified file 'usr/lib/byobu/include/constants'
--- usr/lib/byobu/include/constants 2018-04-11 15:16:45 +0000
+++ usr/lib/byobu/include/constants 2019-06-17 20:09:21 +0000
@@ -26,10 +26,6 @@
26PCT="%"26PCT="%"
2727
28# Support two different backends (screen/tmux)28# Support two different backends (screen/tmux)
29if [ -z "$BYOBU_BACKEND" ]; then
30 [ -r "/etc/byobu/backend" ] && . "/etc/byobu/backend"
31 [ -r "$BYOBU_CONFIG_DIR/backend" ] && . "$BYOBU_CONFIG_DIR/backend"
32fi
33case "$BYOBU_BACKEND" in29case "$BYOBU_BACKEND" in
34 tmux)30 tmux)
35 export BYOBU_BACKEND31 export BYOBU_BACKEND
@@ -44,18 +40,18 @@
44esac40esac
4541
46# MacOS Support42# MacOS Support
47eval $BYOBU_TEST gsed >/dev/null 2>&1 && export BYOBU_SED="gsed" || export BYOBU_SED="sed"43byobu_test gsed && export BYOBU_SED="gsed" || export BYOBU_SED="sed"
48eval $BYOBU_TEST greadlink >/dev/null 2>&1 && export BYOBU_READLINK="greadlink" || export BYOBU_READLINK="readlink"44byobu_test greadlink && export BYOBU_READLINK="greadlink" || export BYOBU_READLINK="readlink"
49eval $BYOBU_TEST sensible-pager >/dev/null 2>&1 && export BYOBU_PAGER="sensible-pager" || export BYOBU_PAGER="less"45byobu_test sensible-pager && export BYOBU_PAGER="sensible-pager" || export BYOBU_PAGER="less"
50eval $BYOBU_TEST sensible-editor >/dev/null 2>&1 && export BYOBU_EDITOR="sensible-editor" || export BYOBU_EDITOR="$EDITOR"46byobu_test sensible-editor && export BYOBU_EDITOR="sensible-editor" || export BYOBU_EDITOR="$EDITOR"
51eval $BYOBU_TEST "$BYOBU_EDITOR" >/dev/null 2>&1 || export BYOBU_EDITOR="vim"47byobu_test "$BYOBU_EDITOR" || export BYOBU_EDITOR="vim"
5248
5349
54# Check sed's follow-symlinks feature50# Check sed's follow-symlinks feature
55$BYOBU_SED --follow-symlinks "s///" /dev/null 2>/dev/null && BYOBU_SED_INLINE="$BYOBU_SED -i --follow-symlinks" || BYOBU_SED_INLINE="$BYOBU_SED -i"51$BYOBU_SED --follow-symlinks "s///" /dev/null 2>/dev/null && BYOBU_SED_INLINE="$BYOBU_SED -i --follow-symlinks" || BYOBU_SED_INLINE="$BYOBU_SED -i"
5652
57# Determine if we have ulimit support53# Determine if we have ulimit support
58eval $BYOBU_TEST ulimit >/dev/null 2>&1 && export BYOBU_ULIMIT="ulimit" || export BYOBU_ULIMIT="false"54byobu_test ulimit && export BYOBU_ULIMIT="ulimit" || export BYOBU_ULIMIT="false"
5955
60# Find a suitable python interpreter, if undefined56# Find a suitable python interpreter, if undefined
61if [ -z "$BYOBU_PYTHON" ]; then57if [ -z "$BYOBU_PYTHON" ]; then
6258
=== modified file 'usr/lib/byobu/include/dirs.in'
--- usr/lib/byobu/include/dirs.in 2016-04-07 22:07:52 +0000
+++ usr/lib/byobu/include/dirs.in 2019-06-17 20:09:21 +0000
@@ -25,22 +25,29 @@
25[ -n "$BYOBU_PREFIX" ] || BYOBU_PREFIX="@prefix@"25[ -n "$BYOBU_PREFIX" ] || BYOBU_PREFIX="@prefix@"
2626
27# Create and export the user configuration directory27# Create and export the user configuration directory
28if [ -d "$BYOBU_CONFIG_DIR" ]; then28if [ -n "$BYOBU_CONFIG_DIR" ]; then
29 export BYOBU_CONFIG_DIR="$BYOBU_CONFIG_DIR"29 # Explicitly told to use this location, even if it does not exist yet
30elif [ -d "$XDG_CONFIG_HOME" ]; then30 :
31 # Use XDG, as some users insist on such nonsense :-)31elif [ -n "$XDG_CONFIG_HOME" ]; then
32 export BYOBU_CONFIG_DIR="$XDG_CONFIG_HOME/$PKG"32 # Presumably set explicitly, use even if it doesn't exist yet
33 BYOBU_CONFIG_DIR="$XDG_CONFIG_HOME/$PKG"
33elif [ -d "$HOME/.config/$PKG" ]; then34elif [ -d "$HOME/.config/$PKG" ]; then
34 # Use XDG config directory, if it exists35 # Use XDG config directory, if it exists
35 export BYOBU_CONFIG_DIR="$HOME/.config/$PKG"36 BYOBU_CONFIG_DIR="$HOME/.config/$PKG"
36elif [ -d "$HOME/.local/share/$PKG" ]; then37elif [ -d "$HOME/.local/share/$PKG" ]; then
37 # Use XDG local directory, if it exists38 # Use XDG local directory, if it exists
38 export BYOBU_CONFIG_DIR="$HOME/.local/share/$PKG"39 BYOBU_CONFIG_DIR="$HOME/.local/share/$PKG"
40elif [ -d "$HOME/.$PKG" ]; then
41 # Use classic config dir location, if it exists
42 BYOBU_CONFIG_DIR="$HOME/.$PKG"
43elif [ -d "$HOME/.config" ]; then
44 # Create new config in XDG config directory
45 BYOBU_CONFIG_DIR="$HOME/.config/$PKG"
39else46else
40 # And to default to good old classic config dir location!47 # And to default to good old classic config dir location!
41 export BYOBU_CONFIG_DIR="$HOME/.$PKG"48 BYOBU_CONFIG_DIR="$HOME/.$PKG"
42fi49fi
43[ -d "$BYOBU_CONFIG_DIR" ] || mkdir -p "$BYOBU_CONFIG_DIR/bin"50mkdir -p "$BYOBU_CONFIG_DIR/bin"
4451
45# Grab the global, then local socket directory52# Grab the global, then local socket directory
46[ -r "/etc/$PKG/socketdir" ] && . "/etc/$PKG/socketdir"53[ -r "/etc/$PKG/socketdir" ] && . "/etc/$PKG/socketdir"
@@ -51,22 +58,24 @@
51 # Use shm for performance, if possible58 # Use shm for performance, if possible
52 for i in /dev/shm/$PKG-$USER-*; do59 for i in /dev/shm/$PKG-$USER-*; do
53 if [ -d "$i" ] && [ -O "$i" ]; then60 if [ -d "$i" ] && [ -O "$i" ]; then
54 export BYOBU_RUN_DIR="$i"61 BYOBU_RUN_DIR="$i"
55 break62 break
56 fi63 fi
57 done64 done
58 # Still empty, make a new one65 # Still empty, make a new one
59 if [ ! -d "$BYOBU_RUN_DIR" ] || [ ! -O "$BYOBU_RUN_DIR" ]; then66 if [ ! -d "$BYOBU_RUN_DIR" ] || [ ! -O "$BYOBU_RUN_DIR" ]; then
60 export BYOBU_RUN_DIR=$(mktemp -d /dev/shm/$PKG-$USER-XXXXXXXX)67 BYOBU_RUN_DIR=$(mktemp -d /dev/shm/$PKG-$USER-XXXXXXXX)
61 fi68 fi
62fi69fi
63if [ ! -d "$BYOBU_RUN_DIR" ] || [ ! -O "$BYOBU_RUN_DIR" ] || [ ! -w "$BYOBU_RUN_DIR" ]; then70if [ ! -d "$BYOBU_RUN_DIR" ] || [ ! -O "$BYOBU_RUN_DIR" ] || [ ! -w "$BYOBU_RUN_DIR" ]; then
64 # For distros that don't have a /dev/shm, use local disk71 # For distros that don't have a /dev/shm, use local disk
65 if [ -d "$XDG_CACHE_HOME" ]; then72 if [ -n "$XDG_CACHE_HOME" ]; then
66 # Use XDG, as some users insist on such nonsense :-)73 # Use XDG, as some users insist on such nonsense :-)
67 export BYOBU_RUN_DIR="$XDG_CACHE_HOME/$PKG"74 BYOBU_RUN_DIR="$XDG_CACHE_HOME/$PKG"
68 else75 else
69 # But if not, we'll use a cache directory76 # But if not, we'll use a cache directory
70 export BYOBU_RUN_DIR="$HOME/.cache/$PKG"77 BYOBU_RUN_DIR="$HOME/.cache/$PKG"
71 fi78 fi
72fi79fi
80
81export BYOBU_CONFIG_DIR BYOBU_RUN_DIR
7382
=== modified file 'usr/lib/byobu/include/shutil'
--- usr/lib/byobu/include/shutil 2018-08-12 16:28:39 +0000
+++ usr/lib/byobu/include/shutil 2019-06-17 20:09:21 +0000
@@ -300,7 +300,7 @@
300 [ "$Mask" = "00000000" ] && break300 [ "$Mask" = "00000000" ] && break
301 done < /proc/net/route301 done < /proc/net/route
302 _RET="$Iface"302 _RET="$Iface"
303 elif eval $BYOBU_TEST route >/dev/null 2>&1; then303 elif byobu_test route; then
304 # Route command on path304 # Route command on path
305 _RET=$(route get default|grep interface:|awk '{print $2}')305 _RET=$(route get default|grep interface:|awk '{print $2}')
306 elif [ -x "/sbin/route" ]; then306 elif [ -x "/sbin/route" ]; then
@@ -340,7 +340,7 @@
340 distro="${issue%% *}";340 distro="${issue%% *}";
341 ;;341 ;;
342 esac342 esac
343 elif eval $BYOBU_TEST lsb_release >/dev/null 2>&1; then343 elif byobu_test lsb_release; then
344 # If lsb_release is available, use it344 # If lsb_release is available, use it
345 local r=$(lsb_release -s -d)345 local r=$(lsb_release -s -d)
346 case "$r" in346 case "$r" in
@@ -354,9 +354,9 @@
354 distro=$(lsb_release -s -i)354 distro=$(lsb_release -s -i)
355 ;;355 ;;
356 esac356 esac
357 elif eval $BYOBU_TEST sw_vers >/dev/null 2>&1; then357 elif byobu_test sw_vers; then
358 distro="$(sw_vers -productName)"358 distro="$(sw_vers -productName)"
359 elif eval $BYOBU_TEST uname >/dev/null 2>&1; then359 elif byobu_test uname; then
360 distro="$(uname -s)"360 distro="$(uname -s)"
361 else361 else
362 distro="Byobu"362 distro="Byobu"
363363
=== modified file 'usr/lib/byobu/ip_address'
--- usr/lib/byobu/ip_address 2018-08-12 14:07:40 +0000
+++ usr/lib/byobu/ip_address 2019-06-17 20:09:21 +0000
@@ -47,7 +47,7 @@
47 # Background an update47 # Background an update
48 if [ -x /sbin/ip ]; then48 if [ -x /sbin/ip ]; then
49 LC_ALL=C /sbin/ip -6 addr list dev "$interface" scope global </dev/null >"$cache" 2>/dev/null &49 LC_ALL=C /sbin/ip -6 addr list dev "$interface" scope global </dev/null >"$cache" 2>/dev/null &
50 elif eval $BYOBU_TEST ifconfig >/dev/null 2>&1; then50 elif byobu_test ifconfig; then
51 LC_ALL=c ifconfig "$interface" | grep "inet6 " | awk '{print $2}' | sed -e "s/%.*//" >"$cache" 2>/dev/null &51 LC_ALL=c ifconfig "$interface" | grep "inet6 " | awk '{print $2}' | sed -e "s/%.*//" >"$cache" 2>/dev/null &
5252
53 fi53 fi
@@ -73,7 +73,7 @@
73 ipaddr=$(LC_ALL=C /sbin/ip -4 addr list dev "$interface" scope global 2>/dev/null)73 ipaddr=$(LC_ALL=C /sbin/ip -4 addr list dev "$interface" scope global 2>/dev/null)
74 ipaddr=${ipaddr#* inet }74 ipaddr=${ipaddr#* inet }
75 ipaddr=${ipaddr%%/*}75 ipaddr=${ipaddr%%/*}
76 elif eval $BYOBU_TEST ifconfig >/dev/null 2>&1; then76 elif byobu_test ifconfig; then
77 ipaddr=$(ifconfig "$interface" | grep "inet " | awk '{print $2}')77 ipaddr=$(ifconfig "$interface" | grep "inet " | awk '{print $2}')
78 fi78 fi
79 fi79 fi
8080
=== modified file 'usr/lib/byobu/memory'
--- usr/lib/byobu/memory 2016-09-15 19:25:51 +0000
+++ usr/lib/byobu/memory 2019-06-17 20:09:21 +0000
@@ -36,7 +36,7 @@
36 esac36 esac
37 [ -n "${free}" -a -n "${total}" -a -n "${buffers}" -a -n "${cached}" ] && break;37 [ -n "${free}" -a -n "${total}" -a -n "${buffers}" -a -n "${cached}" ] && break;
38 done < /proc/meminfo38 done < /proc/meminfo
39 elif eval $BYOBU_TEST vm_stat >/dev/null 2>&1; then39 elif byobu_test vm_stat; then
40 # MacOS support40 # MacOS support
41 # calculation borrowed from http://apple.stackexchange.com/a/48195/1885741 # calculation borrowed from http://apple.stackexchange.com/a/48195/18857
42 free_blocks=$(vm_stat | grep free | awk '{ print $3 }' | sed -e 's/\.//')42 free_blocks=$(vm_stat | grep free | awk '{ print $3 }' | sed -e 's/\.//')
4343
=== modified file 'usr/lib/byobu/release'
--- usr/lib/byobu/release 2019-05-26 19:14:28 +0000
+++ usr/lib/byobu/release 2019-06-17 20:09:21 +0000
@@ -46,10 +46,10 @@
46 RELEASE="$ver"46 RELEASE="$ver"
47 ;;47 ;;
48 esac48 esac
49 elif eval $BYOBU_TEST sw_vers >/dev/null 2>&1; then49 elif byobu_test sw_vers; then
50 RELEASE="$(sw_vers -productVersion)"50 RELEASE="$(sw_vers -productVersion)"
51 fi51 fi
52 if [ -z "$RELEASE" ] && eval $BYOBU_TEST lsb_release >/dev/null 2>&1; then52 if [ -z "$RELEASE" ] && byobu_test lsb_release; then
53 # If lsb_release is available, use it53 # If lsb_release is available, use it
54 RELEASE=$(lsb_release -s -r)54 RELEASE=$(lsb_release -s -r)
55 fi55 fi
5656
=== modified file 'usr/lib/byobu/updates_available'
--- usr/lib/byobu/updates_available 2019-05-26 19:15:34 +0000
+++ usr/lib/byobu/updates_available 2019-06-17 20:09:21 +0000
@@ -51,32 +51,32 @@
51 if [ -x /usr/lib/update-notifier/apt-check ]; then51 if [ -x /usr/lib/update-notifier/apt-check ]; then
52 # If apt-check binary exists, use it52 # If apt-check binary exists, use it
53 flock -xn "$flock" sh -c "(/usr/lib/update-notifier/apt-check 2>&1 | awk '-F;' 'END { print \$1, \$2 }' >\"${mycache}-x\" 2>/dev/null ; mv \"${mycache}-x\" \"$mycache\")" &53 flock -xn "$flock" sh -c "(/usr/lib/update-notifier/apt-check 2>&1 | awk '-F;' 'END { print \$1, \$2 }' >\"${mycache}-x\" 2>/dev/null ; mv \"${mycache}-x\" \"$mycache\")" &
54 elif eval $BYOBU_TEST apt-get >/dev/null; then54 elif byobu_test apt-get; then
55 # If apt-get exists, use it55 # If apt-get exists, use it
56 flock -xn "$flock" apt-get -s -o Debug::NoLocking=true upgrade | grep -c ^Inst >$mycache 2>/dev/null &56 flock -xn "$flock" apt-get -s -o Debug::NoLocking=true upgrade | grep -c ^Inst >$mycache 2>/dev/null &
57 elif eval $BYOBU_TEST pkcon >/dev/null; then57 elif byobu_test pkcon; then
58 # use packagekit to show list of packages58 # use packagekit to show list of packages
59 LC_ALL=C flock -xn "$flock" pkcon get-updates -p | awk '/^Results:$/ { start=NR }; /^Security/ { security++ }; END { if (!/There are no updates available at this time./) { print NR-start, security }}' > "$mycache" 2>/dev/null &59 LC_ALL=C flock -xn "$flock" pkcon get-updates -p | awk '/^Results:$/ { start=NR }; /^Security/ { security++ }; END { if (!/There are no updates available at this time./) { print NR-start, security }}' > "$mycache" 2>/dev/null &
60 elif eval $BYOBU_TEST zypper >/dev/null; then60 elif byobu_test zypper; then
61 # If zypper exists, use it61 # If zypper exists, use it
62 flock -xn "$flock" zypper --no-refresh lu --best-effort | grep -c 'v |' >$mycache 2>/dev/null &62 flock -xn "$flock" zypper --no-refresh lu --best-effort | grep -c 'v |' >$mycache 2>/dev/null &
63 elif eval $BYOBU_TEST yum >/dev/null; then63 elif byobu_test yum; then
64 # If yum exists, use it64 # If yum exists, use it
65 # TODO: We need a better way of counting updates available from a RH expert65 # TODO: We need a better way of counting updates available from a RH expert
66 flock -xn "$flock" yum list updates -q | grep -vc "Updated Packages" >$mycache 2>/dev/null &66 flock -xn "$flock" yum list updates -q | grep -vc "Updated Packages" >$mycache 2>/dev/null &
67 elif eval $BYOBU_TEST pacman >/dev/null; then67 elif byobu_test pacman; then
68 # If pacman (Archlinux) exists, use it68 # If pacman (Archlinux) exists, use it
69 LC_ALL=C flock -xn "$flock" pacman -Sup | grep -vc "^\(::\| \)" >$mycache 2>/dev/null &69 LC_ALL=C flock -xn "$flock" pacman -Sup | grep -vc "^\(::\| \)" >$mycache 2>/dev/null &
70 elif eval $BYOBU_TEST opkg >/dev/null; then70 elif byobu_test opkg; then
71 # If opkg (OpenWrt) exists, use it, also background if flock exists71 # If opkg (OpenWrt) exists, use it, also background if flock exists
72 if eval $BYOBU_TEST flock >/dev/null; then72 if byobu_test flock; then
73 flock -xn "$flock" opkg list-upgradable | wc -l >$mycache 2>/dev/null &73 flock -xn "$flock" opkg list-upgradable | wc -l >$mycache 2>/dev/null &
74 else74 else
75 opkg list-upgradable | wc -l >$mycache &75 opkg list-upgradable | wc -l >$mycache &
76 fi76 fi
77 elif eval $BYOBU_TEST brew >/dev/null; then77 elif byobu_test brew; then
78 # If homebrew (Mac OSX) exists, use it, also background if flock exists78 # If homebrew (Mac OSX) exists, use it, also background if flock exists
79 if eval $BYOBU_TEST flock >/dev/null; then79 if byobu_test flock; then
80 flock -xn "$flock" brew outdated | wc -l >$mycache 2>/dev/null &80 flock -xn "$flock" brew outdated | wc -l >$mycache 2>/dev/null &
81 else81 else
82 brew outdated | wc -l >$mycache &82 brew outdated | wc -l >$mycache &
@@ -90,7 +90,7 @@
90 local mycache=$190 local mycache=$1
91 # The cache doesn't exist: create it91 # The cache doesn't exist: create it
92 [ ! -e "$mycache" ] && return 092 [ ! -e "$mycache" ] && return 0
93 if eval $BYOBU_TEST apt-get >/dev/null; then93 if byobu_test apt-get; then
94 # Debian/ubuntu94 # Debian/ubuntu
95 d0=$(($(stat -c %Y $mycache 2>/dev/null)-5))95 d0=$(($(stat -c %Y $mycache 2>/dev/null)-5))
96 d1=$(stat -c %Y /var/lib/apt)96 d1=$(stat -c %Y /var/lib/apt)
@@ -106,14 +106,14 @@
106 elif [ -e "/var/lib/PackageKit/transactions.db" ]; then106 elif [ -e "/var/lib/PackageKit/transactions.db" ]; then
107 [ "/var/lib/PackageKit/transactions.db" -nt "$mycache" ]107 [ "/var/lib/PackageKit/transactions.db" -nt "$mycache" ]
108 return $?108 return $?
109 elif eval $BYOBU_TEST pacman >/dev/null; then109 elif byobu_test pacman; then
110 # Archlinux110 # Archlinux
111 local db111 local db
112 for db in /var/lib/pacman/sync/*.db; do112 for db in /var/lib/pacman/sync/*.db; do
113 [ "$db" -nt "$mycache" ] && return 0113 [ "$db" -nt "$mycache" ] && return 0
114 done114 done
115 return 1115 return 1
116 elif eval $BYOBU_TEST opkg >/dev/null; then116 elif byobu_test opkg; then
117 # OpenWrt117 # OpenWrt
118 [ ! -e /var/lock/opkg.lock ] || return 1118 [ ! -e /var/lock/opkg.lock ] || return 1
119 if [ -d /var/opkg-lists ]; then119 if [ -d /var/opkg-lists ]; then
@@ -125,7 +125,7 @@
125 [ "$u" -gt 0 ]125 [ "$u" -gt 0 ]
126 return $?126 return $?
127 fi127 fi
128 elif eval $BYOBU_TEST brew >/dev/null; then128 elif byobu_test brew; then
129 # Mac OSX129 # Mac OSX
130 # check if any new versions have been installed since130 # check if any new versions have been installed since
131 # we last cached. this may not recognize formulae131 # we last cached. this may not recognize formulae
@@ -142,7 +142,7 @@
142}142}
143143
144__updates_available_detail() {144__updates_available_detail() {
145 if eval $BYOBU_TEST apt-get >/dev/null; then145 if byobu_test apt-get; then
146 local detail=`apt-get -s -o Debug::NoLocking=true upgrade`146 local detail=`apt-get -s -o Debug::NoLocking=true upgrade`
147 if [ "$1" = "--detail" ]; then147 if [ "$1" = "--detail" ]; then
148 printf "$detail"148 printf "$detail"
149149
=== modified file 'usr/lib/byobu/users'
--- usr/lib/byobu/users 2019-05-26 19:18:32 +0000
+++ usr/lib/byobu/users 2019-06-17 20:09:21 +0000
@@ -26,7 +26,7 @@
26}26}
2727
28__users() {28__users() {
29 local count=029 local count=0 sign
30 if [ "$USERS_DISTINCT" = "1" ]; then30 if [ "$USERS_DISTINCT" = "1" ]; then
31 count=$(pgrep -fl 'sshd:.*@' | cut -f3 -d\ | cut -f1 -d@ | sort -u | wc -l)31 count=$(pgrep -fl 'sshd:.*@' | cut -f3 -d\ | cut -f1 -d@ | sort -u | wc -l)
32 else32 else
@@ -35,7 +35,15 @@
35 count=$(pgrep -f "^sshd:.*@|^/usr/sbin/sshd -i" | wc -l) || return35 count=$(pgrep -f "^sshd:.*@|^/usr/sbin/sshd -i" | wc -l) || return
36 fi36 fi
37 if [ $count -gt 0 ]; then37 if [ $count -gt 0 ]; then
38 color b w r; printf "%d" "$count"; color -; color w r; printf "##"; color --38 case "$BYOBU_BACKEND" in
39 tmux)
40 sign="##"
41 ;;
42 screen)
43 sign="#"
44 ;;
45 esac
46 color b w r; printf "%d" "$count"; color -; color w r; printf "$sign"; color --
39 else47 else
40 rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/users"*48 rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/users"*
41 fi49 fi
4250
=== modified file 'usr/lib/byobu/whoami'
--- usr/lib/byobu/whoami 2019-05-26 19:15:56 +0000
+++ usr/lib/byobu/whoami 2019-06-17 20:09:21 +0000
@@ -20,9 +20,9 @@
20# along with this program. If not, see <http://www.gnu.org/licenses/>.20# along with this program. If not, see <http://www.gnu.org/licenses/>.
2121
22___get_user() {22___get_user() {
23 if eval $BYOBU_TEST whoami >/dev/null 2>&1; then23 if byobu_test whoami; then
24 whoami24 whoami
25 elif eval $BYOBU_TEST id >/dev/null 2>&1; then25 elif byobu_test id; then
26 id -un26 id -un
27 fi27 fi
28}28}
@@ -30,7 +30,7 @@
30__whoami_detail() {30__whoami_detail() {
31 local user=$(___get_user)31 local user=$(___get_user)
32 [ -n "$user" ] || return32 [ -n "$user" ] || return
33 if eval $BYOBU_TEST getent >/dev/null 2>&1; then33 if byobu_test getent; then
34 getent -- passwd "$user"34 getent -- passwd "$user"
35 else35 else
36 grep "^$user:" /etc/passwd36 grep "^$user:" /etc/passwd
3737
=== modified file 'usr/lib/byobu/wifi_quality'
--- usr/lib/byobu/wifi_quality 2019-06-01 21:12:18 +0000
+++ usr/lib/byobu/wifi_quality 2019-06-17 20:09:21 +0000
@@ -28,21 +28,21 @@
28}28}
2929
30__wifi_quality_detail() {30__wifi_quality_detail() {
31 if eval $BYOBU_TEST iw >/dev/null 2>&1; then31 if byobu_test iw; then
32 local dev32 local dev
33 for dev in $(___get_dev_list); do33 for dev in $(___get_dev_list); do
34 iw dev "$dev" info34 iw dev "$dev" info
35 iw dev "$dev" link35 iw dev "$dev" link
36 echo36 echo
37 done37 done
38 elif eval $BYOBU_TEST iwconfig >/dev/null 2>&1; then38 elif byobu_test iwconfig; then
39 iwconfig 2>/dev/null39 iwconfig 2>/dev/null
40 fi40 fi
41}41}
4242
43__wifi_quality() {43__wifi_quality() {
44 local out bitrate quality44 local out bitrate quality
45 if eval $BYOBU_TEST iwconfig >/dev/null 2>&1; then45 if byobu_test iwconfig; then
46 # iwconfig is expected to output lines like:46 # iwconfig is expected to output lines like:
47 # Bit Rate=54 Mb/s Tx-Power=15 dBm47 # Bit Rate=54 Mb/s Tx-Power=15 dBm
48 # Link Quality=60/70 Signal level=-50 dBm48 # Link Quality=60/70 Signal level=-50 dBm
@@ -54,7 +54,7 @@
54 $0 ~ /[ ]*Bit Rate/ { sub(/.*[:=]/,"",$2); printf("bitrate=%s\n", $2); }54 $0 ~ /[ ]*Bit Rate/ { sub(/.*[:=]/,"",$2); printf("bitrate=%s\n", $2); }
55 '`55 '`
56 eval "$out"56 eval "$out"
57 elif eval $BYOBU_TEST iw >/dev/null 2>&1; then57 elif byobu_test iw; then
58 local dev58 local dev
59 for dev in $(___get_dev_list); do59 for dev in $(___get_dev_list); do
60 # iw is expected to output lines like:60 # iw is expected to output lines like:
6161
=== modified file 'usr/share/byobu/keybindings/f-keys.screen'
--- usr/share/byobu/keybindings/f-keys.screen 2018-04-11 15:16:45 +0000
+++ usr/share/byobu/keybindings/f-keys.screen 2019-06-17 20:09:21 +0000
@@ -89,4 +89,4 @@
89register d ":source $BYOBU_PREFIX/share/byobu/keybindings/f-keys.screen.disable^M"89register d ":source $BYOBU_PREFIX/share/byobu/keybindings/f-keys.screen.disable^M"
90bind ! eval 'process x' 'process d' 'backtick 111 9999999 9999999 byobu-status menu --disable-f-keys' # F12 ! | toggle on/off f-keys90bind ! eval 'process x' 'process d' 'backtick 111 9999999 9999999 byobu-status menu --disable-f-keys' # F12 ! | toggle on/off f-keys
9191
92bindkey "^A" $BYOBU_BACKEND -t ctrl-a byobu-ctrl-a92bindkey "^A" $BYOBU_BACKEND -t ctrl-a byobu-ctrl-a autorun
9393
=== modified file 'usr/share/byobu/keybindings/f-keys.tmux'
--- usr/share/byobu/keybindings/f-keys.tmux 2019-05-26 19:10:55 +0000
+++ usr/share/byobu/keybindings/f-keys.tmux 2019-06-17 20:09:21 +0000
@@ -82,4 +82,4 @@
82bind-key -n M-F12 source $BYOBU_PREFIX/share/byobu/keybindings/mouse.tmux.enable82bind-key -n M-F12 source $BYOBU_PREFIX/share/byobu/keybindings/mouse.tmux.enable
83bind-key -n M-IC paste-buffer83bind-key -n M-IC paste-buffer
8484
85bind-key -n C-a new-window -n "ctrl-a" "byobu-ctrl-a"85bind-key -n C-a new-window -n "ctrl-a" "byobu-ctrl-a autorun"
8686
=== modified file 'usr/share/byobu/profiles/Makefile.am'
--- usr/share/byobu/profiles/Makefile.am 2015-11-14 22:57:11 +0000
+++ usr/share/byobu/profiles/Makefile.am 2019-06-17 20:09:21 +0000
@@ -1,2 +1,2 @@
1profilesdir = $(datadir)/@PACKAGE@/profiles1profilesdir = $(datadir)/@PACKAGE@/profiles
2profiles_DATA = bashrc byoburc dircolors screenrc common tmux tmuxrc NONE2profiles_DATA = bashrc dircolors screenrc common tmux tmuxrc NONE
33
=== removed file 'usr/share/byobu/profiles/byoburc'
--- usr/share/byobu/profiles/byoburc 2016-04-07 22:07:52 +0000
+++ usr/share/byobu/profiles/byoburc 1970-01-01 00:00:00 +0000
@@ -1,27 +0,0 @@
1###############################################################################
2# Load:
3# * the stock byobu profile
4# * any windows
5# * and the local byoburc (instead of .screenrc)
6# Used at startup but not profile refresh
7#
8# Copyright (C) 2009-2011 Canonical Ltd.
9#
10# Authors: Dustin Kirkland <kirkland@byobu.org>
11#
12# This program is free software: you can redistribute it and/or modify
13# it under the terms of the GNU General Public License as published by
14# the Free Software Foundation, version 3 of the License.
15#
16# This program is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19# GNU General Public License for more details.
20#
21# You should have received a copy of the GNU General Public License
22# along with this program. If not, see <http://www.gnu.org/licenses/>.
23###############################################################################
24
25source $BYOBU_CONFIG_DIR/profile
26source $BYOBU_WINDOWS
27source $BYOBU_CONFIG_DIR/.screenrc
280
=== modified file 'usr/share/byobu/profiles/screenrc'
--- usr/share/byobu/profiles/screenrc 2016-04-07 22:07:52 +0000
+++ usr/share/byobu/profiles/screenrc 2019-06-17 20:09:21 +0000
@@ -2,7 +2,7 @@
2# Load:2# Load:
3# * the stock byobu profile3# * the stock byobu profile
4# * any windows4# * any windows
5# * and the local .screenrc (instead of .byoburc)5# * and the local .screenrc
6# Used at startup but not profile refresh6# Used at startup but not profile refresh
7#7#
8# Copyright (C) 2009-2011 Canonical Ltd.8# Copyright (C) 2009-2011 Canonical Ltd.
99
=== modified file 'usr/share/byobu/profiles/tmuxrc'
--- usr/share/byobu/profiles/tmuxrc 2016-04-07 22:07:52 +0000
+++ usr/share/byobu/profiles/tmuxrc 2019-06-17 20:09:21 +0000
@@ -2,7 +2,7 @@
2# Load:2# Load:
3# * the stock byobu profile3# * the stock byobu profile
4# * any windows4# * any windows
5# * and the local byoburc (instead of .screenrc)5# * and the local .tmux.conf
6# Used at startup but not profile refresh6# Used at startup but not profile refresh
7#7#
8# Copyright (C) 2009-2011 Canonical Ltd.8# Copyright (C) 2009-2011 Canonical Ltd.

Subscribers

People subscribed via source and target branches