* usr/bin/byobu-launch, usr/bin/byobu-launcher-install: LP: #855002

- ensure that .profile is not sourced more than once
  - ensure that disabled auto launch is respected, too, and does not
    double-source profile
  - handle both system-wide autolaunch, and per-user autolaunch
This commit is contained in:
Dustin Kirkland 2011-09-21 18:29:22 -05:00
commit d2eb104118
3 changed files with 33 additions and 25 deletions

5
debian/changelog vendored
View file

@ -16,6 +16,11 @@ byobu (4.34) unreleased; urgency=low
copy/scrollback mode, but re-enable them afterward; print a copy/scrollback mode, but re-enable them afterward; print a
message about Byobu scrollback mode to "eat" the unnecessary message about Byobu scrollback mode to "eat" the unnecessary
and misleading screen messages when using alt-pgup and alt-pgdown and misleading screen messages when using alt-pgup and alt-pgdown
* usr/bin/byobu-launch, usr/bin/byobu-launcher-install: LP: #855002
- ensure that .profile is not sourced more than once
- ensure that disabled auto launch is respected, too, and does not
double-source profile
- handle both system-wide autolaunch, and per-user autolaunch
-- Dustin Kirkland <kirkland@ubuntu.com> Thu, 08 Sep 2011 14:26:43 -0700 -- Dustin Kirkland <kirkland@ubuntu.com> Thu, 08 Sep 2011 14:26:43 -0700

View file

@ -34,6 +34,8 @@ if [ "$BYOBU_SOURCED_PROFILE" != "1" ] && [ "$LC_BYOBU" != "0" ] && [ "$BYOBU_DI
PKG="byobu" PKG="byobu"
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX [ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
. "${BYOBU_PREFIX}/lib/${PKG}/.common" . "${BYOBU_PREFIX}/lib/${PKG}/.common"
# Ensure that autolaunch is not explicitly disabled
if [ ! -r "$BYOBU_CONFIG_DIR/disable-autolaunch" ]; then
case "$-" in case "$-" in
*i*) *i*)
# Attempt to merge shell history across sessions/windows (works with a few exceptions) # Attempt to merge shell history across sessions/windows (works with a few exceptions)
@ -44,8 +46,8 @@ if [ "$BYOBU_SOURCED_PROFILE" != "1" ] && [ "$LC_BYOBU" != "0" ] && [ "$BYOBU_DI
setopt appendhistory setopt appendhistory
fi fi
[ -n "$PROMPT_COMMAND" ] && PROMPT_COMMAND="$PROMPT_COMMAND;history -a" || PROMPT_COMMAND="history -a" [ -n "$PROMPT_COMMAND" ] && PROMPT_COMMAND="$PROMPT_COMMAND;history -a" || PROMPT_COMMAND="history -a"
# Source profile # Source profile, if necessary
[ -r "$HOME/.profile" ] && . "$HOME/.profile" [ -z "$sourced" ] && [ -r "$HOME/.profile" ] && . "$HOME/.profile"
if byobu-launcher; then if byobu-launcher; then
# Wait very briefly for the no-logout flag to get written? # Wait very briefly for the no-logout flag to get written?
sleep 0.1 sleep 0.1
@ -60,5 +62,6 @@ if [ "$BYOBU_SOURCED_PROFILE" != "1" ] && [ "$LC_BYOBU" != "0" ] && [ "$BYOBU_DI
;; ;;
esac esac
fi fi
fi
true true
# vi: syntax=sh ts=4 noexpandtab # vi: syntax=sh ts=4 noexpandtab

View file

@ -42,7 +42,7 @@ update_flag() {
} }
install_launcher() { install_launcher() {
printf ". byobu-launch\n" >> "$1" printf "sourced=1 . byobu-launch\n" >> "$1"
} }
# Sanitize the environment # Sanitize the environment