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
This commit is contained in:
Dustin Kirkland 2010-02-09 13:44:30 -06:00
commit 3e293791fa
3 changed files with 27 additions and 18 deletions

3
debian/changelog vendored
View file

@ -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 <kirkland@ubuntu.com> Tue, 09 Feb 2010 00:07:27 -0600

View file

@ -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"

View file

@ -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