* debian/config, debian/postinst, debian/prerm, debian/rules,

debian/templates, usr/bin/byobu, usr/bin/byobu-launcher,
  usr/bin/byobu-launcher-install, usr/bin/byobu-launcher-uninstall:
  - support a preseedable debconf question that allows
    an administrator to launch byobu by default on all logins on a
    system (default = false), allow for per-user overriding
This commit is contained in:
Dustin Kirkland 2010-02-04 18:57:17 -08:00
commit 07ace11a33
10 changed files with 69 additions and 2 deletions

6
debian/changelog vendored
View file

@ -2,6 +2,12 @@ byobu (2.52) unreleased; urgency=low
* debian/rules, usr/bin/byobu, usr/bin/byobu-launcher: deprecate the
launcher script as a separate script; do this in /usr/bin/byobu
* debian/config, debian/postinst, debian/prerm, debian/rules,
debian/templates, usr/bin/byobu, usr/bin/byobu-launcher,
usr/bin/byobu-launcher-install, usr/bin/byobu-launcher-uninstall:
- support a preseedable debconf question that allows
an administrator to launch byobu by default on all logins on a
system (default = false), allow for per-user overriding
-- Dustin Kirkland <kirkland@ubuntu.com> Wed, 03 Feb 2010 10:56:23 -0800

9
debian/config vendored Normal file
View file

@ -0,0 +1,9 @@
#! /bin/sh -e
. /usr/share/debconf/confmodule
db_version 2.0
db_input medium byobu/launch-by-default || true
db_go
exit 0

10
debian/postinst vendored
View file

@ -1,7 +1,17 @@
#!/bin/sh -e
. /usr/share/debconf/confmodule
db_version 2.0
PKG="byobu"
db_get byobu/launch-by-default
if [ "$RET" = true ]; then
ln -sf /usr/bin/$PKG-launcher /etc/profile.d/$PKG.sh
else
rm -f /etc/profile.d/$PKG.sh
fi
# The target of the diversion somehow disappeared which will cause
# the divert removal to fail; we don't want that to happen
[ -e "/usr/bin/screen.real" ] && [ ! -e "/usr/bin/screen" ] && cp -a /usr/bin/screen.real /usr/bin/screen

1
debian/prerm vendored
View file

@ -6,6 +6,7 @@ PKG="byobu"
for i in /usr/bin/screen-profiles-status /usr/bin/screen-launcher; do
[ -h "$i" ] && rm -f "$i"
done
rm -f /etc/profile.d/$PKG.sh
true

1
debian/rules vendored
View file

@ -54,7 +54,6 @@ install: build install-po
#dh_link usr/bin/byobu-status usr/bin/screen-profiles-status
#dh_link usr/bin/byobu-launcher usr/bin/screen-launcher
dh_link usr/share/byobu/keybindings/f-keys usr/share/byobu/keybindings/common
dh_link usr/bin/byobu usr/bin/byobu-launcher
for i in black dark dark_blue dark_cyan dark_green dark_purple dark_red dark_yellow light light_blue light_cyan light_green light_purple light_red light_yellow; do dh_link usr/share/byobu/profiles/common usr/share/byobu/profiles/$${i}; done
dh_install -X.bzr

11
debian/templates vendored Normal file
View file

@ -0,0 +1,11 @@
Template: byobu/launch-by-default
Type: boolean
Default: false
Description: Do you want to launch Byobu at shell login for all users?
Byobu can launch automatically at login (e.g. console, ssh), providing
an attachable/detachable window manager on the command line.
.
If you select this option, Byobu will install a symlink in /etc/profile.d.
This setting is system-wide, for all users logging into the system.
.
Individual users can disable this by touching ~/.byobu/disable-autolaunch.

View file

@ -27,6 +27,11 @@ if [ "$#" = "1" ] && [ "$1" = "-v" ]; then
exit 0
fi
# Check if we're being autolaunched, and this user explicitly does not want it.
if [ "$0" = "/etc/profile.d/$PKG.sh" ] && [ -r "$HOME/.$PKG/disable-autolaunch" ]; then
exit 0
fi
# Sanitize the environment
byobu-janitor --force

24
usr/bin/byobu-launcher Executable file
View file

@ -0,0 +1,24 @@
#!/bin/sh -e
#
# byobu-launcher - conditionally launch byobu
# Copyright (C) 2010 Canonical Ltd.
#
# Authors: Dustin Kirkland <kirkland@canonical.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
PKG="byobu"
[ -r "$HOME/.$PKG/disable-autolaunch" ] && exit 0
exec /usr/bin/$PKG

View file

@ -28,6 +28,7 @@ install_launcher() {
echo "$launcher_line" >> "$dest"
# Hush login, since byobu will handle motd printing
touch "$HOME"/.hushlogin
rm -f "$HOME/.$PKG/disable-autolaunch"
}
# Sanitize the environment

View file

@ -26,8 +26,9 @@ remove_launcher() {
sed -i "/$PKG-launcher$/d" "$dest"
sed -i "/screen-launcher$/d" "$dest"
fi
touch "$HOME/.$PKG/disable-autolaunch"
# the install disabled motd printing; re-enable
rm "$HOME"/.hushlogin 2>/dev/null || true
rm -f "$HOME"/.hushlogin
}
for i in ".profile" ".bashrc" ".bash_profile" ".zprofile"; do