[debian-edu-commits] debian-edu/ 02/02: Rewrite edu-eatmydata-install to use the Dir::Bin::dpkg apt option instead of using dpkg-divert, as benchmarking show that the advantage of using dpkg-divert is negligible and the apt option show up in etckeeper logs.

Petter Reinholdtsen pere at moszumanska.debian.org
Wed Sep 24 09:37:21 UTC 2014


This is an automated email from the git hooks/post-receive script.

pere pushed a commit to branch master
in repository debian-edu-install.

commit dfd8eaf3f08a621220bbc9a07db30ff7bb634907
Author: Petter Reinholdtsen <pere at hungry.com>
Date:   Wed Sep 24 11:37:10 2014 +0200

    Rewrite edu-eatmydata-install to use the Dir::Bin::dpkg apt option instead of using dpkg-divert, as benchmarking show that the advantage of using dpkg-divert is negligible and the apt option show up in etckeeper logs.
---
 debian/changelog            |  4 ++++
 tools/edu-eatmydata-install | 52 ++++++++++++++++++++-------------------------
 2 files changed, 27 insertions(+), 29 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 69434b4..5b40c0f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,10 @@ debian-edu-install (1.804) UNRELEASED; urgency=low
 
   * Disable the quick install using eatmydata until bug #759590 is
     fixed, as that bug break installation of exim4-config.
+  * Rewrite edu-eatmydata-install to use the Dir::Bin::dpkg apt option
+    instead of using dpkg-divert, as benchmarking show that the
+    advantage of using dpkg-divert is negligible and the apt option
+    show up in etckeeper logs.
 
  -- Petter Reinholdtsen <pere at debian.org>  Wed, 24 Sep 2014 10:08:25 +0200
 
diff --git a/tools/edu-eatmydata-install b/tools/edu-eatmydata-install
index 42f19af..b09aab9 100755
--- a/tools/edu-eatmydata-install
+++ b/tools/edu-eatmydata-install
@@ -1,7 +1,7 @@
 #!/bin/sh
-# Speed up apt/dpkg/tasksel intsallation by disabling all file system
+# Speed up package installation by disabling all file system
 # flushing.  If something go wrong on first time installation,
-# reinstall.  This divert is done in post-base-installer.d and
+# reinstall.  This override is put in place post-base-installer.d and
 # pre-pkgsel.d and undone in finish-install.  See also bug #613428.
 
 set -e
@@ -18,39 +18,29 @@ trap at_exit INT TERM EXIT
 
 enable_override() {
     apt-install eatmydata || true
-    if [ -x /target/usr/bin/eatmydata ] ; then
-        for bin in dpkg apt-get tasksel ; do
-            file=/usr/bin/$bin
-            # Test that the file exist and have not been diverted already.
-            if [ -f /target/usr/bin/$bin ] ; then
-                info "diverting /usr/bin/$bin using eatmydata"
-                printf "#!/bin/sh\neatmydata $bin.distrib \"\$@\"\n" \
-                    > /target/usr/bin/$bin.edu
-                chmod 755 /target/usr/bin/$bin.edu
-                in-target dpkg-divert --package debian-edu-config \
-                    --rename --quiet --add /usr/bin/$bin
-                ln -sf ./$bin.edu /target/usr/bin/$bin
-            else
-                error "unable to divert /usr/bin/$bin, as it is missing."
-            fi
-        done
+    if [ -x /target/usr/bin/eatmydata ] && \
+	[ ! -f /target/etc/apt/apt.conf.d/debian-edu-install-dpkg-eatmydata ]; then
+        # Add apt config to call dpkg via eatmydata
+        printf "#!/bin/sh\neatmydata dpkg \"\$@\"\n" \
+            > /target/var/tmp/dpkg-eatmydata
+        chmod 755 /target/var/tmp/dpkg-eatmydata
+	cat > /target/etc/apt/apt.conf.d/debian-edu-install-dpkg-eatmydata <<EOF
+Dir::Bin::dpkg "/var/tmp/dpkg-eatmydata";
+EOF
     else
         error "unable to find /usr/bin/eatmydata after installing the eatmydata package"
     fi
 }
 
 disable_override() {
-    for bin in dpkg apt-get tasksel ; do
-        file=/usr/bin/$bin
-        if [ -x /target$file.edu ] ; then
-            info "removing eatmydata divert for /usr/bin/$bin"
-            rm /target$file
-            in-target dpkg-divert --package debian-edu-config \
-                --rename --quiet --remove $file
-            rm /target$file.edu
-        else
-            error "missing divert for $file."
-        fi
+    for override in \
+	/etc/apt/apt.conf.d/debian-edu-install-dpkg-eatmydata \
+	/var/tmp/dpkg-eatmydata ; do
+	if [ -f /target$override ] ; then
+            rm -f /target$override
+	else
+            error "missing /target$override"
+	fi
     done
     sync # Flush file buffers before continuing
 }
@@ -62,6 +52,10 @@ case "$1" in
     disable)
         disable_override
         ;;
+    *)
+        error "invalid argument $1"
+        ;;
+
 esac
 
 disable_exception

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-edu/debian-edu-install.git



More information about the debian-edu-commits mailing list