mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-23 06:36:17 -07:00
* usr/bin/byobu, usr/bin/byobu-reconnect-sockets,
usr/lib/byobu/.shutil: - source _shutil - exec screen -v rather than waiting and exiting - use HOSTNAME if set (it is set in bash), avoiding the fork for 'hostname' - use 'uncommented_lines' function in _shutil rather than grep - use 'command -v' (posix sh shell builtin) rather than 'which' - mention that byobu-janitor should not be called every time
This commit is contained in:
parent
fd6f68adb8
commit
e99b7ac024
4 changed files with 49 additions and 15 deletions
11
debian/changelog
vendored
11
debian/changelog
vendored
|
@ -1,7 +1,18 @@
|
||||||
byobu (4.2) unreleased; urgency=low
|
byobu (4.2) unreleased; urgency=low
|
||||||
|
|
||||||
|
[ Dustin Kirkland ]
|
||||||
* usr/bin/byobu-config: remove debug output, LP: #782372
|
* usr/bin/byobu-config: remove debug output, LP: #782372
|
||||||
|
|
||||||
|
[ Scott Moser ]
|
||||||
|
* usr/bin/byobu, usr/bin/byobu-reconnect-sockets,
|
||||||
|
usr/lib/byobu/.shutil:
|
||||||
|
- source _shutil
|
||||||
|
- exec screen -v rather than waiting and exiting
|
||||||
|
- use HOSTNAME if set (it is set in bash), avoiding the fork for 'hostname'
|
||||||
|
- use 'uncommented_lines' function in _shutil rather than grep
|
||||||
|
- use 'command -v' (posix sh shell builtin) rather than 'which'
|
||||||
|
- mention that byobu-janitor should not be called every time
|
||||||
|
|
||||||
-- Dustin Kirkland <kirkland@ubuntu.com> Fri, 13 May 2011 18:58:03 +0200
|
-- Dustin Kirkland <kirkland@ubuntu.com> Fri, 13 May 2011 18:58:03 +0200
|
||||||
|
|
||||||
byobu (4.1-0ubuntu1) oneiric; urgency=low
|
byobu (4.1-0ubuntu1) oneiric; urgency=low
|
||||||
|
|
|
@ -25,9 +25,10 @@ export BYOBU_PREFIX
|
||||||
RUN="$SOCKETDIR/S-$USER"
|
RUN="$SOCKETDIR/S-$USER"
|
||||||
DATA="$HOME/.$PKG"
|
DATA="$HOME/.$PKG"
|
||||||
|
|
||||||
|
. "${BYOBU_PREFIX}/usr/lib/${PKG}/.shutil"
|
||||||
if [ ! -x "$BYOBU_PREFIX/bin/$PKG" ]; then
|
if [ ! -x "$BYOBU_PREFIX/bin/$PKG" ]; then
|
||||||
echo "ERROR: Cannot find $BYOBU_PREFIX/bin/$PKG" 2>&1
|
error "Cannot find $BYOBU_PREFIX/bin/$PKG"
|
||||||
echo "ERROR: If you have installed it elsewhere, export BYOBU_PREFIX in your shell" 2>&1
|
error "If you have installed it elsewhere, export BYOBU_PREFIX in your shell"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -36,7 +37,7 @@ if [ "$#" = "1" ]; then
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-v|--version)
|
-v|--version)
|
||||||
echo "$PKG version $VERSION"
|
echo "$PKG version $VERSION"
|
||||||
screen -v
|
exec screen -v
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -51,7 +52,7 @@ fi
|
||||||
byobu-janitor --force
|
byobu-janitor --force
|
||||||
|
|
||||||
# Set the window title
|
# Set the window title
|
||||||
[ -z "$BYOBU_NO_TITLE" ] || printf "\033]0;${USER}@$(hostname) - ${PKG}\007"
|
[ -z "$BYOBU_NO_TITLE" ] || printf "\033]0;${USER}@${HOSTNAME:-$(hostname)} - ${PKG}\007"
|
||||||
|
|
||||||
# Allow override of default window list, with BYOBU_WINDOWS environment variable
|
# Allow override of default window list, with BYOBU_WINDOWS environment variable
|
||||||
CUSTOM_WINDOW_SET=0
|
CUSTOM_WINDOW_SET=0
|
||||||
|
@ -68,14 +69,17 @@ fi
|
||||||
export BYOBU_WINDOWS
|
export BYOBU_WINDOWS
|
||||||
|
|
||||||
# Launch shell, unless the user has default windows set to launch
|
# Launch shell, unless the user has default windows set to launch
|
||||||
grep -qs "^[^#]" "$BYOBU_WINDOWS" && DEFAULT_WINDOW= || DEFAULT_WINDOW="shell"
|
uncommented_lines < "$BYOBU_WINDOWS" && DEFAULT_WINDOW= || DEFAULT_WINDOW="shell"
|
||||||
|
|
||||||
# Check if our terminfo supports 256 colors
|
# Check if our terminfo supports 256 colors
|
||||||
$(which tput >/dev/null) && [ $(tput colors 2>/dev/null || echo 0) -eq 256 ] && SCREEN_TERM="-T screen-256color"
|
if command -v tput >/dev/null; then
|
||||||
|
if [ "$(tput colors 2>/dev/null || echo 0)" = "256" ]; then
|
||||||
|
SCREEN_TERM="-T screen-256color"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Drop a symlink to the ssh socket in $HOME, since we can ensure that exists
|
# Drop a symlink to the ssh socket in $HOME, since we can ensure that exists
|
||||||
if [ -S "$SSH_AUTH_SOCK" ] && [ ! -h "$SSH_AUTH_SOCK" ]; then
|
if [ -S "$SSH_AUTH_SOCK" ] && [ ! -h "$SSH_AUTH_SOCK" ]; then
|
||||||
rm -f "$DATA/.ssh-agent"
|
|
||||||
ln -sf "$SSH_AUTH_SOCK" "$DATA/.ssh-agent"
|
ln -sf "$SSH_AUTH_SOCK" "$DATA/.ssh-agent"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -88,7 +92,7 @@ else
|
||||||
fi
|
fi
|
||||||
NAME="-S $PKG"
|
NAME="-S $PKG"
|
||||||
# Zero out $NAME if user has specified a -S
|
# Zero out $NAME if user has specified a -S
|
||||||
for i in $@; do
|
for i in "$@"; do
|
||||||
case $i in -*S|-ls|-list) NAME= ;; esac
|
case $i in -*S|-ls|-list) NAME= ;; esac
|
||||||
done
|
done
|
||||||
# Now let's execute screen!
|
# Now let's execute screen!
|
||||||
|
|
|
@ -23,13 +23,7 @@
|
||||||
|
|
||||||
PKG="byobu"
|
PKG="byobu"
|
||||||
|
|
||||||
# newest(file,file,file..)
|
. "${BYOBU_PREFIX}/usr/lib/${PKG}/.shutil"
|
||||||
# return the newest file in the list
|
|
||||||
newest() {
|
|
||||||
local c="$1" i
|
|
||||||
for i in "$@"; do [ "$i" -nt "$c" ] && c="$i"; done
|
|
||||||
[ -e "$c" ] && _RET="$c"
|
|
||||||
}
|
|
||||||
|
|
||||||
case "$-" in
|
case "$-" in
|
||||||
*i*)
|
*i*)
|
||||||
|
|
25
usr/lib/byobu/.shutil
Normal file
25
usr/lib/byobu/.shutil
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
# uncommented_lines(char=#)
|
||||||
|
# does the standard input have lines that do not start with 'char'?
|
||||||
|
uncommented_lines() {
|
||||||
|
local line chr="${1:-#}"
|
||||||
|
while read line; do
|
||||||
|
[ "${line#${chr}}" = "${line}" ] && return 0;
|
||||||
|
done
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# newest(file,file,file..)
|
||||||
|
# return the newest file in the list
|
||||||
|
newest() {
|
||||||
|
local c="$1" i
|
||||||
|
for i in "$@"; do [ "$i" -nt "$c" ] && c="$i"; done
|
||||||
|
[ -e "$c" ] && _RET="$c"
|
||||||
|
}
|
||||||
|
|
||||||
|
error() {
|
||||||
|
echo "ERROR: " "$@" 1>&2
|
||||||
|
}
|
||||||
|
|
||||||
|
fail() {
|
||||||
|
[ $# -eq 0 ] || error "$@"; exit 1;
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue