[debian-edu-commits] debian-edu/ 01/01: Add signal trapping in all d-i hooks to print an error: string if one of them terminates unexpectedly.

Petter Reinholdtsen pere at moszumanska.debian.org
Fri Sep 12 07:00:04 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 5f0e208e49932252da9b941cb3a563b3480bd5fa
Author: Petter Reinholdtsen <pere at hungry.com>
Date:   Fri Sep 12 08:59:57 2014 +0200

    Add signal trapping in all d-i hooks to print an error: string if one of them terminates unexpectedly.
---
 apt-setup/generators/70debian-edu-install | 14 ++++++++++++--
 base-installer                            | 13 ++++++++++---
 debian/changelog                          |  2 ++
 finish-install                            | 15 +++++++++++----
 post-base-installer                       | 12 ++++++++++++
 pre-pkgsel                                |  7 +++++++
 6 files changed, 54 insertions(+), 9 deletions(-)

diff --git a/apt-setup/generators/70debian-edu-install b/apt-setup/generators/70debian-edu-install
index 9ca53ef..14de5fd 100644
--- a/apt-setup/generators/70debian-edu-install
+++ b/apt-setup/generators/70debian-edu-install
@@ -4,9 +4,15 @@ set -e
 . /usr/share/debconf/confmodule
 . /lib/debian-edu-common
 
-log() {
-    logger -t aptsetup-de "info: $*"
+logmsg() { logger -t debian-edu-install/apt-setup "$*" }
+log() { logmsg "info: $*" }
+error() { logmsg "error: $*" }
+
+at_exit() {
+    error "script $0 terminated unexpectedly."
 }
+disable_exception() { trap - INT TERM EXIT }
+trap at_exit INT TERM EXIT
 
 log "Doing some apt-source magic for Debian-Edu"
 
@@ -48,6 +54,7 @@ if test "$MIRROR" ; then
 	log "Mirror set, running apt-setup override for debian-edu"
 else
 	log "No mirror set, not running apt-setup override for debian-edu"
+	disable_exception
 	exit 0
 fi
 
@@ -74,6 +81,7 @@ fi
 # without adding an official mirror
 db_get mirror/country || true
 if [ "$RET" != "enter information manually" ] ; then 
+    disable_exception
     exit 0
 fi
 
@@ -98,3 +106,5 @@ echo "deb http://http.debian.net/debian $codename $dists" >> $file
 echo "deb http://ftp.skolelinux.no/skolelinux $educodename local" >> $file
 
 edu-etcvcs commit
+
+disable_exception
diff --git a/base-installer b/base-installer
index 966f2b0..f4ed4a4 100755
--- a/base-installer
+++ b/base-installer
@@ -1,8 +1,13 @@
-#! /bin/sh -e
+#!/bin/sh -e
 
-log() {
-    logger -t debian-edu-install/base-installer "info: $*"
+logmsg() { logger -t debian-edu-install/base-installer "info: $*" }
+log() { logmsg "info: $*" }
+
+at_exit() {
+    logmsg "error: script $0 terminated unexpectedly."
 }
+disable_exception() { trap - INT TERM EXIT }
+trap at_exit INT TERM EXIT
 
 # remove the debianfreespace logical volume.  Doing it before
 # installing packages, to make it possible to resize volumes on the
@@ -82,3 +87,5 @@ else
     test -f /target/etc/apt/trusted.gpg && \
         log "trusted.gpg already exists under /etc/apt in target"
 fi
+
+disable_exception
diff --git a/debian/changelog b/debian/changelog
index 126b06c..b52dfc1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,8 @@ debian-edu-install (1.730) UNRELEASED; urgency=low
 
   * Fix base-installer.d script to not crash unable to remove
     /target/debianedufreespace/.
+  * Add signal trapping in all d-i hooks to print an error: string if
+    one of them terminates unexpectedly.
 
  -- Petter Reinholdtsen <pere at debian.org>  Fri, 12 Sep 2014 08:42:54 +0200
 
diff --git a/finish-install b/finish-install
index 8b23996..b6cc7bf 100755
--- a/finish-install
+++ b/finish-install
@@ -9,10 +9,6 @@
 . /usr/share/debconf/confmodule
 . /lib/debian-edu-common
 
-# Stop automatic lvm resize script set up before base-installer
-# started.
-rm -f /target/debian-edu-extend-file-systems
-
 log() {
     logger -t 10debian-edu-install "$@"
 }
@@ -21,6 +17,16 @@ error() {
     logger -t 10debian-edu-install "error: $@"
 }
 
+at_exit() {
+    error "script $0 terminated unexpectedly."
+}
+disable_exception() { trap - INT TERM EXIT }
+trap at_exit INT TERM EXIT
+
+# Stop automatic lvm resize script set up before base-installer
+# started.
+rm -f /target/debian-edu-extend-file-systems
+
 load_proxy_conf
 
 hook=/target/usr/share/debian-edu-config/d-i/finish-install
@@ -31,4 +37,5 @@ else
     error "Unable to find $hook"
 fi
 
+disable_exception
 exit 0
diff --git a/post-base-installer b/post-base-installer
index c86e616..ca02f1e 100755
--- a/post-base-installer
+++ b/post-base-installer
@@ -4,4 +4,16 @@
 # is installed, and before most packages are installed.  APT is
 # only using packages on the CD/DVD at this point.
 
+log() { logger -t debian-edu-install/post-base-installer "$@" }
+error() { log "error: $*" }
+
+at_exit() {
+    error "script $0 terminated unexpectedly."
+}
+disable_exception() { trap - INT TERM EXIT }
+trap at_exit INT TERM EXIT
+
+# ...
+
+disable_exception
 exit 0
diff --git a/pre-pkgsel b/pre-pkgsel
index bccb7ea..17c3a0d 100755
--- a/pre-pkgsel
+++ b/pre-pkgsel
@@ -14,6 +14,12 @@ error() {
     logger -t edu-pre-pkgsel "error: $*"
 }
 
+at_exit() {
+    error "script $0 terminated unexpectedly."
+}
+disable_exception() { trap - INT TERM EXIT }
+trap at_exit INT TERM EXIT
+
 # Install required packages, report fatal error and reboot if it fail.
 install_required_pkg() {
     p="$1"
@@ -103,4 +109,5 @@ fi
 
 edu-etcvcs commit
 
+disable_exception
 exit 0

-- 
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