diff --git a/branches/ucs-4.0/ucs-4.0-3/base/univention-grub/debian/changelog b/branches/ucs-4.0/ucs-4.0-3/base/univention-grub/debian/changelog index f3b17ab..3c95fdc 100644 --- a/branches/ucs-4.0/ucs-4.0-3/base/univention-grub/debian/changelog +++ b/branches/ucs-4.0/ucs-4.0-3/base/univention-grub/debian/changelog @@ -1,3 +1,9 @@ +univention-grub (8.0.4-3) unstable; urgency=low + + * Bug #39126: Fix upgrade issue + + -- Philipp Hahn Tue, 11 Aug 2015 13:28:27 +0200 + univention-grub (8.0.4-2) unstable; urgency=low * Bug #38779: Make title configurable diff --git a/branches/ucs-4.0/ucs-4.0-3/base/univention-grub/debian/univention-grub.postinst b/branches/ucs-4.0/ucs-4.0-3/base/univention-grub/debian/univention-grub.postinst index 3f74c85..33e87e7 100644 --- a/branches/ucs-4.0/ucs-4.0-3/base/univention-grub/debian/univention-grub.postinst +++ b/branches/ucs-4.0/ucs-4.0-3/base/univention-grub/debian/univention-grub.postinst @@ -37,7 +37,7 @@ eval "$(univention-config-registry shell)" . /usr/share/univention-lib/ucr.sh # update to 4.0 -if [ "$1" = configure -a -n "$2" ] && dpkg --compare-versions "$2" lt 8.0.2-1; then +if [ "$1" = configure ] && dpkg --compare-versions "$2" lt-nl 8.0.2-1; then ucr unset grub/vga ucr set \ grub/color/normal="black/black" \ @@ -45,6 +45,10 @@ if [ "$1" = configure -a -n "$2" ] && dpkg --compare-versions "$2" lt 8.0.2-1; t grub/menu/color/normal="black/black" \ grub/menu/color/highlight="white/green" fi +if [ "$1" = configure ] && dpkg --compare-versions "$2" lt-nl 8.0.4-3 && [ -x /etc/kernel/postinst.d/zz-update-grub ] && [ "$(ucr get kernel/postinst_hook)" = /usr/sbin/update-grub ] +then + ucr unset kernel/postinst_hook +fi gfxmode="800x600@16" # grub menu is invisibal in xen HVM unless text mode is used @@ -54,7 +58,6 @@ fi # Bug #24858: xen-4.1 needs 800x600 univention-config-registry set grub/timeout?5 \ - kernel/postinst_hook?"/usr/sbin/update-grub" \ grub/quiet?"yes" \ grub/loglevel?"0" \ grub/gfxmode?"$gfxmode" \ @@ -92,19 +95,13 @@ if ! [ -e /boot/grub/menu.lst ] ; then /usr/sbin/univention-grub-generate-menu-lst fi -grepcnt=$(grep -c "^dm-mod$" /etc/initramfs-tools/modules) -if [ "$grepcnt" = "0" ] ; then +if ! grep -q "^dm-mod$" /etc/initramfs-tools/modules +then echo "LVM kernel module 'dm-mod' is missing in initrd - recreating initrd" echo "dm-mod" >> /etc/initramfs-tools/modules echo "dm-mirror" >> /etc/initramfs-tools/modules echo "dm-snapshot" >> /etc/initramfs-tools/modules - filelist=$(ls -1 /boot/initrd.img-* 2>/dev/null) - if [ -n "$filelist" ] ; then - for fn in $filelist ; do - kernelversion=${fn/\/boot\/initrd.img-} - update-initramfs -u -t -k "$kernelversion" - done - fi + update-initramfs -u -t -k all fi exit 0 diff --git a/branches/ucs-4.0/ucs-4.0-3/base/univention-grub/univention-grub-generate-menu-lst b/branches/ucs-4.0/ucs-4.0-3/base/univention-grub/univention-grub-generate-menu-lst index 8fa68ab..57b57fb 100755 --- a/branches/ucs-4.0/ucs-4.0-3/base/univention-grub/univention-grub-generate-menu-lst +++ b/branches/ucs-4.0/ucs-4.0-3/base/univention-grub/univention-grub-generate-menu-lst @@ -35,9 +35,8 @@ import sys import shutil import re -import univention.debug as udbg import univention.config_registry as ucr -from distutils.version import LooseVersion + class kernel: def __init__(self, kversion, uversion, arch, origversion): @@ -45,24 +44,22 @@ class kernel: self.uversion = uversion self.arch = arch self.origversion = origversion + def __repr__(self): return repr((self.kversion, self.uversion, self.arch)) + configRegistry=ucr.ConfigRegistry() configRegistry.load() -if 'grub/generate-menu-lst' not in configRegistry or configRegistry.is_false('grub/generate-menu-lst', False): +if configRegistry.is_false('grub/generate-menu-lst', True): sys.exit(0) if os.path.exists("/boot/grub/menu.lst"): - f = open("/boot/grub/menu.lst") - generated_by_ucs = False - - for i in f.readlines(): - if i.find("auto-generated through univention-grub-generate-menu-lst") != -1: - generated_by_ucs = True - - if not generated_by_ucs: + for line in open("/boot/grub/menu.lst", "r"): + if "auto-generated through univention-grub-generate-menu-lst" in line: + break + else: print "menu.lst already exists. This typically happens if you have updated from UCS 2.4" print "and haven't converted from chain loading" sys.exit(0) @@ -74,13 +71,14 @@ except OSError, e: sys.exit(1) -lst = [] -lst.append("# This Grub configuration is auto-generated through univention-grub-generate-menu-lst.") -lst.append("# It is used when booting UCS 3.0 as a Xen DomU with an older version of Pygrub") -lst.append(" ") -lst.append("default 0") -lst.append("timeout 5 ") -lst.append(" ") +lst = [ + "# This Grub configuration is auto-generated through univention-grub-generate-menu-lst.", + "# It is used when booting UCS 3.0 as a Xen DomU with an older version of Pygrub", + "", + "default 0", + "timeout 5 ", + "", +] RE_MENUENTRY = re.compile(r"^\s*menuentry '([^']*)' .*") RE_ROOT = re.compile(r"^\s+set\s+root='\(?(hd[0-9]+|/dev/\w+d[a-z]),[a-z]+([0-9]+)\)?'") @@ -88,7 +86,7 @@ RE_LINUX = re.compile(r"^\s+linux\s+(.+)") RE_INITRD = re.compile(r"^\s+initrd\s+(.+)") RE_CLOSE = re.compile(r"^}") -name = kernel = initrd = None +name = root = kernel = initrd = None for line in grub2: m = RE_MENUENTRY.match(line) @@ -105,7 +103,7 @@ for line in grub2: if device.startswith('hd'): root = "(%s,%d)" % (device, int(part) - 1) elif device.startswith('/dev/'): - root = "(hd0,%d)" % (int(part) - 1) + root = "(hd0,%d)" % (int(part) - 1,) else: print >>sys.stderr, "Unhandled root=%s" % (line,) @@ -127,7 +125,7 @@ for line in grub2: lst.append("kernel " + kernel) if initrd: lst.append("initrd " + initrd) - lst.append(" ") + lst.append("") name = root = kernel = initrd = None continue