diff --git a/debian/changelog b/debian/changelog index 25e76093..ac6de096 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 diff --git a/debian/postinst b/debian/postinst index 4376afe2..4e7e5d67 100644 --- a/debian/postinst +++ b/debian/postinst @@ -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