[28240] in Source-Commits

home help back first fref pref prev next nref lref last post

reactivate commit: Rip out CUPS code; fix policy-rc.d; tweak UI

daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Tue Jun 10 13:30:58 2014

Date: Tue, 10 Jun 2014 13:30:51 -0400
From: Jonathan D Reed <jdreed@MIT.EDU>
Message-Id: <201406101730.s5AHUpA2025658@drugstore.mit.edu>
To: source-commits@MIT.EDU

https://github.com/mit-athena/reactivate/commit/2d3b089f7d9c7c15862adec2d38a9727a7e88b1a
commit 2d3b089f7d9c7c15862adec2d38a9727a7e88b1a
Author: Jonathan Reed <jdreed@mit.edu>
Date:   Thu Jun 5 12:32:22 2014 -0400

    Rip out CUPS code; fix policy-rc.d; tweak UI
    
    - Rip out the last of our browsepolling code, and the complicated
      policy-rc.d that it required.  (I don't care how bad printing
      is, we are never going back to BrowsePolling.)
    - Don't install policy-rc.d in /usr/sbin because d-i is
      incompetent (Trac: #1478)
    - Inform the user when we break their login session (as opposed to when
      they break their login session)

 debian/01debathena-reactivate-cleanup |    9 ---------
 debian/99debathena-reactivate-setup   |    6 ------
 debian/changelog                      |   12 ++++++++++++
 debian/control                        |    1 +
 debian/debathena-reactivate.install   |    2 +-
 debian/debathena-reactivate.postinst  |    4 ----
 debian/policy-rc.d                    |   28 +++++-----------------------
 debian/snapshot-run                   |   26 +++++++++++++++++---------
 8 files changed, 36 insertions(+), 52 deletions(-)

diff --git a/debian/01debathena-reactivate-cleanup b/debian/01debathena-reactivate-cleanup
index 4f69d68..97422dd 100644
--- a/debian/01debathena-reactivate-cleanup
+++ b/debian/01debathena-reactivate-cleanup
@@ -7,15 +7,6 @@
 # Set the volume to zero for all sound cards, and save that state.
 invoke-rc.d debathena-reactivate start
 
-# Clean up CUPS' cache before starting CUPS back up
-rm -f /var/cache/cups/remote.cache
-
-# Restart necessary daemons outside the chroot
-daemons=$(/usr/sbin/policy-rc.d --daemons)
-for daemon in $daemons; do
-    invoke-rc.d "$daemon" start || [ $? = 100 ]
-done
-
 /usr/lib/debathena-reactivate/reactivate
 
 rm /var/run/athena-login
diff --git a/debian/99debathena-reactivate-setup b/debian/99debathena-reactivate-setup
index 0f0c7d4..a6ab76f 100644
--- a/debian/99debathena-reactivate-setup
+++ b/debian/99debathena-reactivate-setup
@@ -3,10 +3,4 @@
 # This script is also sourced as root at the end of a lightdm login
 # session
 
-# Stop daemons that need to be restarted inside the chroot
-daemons=$(/usr/sbin/policy-rc.d --daemons)
-for daemon in $daemons; do
-    invoke-rc.d "$daemon" stop || [ $? = 100 ]
-done
-
 touch /var/run/athena-login
diff --git a/debian/changelog b/debian/changelog
index 317a1f1..c0afa99 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,15 @@
+debathena-reactivate (2.0.45) unstable; urgency=low
+
+  * Stop installing policy-rc.d in /usr/sbin (Trac: #1478), instead put it
+    in /usr/share and install it into the chroot at snapshot time
+  * Rip out all the CUPS restart code leftover from when we were doing
+    BrowsePolling.
+  * Tweak the EXIT trap in snapshot-run to display a friendly error to the
+    user, especially if the failure was not due to their dotfiles
+  * Add a dependency on zenity, since we're using it in snapshot-run
+
+ -- Jonathan Reed <jdreed@mit.edu>  Thu, 05 Jun 2014 12:30:51 -0400
+
 debathena-reactivate (2.0.44) unstable; urgency=low
 
   * Remove old c-p-d undivert code, it's no longer needed
diff --git a/debian/control b/debian/control
index 90cb365..6aadc37 100644
--- a/debian/control
+++ b/debian/control
@@ -15,6 +15,7 @@ Depends: debathena-schroot | schroot (>= 1.3.2~),
  sudo (>= 1.7.2p1-1~),
  debathena-cupsys-config (>= 1.9~),
  rdate,
+ zenity,
  ${misc:Depends}, 
  ${shlibs:Depends}
 Provides: ${diverted-files}
diff --git a/debian/debathena-reactivate.install b/debian/debathena-reactivate.install
index eea6f5e..317b57b 100644
--- a/debian/debathena-reactivate.install
+++ b/debian/debathena-reactivate.install
@@ -5,7 +5,7 @@ debian/01debathena-reactivate-cleanup usr/share/debathena-gdm-config/PostSession
 debian/99debathena-reactivate-setup usr/share/debathena-lightdm-config/session-setup.d
 debian/01debathena-reactivate-cleanup usr/share/debathena-lightdm-config/session-cleanup.d
 debian/updatedb.findutils.cron.local etc
-debian/policy-rc.d usr/sbin
+debian/policy-rc.d usr/share/debathena-reactivate
 debian/sudo-warning etc/athena
 debian/su-warning etc/athena
 debian/login etc/schroot/chroot.d
diff --git a/debian/debathena-reactivate.postinst b/debian/debathena-reactivate.postinst
index 7e205ce..18823d3 100755
--- a/debian/debathena-reactivate.postinst
+++ b/debian/debathena-reactivate.postinst
@@ -17,8 +17,6 @@ set -e
 # for details, see http://www.debian.org/doc/debian-policy/ or
 # the debian-policy package
 
-. /usr/lib/debathena-cupsys-config/restart-cups.sh
-
 if dpkg-maintscript-helper supports rm_conffile 2> /dev/null; then
     dpkg-maintscript-helper rm_conffile /etc/athena/sudo-error 2.0.39 -- "$@"
     dpkg-maintscript-helper rm_conffile /etc/athena/su-error 2.0.39 -- "$@"
@@ -59,8 +57,6 @@ case "$1" in
 	    /usr/share/update-notifier/notify-reboot-required
 	fi
 
-	# Make printing suck less
-	restart_cups
     ;;
 
     abort-upgrade|abort-remove|abort-deconfigure)
diff --git a/debian/policy-rc.d b/debian/policy-rc.d
index c31cac8..367443f 100755
--- a/debian/policy-rc.d
+++ b/debian/policy-rc.d
@@ -1,8 +1,7 @@
 #!/bin/sh
 
 if [ "--daemons" = "$1" ]; then
-    [ -e /etc/init.d/cups ] && rcname=cups || rcname=cupsys
-    echo $rcname
+    logger -p user.notice -t reactivate "policy-rc.d called by legacy code"
     exit
 fi
 
@@ -12,25 +11,8 @@ case "$2" in
         ;;
 esac
 
-# If nobody's logged in, follow the default policy
-if ! [ -e /var/run/athena-login ]; then
-    exit 0
-elif [ -e /ClusterLogin ]; then
-    case "$1" in
-        cups|cupsys)
-            exit 0
-            ;;
-        *)
-            exit 101
-            ;;
-    esac
-else
-    case "$1" in
-        cups|cupsys)
-            exit 101
-            ;;
-        *)
-            exit 0
-            ;;
-    esac
+if ! [ -e /ClusterLogin ]; then
+    logger -p user.notice -t reactivate "policy-rc.d in effect when /ClusterLogin not present!!"
 fi
+
+exit 101
diff --git a/debian/snapshot-run b/debian/snapshot-run
index fbc0596..5e42a94 100755
--- a/debian/snapshot-run
+++ b/debian/snapshot-run
@@ -8,6 +8,12 @@
 # around their Xsession or shell. You probably want to run reactivate
 # immediately afterwards, as root.
 
+errormsg="Sorry, an internal error occurred while initializing your
+Athena login session.  You will be returned to the login screen.
+
+You may reboot the workstation and try again.  If the error persists,
+please contact hotline@mit.edu and ask them to reinstall this workstation."
+
 if [ -e /var/run/debathena-inhibit-dbus-helper ]; then
     logger -p user.notice -t reactivate "debathena-inhibit-dbus-helper still exists in snapshot-run (shouldn't happen)"
     rm /var/run/debathena-inhibit-dbus-helper
@@ -17,7 +23,6 @@ set -e
 cd /
 
 addgroups="sudo admin lpadmin adm fuse cdrom floppy audio video plugdev scanner dialout lp"
-daemons="$(/usr/sbin/policy-rc.d --daemons)"
 
 # Setup
 
@@ -25,17 +30,21 @@ session=$(schroot -c login -b)
 cleanup() {
     # Teardown
 
+    if [ "$1" = "err" ]; then
+	if hash zenity > /dev/null 2>&1; then
+	    zenity --error --no-wrap --text="$errormsg"
+	else
+	    logger -p user.notice -t reactivate "Fatal error when setting up snapshot; can't inform user"
+	fi
+    fi
+
     # Remove file from above.
     # (This also gets nuked in reactivate, but be paranoid)
     rm -f /tmp/ticketenv
 
-    for daemon in $daemons; do
-	schr invoke-rc.d "$daemon" stop || [ $? = 100 ]
-    done
-
     schroot -c "$session" -e
 }
-trap 'cleanup' EXIT
+trap 'cleanup err' EXIT
 sch() { schroot -r -c "$session" -- "$@"; }          # Run in the chroot
 schq() { schroot -q -r -c "$session" -- "$@"; }      # Run in the chroot quietly
 schr() { schroot -r -c "$session" -u root -- "$@"; } # Run in the chroot as root
@@ -46,9 +55,7 @@ done
 
 schr touch /ClusterLogin
 
-for daemon in $daemons; do
-    schr invoke-rc.d "$daemon" start || [ $? = 100 ]
-done
+schr install -m 0755 /usr/share/debathena-reactivate/policy-rc.d /usr/sbin/policy-rc.d
 
 schr rm /etc/debian_chroot
 
@@ -71,6 +78,7 @@ echo "KRB5CCNAME=$KRB5CCNAME" >| /tmp/ticketenv
 
 set +e
 
+trap 'cleanup' EXIT
 cd
 schroot -c "$session" -r -p -- /usr/lib/debathena-reactivate/session-wrapper "$@"
 cd /

home help back first fref pref prev next nref lref last post