automatically reload default byobu launched sessions on upgrade

This commit is contained in:
Dustin Kirkland 2011-09-22 16:59:34 -05:00
commit b64065fc50
2 changed files with 15 additions and 1 deletions

1
debian/changelog vendored
View file

@ -5,6 +5,7 @@ byobu (4.35) unreleased; urgency=low
previous fix just enabled it everywhere
* debian/postinst, usr/bin/byobu-janitor:
- smooth upgrades from older byobu (<= 4.0)
- automatically reload default byobu launched sessions on upgrade
* usr/lib/byobu/reboot_required:
- fix path

15
debian/postinst vendored
View file

@ -32,7 +32,7 @@ touch_flag() {
}
[ -r "/etc/$PKG/socketdir" ] && . "/etc/$PKG/socketdir"
if [ -d "$SOCKETDIR" ]; then
for d in "$SOCKETDIR"/*; do
for d in "$SOCKETDIR"/S-*; do
if [ -d "$d/$PKG" ]; then
# New location of the reload flag
touch_flag "$d/$PKG/reload-required"
@ -43,6 +43,19 @@ if [ -d "$SOCKETDIR" ]; then
done
fi
# Reload byobu sessions
for p in /var/run/screen/S-*/*.$PKG; do
pid=$(echo "$p" | sed -e "s:.*/::" -e "s:\..*::")
if [ -p "$p" ] && (ps -o cmd "$pid" | grep -qs "^SCREEN -S $PKG -c "); then
u=$(stat -c %U "$p")
h=$(getent passwd "$u" | awk -F: '{print $6}')
if [ -f "$h/.$PKG/profile" ]; then
s=$(basename "$p")
su -l "$u" -c "screen -S $s -X at 0 source '$h/.$PKG/profile'" >/dev/null 2>&1 || true
fi
fi
done
#DEBHELPER#
# vi: syntax=sh ts=4 noexpandtab