[debian-edu-commits] debian-edu/ 01/01: Improve firstboot script even more.

Petter Reinholdtsen pere at moszumanska.debian.org
Thu Oct 16 21:28:17 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 f893244148755f9fff7cadef5652562223ae59ab
Author: Petter Reinholdtsen <pere at hungry.com>
Date:   Thu Oct 16 23:28:07 2014 +0200

    Improve firstboot script even more.
---
 debian/changelog                                   |  6 ++
 .../debian-edu-install.xdebian-edu-firstboot.init  | 96 +++++++++++-----------
 2 files changed, 54 insertions(+), 48 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index bd10af8..174899d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,12 @@ debian-edu-install (1.812) UNRELEASED; urgency=low
   * Rewrite code in firstboot script to detect a working X frontend
     for debconf to also work with the new multiarch libraries, to get
     the test result presented in X.
+  * Make sure firstboot script run after lightdm is started too.
+  * Adjust firstboot script to flag that it was done before the test
+    result is presented, to ensure it only run once no matter what
+    happen with the test result dialog.
+  * Change firstboot script to avoid checking for a working X
+    authority file twice when restarted by debconf.
 
  -- Petter Reinholdtsen <pere at debian.org>  Thu, 16 Oct 2014 14:37:51 +0200
 
diff --git a/debian/debian-edu-install.xdebian-edu-firstboot.init b/debian/debian-edu-install.xdebian-edu-firstboot.init
index 3bc68b7..b4d288b 100755
--- a/debian/debian-edu-install.xdebian-edu-firstboot.init
+++ b/debian/debian-edu-install.xdebian-edu-firstboot.init
@@ -3,7 +3,7 @@
 # Provides:          xdebian-edu-firstboot
 # Required-Start:    $remote_fs $all
 # Required-Stop:
-# Should-Start:      $x-display-manager xdm kdm gdm wdm slim
+# Should-Start:      $x-display-manager xdm kdm gdm wdm slim lightdm
 # Default-Start:     2 3 4 5
 # Default-Stop:
 # X-Interactive:     true
@@ -88,6 +88,9 @@ do_start() {
 	log_end_msg 0 || true
     fi
 
+    # Create firstboot file to prevent it from being run again
+    touch "$firstboot_file"
+
     # only run the testsuite and report errors during development, not
     # during production
     if [ -f /etc/debian-edu/config ] ; then . /etc/debian-edu/config ; fi
@@ -97,60 +100,57 @@ do_start() {
 	log_begin_msg "Not collecting testsuite results"
 	log_end_msg 0 || true
     fi
-
-    # Create firstboot file to prevent it from being run again
-    touch "$firstboot_file"
 }
 
 prepare_debconf() {
     # Try to get debconf to pop up the dialog on top of the display
     # manager.  Need to do this before starting debconf.
-
-    # This is generated by kdm
-    candidate="`ls -tr /var/run/xauth/* 2>/dev/null|tail -1`"
-
-    # gdm, lightdm
-    candidate="$candidate /var/lib/gdm/:0.Xauth /var/lib/lightdm/.Xauthority"
-
-    # gdm3
-    for f in /var/run/gdm3/auth-for-Debian-gdm*/database ; do
-	candidate="$candidate $f"
-    done
-
-    XAUTHORITY=
-    for f in $candidate ; do
-	if XAUTHORITY=$f DISPLAY=:0 xauth list >/dev/null 2>&1 &&
-	    XAUTHORITY=$f DISPLAY=:0 xhost > /dev/null 2>&1 ; then
-	    XAUTHORITY=$f
-	    break
+    if [ ! "$DEBIAN_HAS_FRONTEND" ] ; then
+        # This is generated by kdm
+	candidate="`ls -tr /var/run/xauth/* 2>/dev/null|tail -1`"
+
+        # gdm, lightdm
+	candidate="$candidate /var/lib/gdm/:0.Xauth /var/lib/lightdm/.Xauthority"
+
+        # gdm3
+	for f in /var/run/gdm3/auth-for-Debian-gdm*/database ; do
+	    candidate="$candidate $f"
+	done
+
+	XAUTHORITY=
+	for f in $candidate ; do
+	    if XAUTHORITY=$f DISPLAY=:0 xauth list >/dev/null 2>&1 &&
+		XAUTHORITY=$f DISPLAY=:0 xhost > /dev/null 2>&1 ; then
+		XAUTHORITY=$f
+		break
+	    fi
+	done
+
+	if [ "$XAUTHORITY" ] ; then
+            info "found X authority file $XAUTHORITY, trying to start debconf with X frontend."
+            # Try to use kde frontend (require libqt-perl) or gnome frontend
+            # (libgtk2-perl).  debconf will fall back to dialog if either
+            # frontend fails to start.  The frontend need to be set before
+            # confmodule is sourced to have effect.
+            DISPLAY=:0
+            # TODO: find graphical variant that works with dialog frontend?
+            if perl -MGtk2 -e 'exit 0' ; then
+               # use gnome frontend
+		export DEBIAN_FRONTEND=gnome
+            elif perl -MQtCore4 -e 'exit 0' ; then
+               # use kde frontend
+		export DEBIAN_FRONTEND=kde
+            else
+		info "unable to find usable debconf X frontend"
+            fi
+            export XAUTHORITY DISPLAY
+	elif [ -d /run/systemd/system ] ; then
+            # FIXME Figure out what to do under systemd, where no tty
+            # is available!  For now, just give up. :(
+            info "systemd and no X detected, not showing test status"
+            return 1
 	fi
-    done
-
-    if [ "$XAUTHORITY" ] ; then
-        info "found X authority file $XAUTHORITY, trying to start debconf with X frontend."
-        # Try to use kde frontend (require libqt-perl) or gnome frontend
-        # (libgtk2-perl).  debconf will fall back to dialog if either
-        # frontend fails to start.  The frontend need to be set before
-        # confmodule is sourced to have effect.
-        DISPLAY=:0
-        # TODO: find graphical variant that works with dialog frontend?
-        if perl -MGtk2 -e 'exit 0' ; then
-            # use gnome frontend
-            export DEBIAN_FRONTEND=gnome
-        elif perl -MQtCore4 -e 'exit 0' ; then
-            # use kde frontend
-            export DEBIAN_FRONTEND=kde
-        else
-            info "unable to find usable debconf X frontend"
-        fi
-        export XAUTHORITY DISPLAY
-    elif [ -d /run/systemd/system ] ; then
-        # FIXME Figure out what to do under systemd, where no tty is available!
-        # For now, just give up. :(
-        info "systemd and no X detected, not showing test status"
-        return 1
     fi
-
     . /usr/share/debconf/confmodule
 
     # Disable usplash if enabled and not using the X display, to get

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