Imported Debian patch 3.6-3
[debian/elilo] / debian / postinst
index 50b76cadb56d74cc159ea62d389e1860ad0b6496..465c7a99e9af8ac05bec45dc1621bd3c10636d7c 100644 (file)
@@ -1,12 +1,32 @@
-#!/bin/sh -e
+#!/bin/sh
+
+set -e
+
+if [ -f /usr/share/debconf/confmodule ]; then
+  . /usr/share/debconf/confmodule
+fi
 
-# don't bother with debconf for this, since very few systems are likely to
-# be affected by this upgrade, and it's a one-shot deal.  this postinst can
-# probably be safely removed for the woody+1 release.
 
 case "$1" in
-    configure)
-        # continue below
+    configure|reconfigure)
+       # On new installs, do nothing - elilo-installer will handle it for d-i
+       if grep -q "^# UNCONFIGURED FSTAB FOR BASE SYSTEM" /etc/fstab ; then
+         exit 0
+       fi
+        if [ "$2" ] && dpkg --compare-versions $2 lt 3.2-1
+        then
+            db_get elilo/format || true;
+            if [ x"$RET" = x"true" ]; then
+                echo "Running elilo..."
+                /usr/sbin/elilo --format --efiboot
+            fi
+            exit 0
+        fi
+        db_get elilo/runme || true;
+        if [ x"$RET" = x"true" ]; then
+            echo "Running elilo..."
+            /usr/sbin/elilo
+        fi
     ;;
 
     abort-upgrade|abort-remove|abort-deconfigure)
@@ -19,34 +39,6 @@ case "$1" in
     ;;
 esac
 
-if [ "$2" ] && dpkg --compare-versions $2 lt 3.2-1
-then
-  echo ""
-  echo "You appear to be upgrading from an old (pre-3.2) version of the elilo"
-  echo "package.  The structure of files in the EFI partition is different"
-  echo "now, and the EFI boot manager entry for Debian needs to be updated."
-  echo ""
-  echo "If you have not made any manual changes to the EFI partition content"
-  echo "that you want to preserve, we can reformat and reload that partition"
-  echo "for you, and rewrite the boot manager entry to be correct."
-  echo ""
-  echo "Do you want me to reformat and reload the EFI partition and write an"
-  echo -n "updated boot manager entry for you [Ny]? "
-
-  read answer
-  case "$answer" in
-    [Yy]*)
-       echo -n "Working... "
-       /usr/sbin/elilo --format --efiboot
-       echo "done."
-       ;;
-    *)
-       echo "No action taken.  See /usr/share/doc/elilo/* for more info."
-       ;;
-  esac
-  echo ""
-fi
-
 #DEBHELPER#
 
 exit 0