[28241] in Source-Commits

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

reactivate commit: Update for Trusty and schroot 1.6

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

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

https://github.com/mit-athena/reactivate/commit/c70dd6f5332ad6567f6a8b9b988743b5af6bcd75
commit c70dd6f5332ad6567f6a8b9b988743b5af6bcd75
Author: Jonathan Reed <jdreed@mit.edu>
Date:   Fri Jun 6 11:26:56 2014 -0400

    Update for Trusty and schroot 1.6
    
    schroot 1.6 introduces some configuration changes and deprecates
    script-config.  It still works, but spews to stderr, so let's make
    it go away:
    - In the 'login' chroot config, add a new "profile" key pointing
      at the to-be-installed 'athena' directory which contains the profile.
    - Drop the template fstab (mount-athena.in), which was only needed because
      we were still supporting pre-/run releases.
    - Drop the corresponding shell code from script-athena, and instead point
      at the new 'fstab' file shipped with the profile mentioned above.
    - The new 'fstab' file mounts /run with rbind, because /run/user is a thing
      and it's easier to just do it all at once.
    - In the rules file, if we're using an old schroot release, edit the
      config for the old syntax (we still ship script-athena)
    
    Tweak the setup.d scripts for schroot 1.6
    - Only source CHROOT_SCRIPT_CONFIG if common-config doesn't exist.
    - Update 16killprocs-no-really to use CHROOT_PATH when killing
    
    Tweak the transformation of the defaults file
    - schroot 1.6 changes the values.  Also, add a "die" clause so
      we notice when this fails in the future.
    
    Add a .maintscript file to remove the mount-athena.in conffile
    Add a misc:Pre-Depends for the .maintscript file.
    Bump the Dependency to schroot 1.4.25 (precise) or higher

 debian/16killprocs-no-really            |   18 +++++++++++++++---
 debian/90debathena-reactivate           |   10 ++++++++--
 debian/athena/config                    |    2 ++
 debian/athena/fstab                     |   16 ++++++++++++++++
 debian/control                          |    7 ++++---
 debian/debathena-reactivate.install     |    2 +-
 debian/debathena-reactivate.maintscript |    1 +
 debian/login                            |    2 +-
 debian/rules                            |   10 ++++++++++
 debian/script-athena                    |    8 ++------
 debian/transform_schroot_defaults       |    2 +-
 11 files changed, 61 insertions(+), 17 deletions(-)

diff --git a/debian/16killprocs-no-really b/debian/16killprocs-no-really
index 091eff2..a104faf 100755
--- a/debian/16killprocs-no-really
+++ b/debian/16killprocs-no-really
@@ -31,10 +31,22 @@ set -e
 . "$SETUP_DATA_DIR/common-data"
 . "$SETUP_DATA_DIR/common-functions"
 
-if [ -f "$CHROOT_SCRIPT_CONFIG" ]; then
+# schroot 1.6 deprecates script-config.  Once we stop building
+# for precise, we can drop this entire conditional block and simply
+# source $SETUP_DATA_DIR/common-config
+
+# Also, schroot 1.6 replaces CHROOT_MOUNT_LOCATION with CHROOT_PATH in
+# its 15killprocs.  They both still work, but we should update anyway.
+KILLPATH="$CHROOT_MOUNT_LOCATION"
+
+if [ -f "$SETUP_DATA_DIR/common-config" ]; then
+    . "$SETUP_DATA_DIR/common-config"
+    KILLPATH="$CHROOT_PATH"
+elif [ -n  "$CHROOT_SCRIPT_CONFIG" ] && \
+    [ -f "$CHROOT_SCRIPT_CONFIG" ]; then
     . "$CHROOT_SCRIPT_CONFIG"
 elif [ "$STATUS" = "ok" ]; then
-    fatal "script-config file '$CHROOT_SCRIPT_CONFIG' does not exist"
+    fatal "Debathena has no idea how to deal with this schroot configuration."
 fi
 
 # Wrapper around kill command. Turns errors into
@@ -98,5 +110,5 @@ do_kill_all()
 }
 
 if [ $STAGE = "setup-recover" ] || [ $STAGE = "setup-stop" ]; then
-    do_kill_all "$CHROOT_MOUNT_LOCATION"
+    do_kill_all "$KILLPATH"
 fi
diff --git a/debian/90debathena-reactivate b/debian/90debathena-reactivate
index b2dc6fe..1705d0b 100755
--- a/debian/90debathena-reactivate
+++ b/debian/90debathena-reactivate
@@ -5,10 +5,16 @@ set -e
 . "$SETUP_DATA_DIR/common-data"
 . "$SETUP_DATA_DIR/common-functions"
 
-if [ -f "$CHROOT_SCRIPT_CONFIG" ]; then
+# schroot 1.6 deprecates script-config.  Once we stop building
+# for precise, we can drop this entire conditional block and simply
+# source $SETUP_DATA_DIR/common-config
+if [ -f "$SETUP_DATA_DIR/common-config" ]; then
+    . "$SETUP_DATA_DIR/common-config"
+elif [ -n  "$CHROOT_SCRIPT_CONFIG" ] && \
+    [ -f "$CHROOT_SCRIPT_CONFIG" ]; then
     . "$CHROOT_SCRIPT_CONFIG"
 elif [ "$STATUS" = "ok" ]; then
-    fatal "script-config file '$CHROOT_SCRIPT_CONFIG' does not exist"
+    fatal "Debathena has no idea how to deal with this schroot configuration."
 fi
 
 if [ $STAGE = "setup-start" ]; then
diff --git a/debian/athena/config b/debian/athena/config
new file mode 100644
index 0000000..2c4268a
--- /dev/null
+++ b/debian/athena/config
@@ -0,0 +1,2 @@
+# This could be used to execute arbitrary shell code at chroot setup
+# time, but we're not using it.
diff --git a/debian/athena/copyfiles b/debian/athena/copyfiles
new file mode 100644
index 0000000..e69de29
diff --git a/debian/athena/fstab b/debian/athena/fstab
new file mode 100644
index 0000000..8607bd6
--- /dev/null
+++ b/debian/athena/fstab
@@ -0,0 +1,16 @@
+# Note that the mount point will be prefixed by the chroot path
+# (CHROOT_PATH)
+#
+# <file system>	<mount point>	<type>	<options>	<dump>	<pass>
+/proc		/proc		none	rw,bind		0	0
+/sys		/sys		none	rw,bind		0	0
+/dev		/dev		none	rw,bind		0	0
+/dev/pts	/dev/pts	none	rw,bind		0	0
+/run		/run		none	rw,rbind	0	0
+/var/log	/var/log	none	rw,bind		0	0
+/var/tmp	/var/tmp	none	rw,bind		0	0
+/afs		/afs		none	rw,bind		0	0
+/mit		/mit		none	rw,bind		0	0
+/tmp		/tmp		none	rw,bind		0	0
+/media		/media		none	rw,rbind	0	0
+/boot		/boot		none	ro,bind		0	0
diff --git a/debian/athena/nssdatabases b/debian/athena/nssdatabases
new file mode 100644
index 0000000..e69de29
diff --git a/debian/control b/debian/control
index 6aadc37..b7080d1 100644
--- a/debian/control
+++ b/debian/control
@@ -2,12 +2,13 @@ Source: debathena-reactivate
 Section: debathena/net
 Priority: extra
 Maintainer: Debathena Project <debathena@mit.edu>
-Build-Depends: debhelper (>= 7.0.50~), config-package-dev (>= 5.0~), sudo, schroot, dbus, gettext
+Build-Depends: debhelper (>= 8.1.0~), config-package-dev (>= 5.0~), sudo, schroot, dbus, gettext
 Standards-Version: 3.9.3
 
 Package: debathena-reactivate
 Architecture: any
-Depends: debathena-schroot | schroot (>= 1.3.2~),
+Pre-Depends: ${misc:Pre-Depends}
+Depends: schroot (>= 1.4.25~),
  psmisc,
  gdm,
  alsa-utils,
@@ -20,7 +21,7 @@ Depends: debathena-schroot | schroot (>= 1.3.2~),
  ${shlibs:Depends}
 Provides: ${diverted-files}
 Conflicts: ${diverted-files}
-X-Debathena-Build-For: precise
+X-Debathena-Build-For: precise trusty
 Description: Causes gdm logins to run in an ephemeral snapshot of the root
  This package causes each gdm login to run in a temporary copy of the
  root, so that any system modifications performed within the chroot
diff --git a/debian/debathena-reactivate.install b/debian/debathena-reactivate.install
index 317b57b..4d0a6fd 100644
--- a/debian/debathena-reactivate.install
+++ b/debian/debathena-reactivate.install
@@ -10,7 +10,7 @@ debian/sudo-warning etc/athena
 debian/su-warning etc/athena
 debian/login etc/schroot/chroot.d
 debian/script-athena etc/schroot
-debian/mount-athena.in etc/schroot
+debian/athena etc/schroot
 debian/snapshot-run usr/lib/debathena-reactivate
 debian/reactivate usr/lib/debathena-reactivate
 debian/dbus-daemon-launch-helper lib/debathena-reactivate
diff --git a/debian/debathena-reactivate.maintscript b/debian/debathena-reactivate.maintscript
new file mode 100644
index 0000000..10a9356
--- /dev/null
+++ b/debian/debathena-reactivate.maintscript
@@ -0,0 +1 @@
+rm_conffile /etc/schroot/mount-athena.in 2.0.45~
diff --git a/debian/login b/debian/login
index 4fe5db1..91f260f 100644
--- a/debian/login
+++ b/debian/login
@@ -3,7 +3,7 @@ type=directory
 # There's got to be a better way
 groups=nss-local-users,nss-nonlocal-users
 root-groups=nss-local-users,nss-nonlocal-users
-script-config=script-athena
+profile=athena
 directory=/
 union-type=aufs
 # Don't filter out any environment variables
diff --git a/debian/rules b/debian/rules
index e375250..313d9ad 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,7 +1,17 @@
 #!/usr/bin/make -f
 
+SCHROOT_VERSION = $(shell dpkg-query --showformat='$${Version}' --show schroot)
+SCHROOT_16 = $(shell dpkg --compare-versions $(SCHROOT_VERSION) ge '1.6.4-1~' && echo y)
+
 %:
 	dh $@ --with config-package
 
 override_dh_fixperms:
 	dh_fixperms -X/usr/lib/debathena-reactivate/session-wrapper
+
+override_dh_install:
+	dh_install
+ifneq ($(SCHROOT_16),y)
+# Remember to prefix $ with $, because make hates you.
+	sed -i -e 's/^profile=athena$$/script-config=script-athena/' debian/debathena-reactivate/etc/schroot/chroot.d/login
+endif
diff --git a/debian/script-athena b/debian/script-athena
index 2f730aa..63f48b5 100644
--- a/debian/script-athena
+++ b/debian/script-athena
@@ -1,8 +1,4 @@
-FSTAB="/etc/schroot/mount-athena"
+# This file is deprecated and only used by schroot 1.4 and earlier
+FSTAB="/etc/schroot/athena/fstab"
 COPYFILES=""
 NSSDATABASES=""
-
-rm -f "${FSTAB}"
-sed -e "s|_VARRUN_|$(readlink -f /var/run)|g" \
-       -e "s|_VARLOCK_|$(readlink -f /var/lock)|g" \
-       -e "s|_DEVSHM_|$(readlink -f /dev/shm)|g" < "${FSTAB}.in" > "${FSTAB}"
diff --git a/debian/transform_schroot_defaults b/debian/transform_schroot_defaults
index 21443f6..62b8dfc 100755
--- a/debian/transform_schroot_defaults
+++ b/debian/transform_schroot_defaults
@@ -1,2 +1,2 @@
 #!/usr/bin/perl -0p
-s/^SESSIONS_RECOVER="recover"$/SESSIONS_RECOVER="end"/m;
+s/^SESSIONS_RECOVER="recover"$/SESSIONS_RECOVER="end"/m or s/^START_ACTION="recover"$/START_ACTION="end"/m or die "Transformation failed; upstream file changed?";

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