From 3e293791faf503d4b0723ce2679af46cfc2f7d4c Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Tue, 9 Feb 2010 13:44:30 -0600 Subject: [PATCH] usr/bin/byobu-janitor, usr/bin/byobu-launcher-install: ensure that we don't end up with two byobu-launch commands in both the global profile and local one --- debian/changelog | 3 +++ usr/bin/byobu-janitor | 7 +++++++ usr/bin/byobu-launcher-install | 35 +++++++++++++++++----------------- 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/debian/changelog b/debian/changelog index 6971ee57..18937af6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -10,6 +10,9 @@ byobu (2.57) unreleased; urgency=low * debian/postinst, usr/bin/byobu-launch, usr/bin/byobu-launcher, usr/bin/byobu-launcher-install: ensure that all login methods work (tty, ssh, gdm), and that each detach behaves properly (c-a-d, c-a-DD) + * usr/bin/byobu-janitor, usr/bin/byobu-launcher-install: ensure that we + don't end up with two byobu-launch commands in both the global profile + and local one -- Dustin Kirkland Tue, 09 Feb 2010 00:07:27 -0600 diff --git a/usr/bin/byobu-janitor b/usr/bin/byobu-janitor index e524b20e..fd1775df 100755 --- a/usr/bin/byobu-janitor +++ b/usr/bin/byobu-janitor @@ -128,5 +128,12 @@ for i in disk network distro logo; do fi done +# Affects: Upgrades from <= byobu-2.57 that autolaunch +# If the global autolaunch is on, then remove duplicate entry in ~/.profile +if [ -h "/etc/profile.d/Z98-$PKG.sh" ]; then + sed -i "/$PKG-launcher$/d" "$HOME"/.profile || true +fi + + # Clean up flag rm -f "$FLAG" diff --git a/usr/bin/byobu-launcher-install b/usr/bin/byobu-launcher-install index 49e4755e..f71fb8c6 100755 --- a/usr/bin/byobu-launcher-install +++ b/usr/bin/byobu-launcher-install @@ -21,31 +21,30 @@ PKG="byobu" install_launcher() { - dest=$1 - launcher="byobu-launcher" - launcher_line="\`echo \$- | grep -qs i\` && $launcher" - # Add it at the end - echo "$launcher_line" >> "$dest" - # Hush login, since byobu will handle motd printing - touch "$HOME"/.hushlogin - rm -f "$HOME/.$PKG/disable-autolaunch" + echo "\`echo \$- | grep -qs i\` && $PKG-launcher" >> "$1" } # Sanitize the environment -byobu-launcher-uninstall || true +$PKG-launcher-uninstall || true +# Hush login, since we will handle motd printing +touch "$HOME"/.hushlogin +rm -f "$HOME/.$PKG/disable-autolaunch" -# Install in $HOME/.profile unconditionally -install_launcher "$HOME/.profile" +# Handle bourne shells, if not set globally in /etc/profile.d +if [ ! -h "/etc/profile.d/Z98-$PKG.sh" ]; then + # Install in $HOME/.profile unconditionally + install_launcher "$HOME/.profile" + # Now, install in any shell-specific profiles, if they exist + # This list may grow to support other shells + for i in ".bash_profile" ".bash_login"; do + if [ -w "$HOME/$i" ]; then + install_launcher "$HOME/$i" + fi + done +fi # Install in zprofile if default shell is zsh if grep -qs "^$USER:.*zsh$" /etc/passwd; then install_launcher "$HOME/.zprofile" fi -# Now, install in any shell-specific profiles, if they exist -# This list may grow to support other shells -for i in ".bash_profile" ".bash_login"; do - if [ -w "$HOME/$i" ]; then - install_launcher "$HOME/$i" - fi -done