diff --git a/debian/changelog b/debian/changelog index c0e81c6f..ccd4b477 100644 --- a/debian/changelog +++ b/debian/changelog @@ -16,6 +16,11 @@ byobu (4.34) unreleased; urgency=low copy/scrollback mode, but re-enable them afterward; print a message about Byobu scrollback mode to "eat" the unnecessary 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 Thu, 08 Sep 2011 14:26:43 -0700 diff --git a/usr/bin/byobu-launch b/usr/bin/byobu-launch index 9882d8f5..2e4f8fc3 100755 --- a/usr/bin/byobu-launch +++ b/usr/bin/byobu-launch @@ -34,31 +34,34 @@ if [ "$BYOBU_SOURCED_PROFILE" != "1" ] && [ "$LC_BYOBU" != "0" ] && [ "$BYOBU_DI PKG="byobu" [ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX . "${BYOBU_PREFIX}/lib/${PKG}/.common" - case "$-" in - *i*) - # Attempt to merge shell history across sessions/windows (works with a few exceptions) - if command -v shopt >/dev/null; then - shopt -s histappend || true - elif command -v setopt >/dev/null; then - # Support zsh too - setopt appendhistory - fi - [ -n "$PROMPT_COMMAND" ] && PROMPT_COMMAND="$PROMPT_COMMAND;history -a" || PROMPT_COMMAND="history -a" - # Source profile - [ -r "$HOME/.profile" ] && . "$HOME/.profile" - if byobu-launcher; then - # Wait very briefly for the no-logout flag to get written? - sleep 0.1 - if [ -e "$BYOBU_CONFIG_DIR/no-logout-on-detach" ] || [ -e "$BYOBU_RUN_DIR/no-logout" ]; then - # The user does not want to logout on byobu detach - rm -f "$BYOBU_RUN_DIR/no-logout" # Remove one-time no-logout flag, if it exists - true - else - exit 0 + # Ensure that autolaunch is not explicitly disabled + if [ ! -r "$BYOBU_CONFIG_DIR/disable-autolaunch" ]; then + case "$-" in + *i*) + # Attempt to merge shell history across sessions/windows (works with a few exceptions) + if command -v shopt >/dev/null; then + shopt -s histappend || true + elif command -v setopt >/dev/null; then + # Support zsh too + setopt appendhistory fi - fi - ;; - esac + [ -n "$PROMPT_COMMAND" ] && PROMPT_COMMAND="$PROMPT_COMMAND;history -a" || PROMPT_COMMAND="history -a" + # Source profile, if necessary + [ -z "$sourced" ] && [ -r "$HOME/.profile" ] && . "$HOME/.profile" + if byobu-launcher; then + # Wait very briefly for the no-logout flag to get written? + sleep 0.1 + if [ -e "$BYOBU_CONFIG_DIR/no-logout-on-detach" ] || [ -e "$BYOBU_RUN_DIR/no-logout" ]; then + # The user does not want to logout on byobu detach + rm -f "$BYOBU_RUN_DIR/no-logout" # Remove one-time no-logout flag, if it exists + true + else + exit 0 + fi + fi + ;; + esac + fi fi true # vi: syntax=sh ts=4 noexpandtab diff --git a/usr/bin/byobu-launcher-install b/usr/bin/byobu-launcher-install index 3a9e9996..52ea83c1 100755 --- a/usr/bin/byobu-launcher-install +++ b/usr/bin/byobu-launcher-install @@ -42,7 +42,7 @@ update_flag() { } install_launcher() { - printf ". byobu-launch\n" >> "$1" + printf "sourced=1 . byobu-launch\n" >> "$1" } # Sanitize the environment