View | Details | Raw Unified | Return to bug 39126
Collapse All | Expand All

(-)a/branches/ucs-4.0/ucs-4.0-3/base/univention-grub/debian/changelog (+6 lines)
 Lines 1-3    Link Here 
1
univention-grub (8.0.4-3) unstable; urgency=low
2
3
  * Bug #39126: Fix upgrade issue
4
5
 -- Philipp Hahn <hahn@univention.de>  Tue, 11 Aug 2015 13:28:27 +0200
6
1
univention-grub (8.0.4-2) unstable; urgency=low
7
univention-grub (8.0.4-2) unstable; urgency=low
2
8
3
  * Bug #38779: Make title configurable
9
  * Bug #38779: Make title configurable
(-)a/branches/ucs-4.0/ucs-4.0-3/base/univention-grub/debian/univention-grub.postinst (-11 / +8 lines)
 Lines 37-43   eval "$(univention-config-registry shell)" Link Here 
37
. /usr/share/univention-lib/ucr.sh
37
. /usr/share/univention-lib/ucr.sh
38
38
39
# update to 4.0
39
# update to 4.0
40
if [ "$1" = configure -a -n "$2" ] && dpkg --compare-versions "$2" lt 8.0.2-1; then
40
if [ "$1" = configure ] && dpkg --compare-versions "$2" lt-nl 8.0.2-1; then
41
	ucr unset grub/vga
41
	ucr unset grub/vga
42
	ucr set \
42
	ucr set \
43
		grub/color/normal="black/black" \
43
		grub/color/normal="black/black" \
 Lines 45-50   if [ "$1" = configure -a -n "$2" ] && dpkg --compare-versions "$2" lt 8.0.2-1; t Link Here 
45
		grub/menu/color/normal="black/black" \
45
		grub/menu/color/normal="black/black" \
46
		grub/menu/color/highlight="white/green"
46
		grub/menu/color/highlight="white/green"
47
fi
47
fi
48
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 ]
49
then
50
	ucr unset kernel/postinst_hook
51
fi
48
52
49
gfxmode="800x600@16"
53
gfxmode="800x600@16"
50
# grub menu is invisibal in xen HVM unless text mode is used
54
# grub menu is invisibal in xen HVM unless text mode is used
 Lines 54-60   fi Link Here 
54
58
55
# Bug #24858: xen-4.1 needs 800x600
59
# Bug #24858: xen-4.1 needs 800x600
56
univention-config-registry set grub/timeout?5 \
60
univention-config-registry set grub/timeout?5 \
57
	kernel/postinst_hook?"/usr/sbin/update-grub" \
58
	grub/quiet?"yes"  \
61
	grub/quiet?"yes"  \
59
	grub/loglevel?"0" \
62
	grub/loglevel?"0" \
60
	grub/gfxmode?"$gfxmode" \
63
	grub/gfxmode?"$gfxmode" \
 Lines 92-110   if ! [ -e /boot/grub/menu.lst ] ; then Link Here 
92
    /usr/sbin/univention-grub-generate-menu-lst
95
    /usr/sbin/univention-grub-generate-menu-lst
93
fi
96
fi
94
97
95
grepcnt=$(grep -c "^dm-mod$" /etc/initramfs-tools/modules)
98
if ! grep -q "^dm-mod$" /etc/initramfs-tools/modules
96
if [ "$grepcnt" = "0" ] ; then
99
then
97
	echo "LVM kernel module 'dm-mod' is missing in initrd - recreating initrd"
100
	echo "LVM kernel module 'dm-mod' is missing in initrd - recreating initrd"
98
	echo "dm-mod" >> /etc/initramfs-tools/modules
101
	echo "dm-mod" >> /etc/initramfs-tools/modules
99
	echo "dm-mirror" >> /etc/initramfs-tools/modules
102
	echo "dm-mirror" >> /etc/initramfs-tools/modules
100
	echo "dm-snapshot" >> /etc/initramfs-tools/modules
103
	echo "dm-snapshot" >> /etc/initramfs-tools/modules
101
	filelist=$(ls -1 /boot/initrd.img-* 2>/dev/null)
104
	update-initramfs -u -t -k all
102
	if [ -n "$filelist" ] ; then
103
		for fn in $filelist ; do
104
			kernelversion=${fn/\/boot\/initrd.img-}
105
			update-initramfs -u -t -k "$kernelversion"
106
		done
107
	fi
108
fi
105
fi
109
106
110
exit 0
107
exit 0
(-)a/branches/ucs-4.0/ucs-4.0-3/base/univention-grub/univention-grub-generate-menu-lst (-21 / +19 lines)
 Lines 35-43   import sys Link Here 
35
import shutil
35
import shutil
36
import re
36
import re
37
37
38
import univention.debug as udbg
39
import univention.config_registry as ucr
38
import univention.config_registry as ucr
40
from distutils.version import LooseVersion
39
41
40
42
class kernel:
41
class kernel:
43
	def __init__(self, kversion, uversion, arch, origversion):
42
	def __init__(self, kversion, uversion, arch, origversion):
 Lines 45-68   class kernel: Link Here 
45
		self.uversion = uversion
44
		self.uversion = uversion
46
		self.arch = arch
45
		self.arch = arch
47
		self.origversion = origversion
46
		self.origversion = origversion
47
48
	def __repr__(self):
48
	def __repr__(self):
49
		return repr((self.kversion, self.uversion, self.arch))
49
		return repr((self.kversion, self.uversion, self.arch))
50
50
51
51
configRegistry=ucr.ConfigRegistry()
52
configRegistry=ucr.ConfigRegistry()
52
configRegistry.load()
53
configRegistry.load()
53
54
54
if 'grub/generate-menu-lst' not in configRegistry or configRegistry.is_false('grub/generate-menu-lst', False):
55
if configRegistry.is_false('grub/generate-menu-lst', True):
55
	sys.exit(0)
56
	sys.exit(0)
56
57
57
if os.path.exists("/boot/grub/menu.lst"):
58
if os.path.exists("/boot/grub/menu.lst"):
58
    f = open("/boot/grub/menu.lst")
59
    for line in open("/boot/grub/menu.lst", "r"):
59
    generated_by_ucs = False
60
        if "auto-generated through univention-grub-generate-menu-lst" in line:
60
61
            break
61
    for i in f.readlines():
62
    else:
62
        if i.find("auto-generated through univention-grub-generate-menu-lst") != -1:
63
            generated_by_ucs = True
64
65
    if not generated_by_ucs:
66
        print "menu.lst already exists. This typically happens if you have updated from UCS 2.4"
63
        print "menu.lst already exists. This typically happens if you have updated from UCS 2.4"
67
        print "and haven't converted from chain loading"
64
        print "and haven't converted from chain loading"
68
        sys.exit(0)
65
        sys.exit(0)
 Lines 74-86   except OSError, e: Link Here 
74
       sys.exit(1)
71
       sys.exit(1)
75
72
76
73
77
lst = []
74
lst = [
78
lst.append("# This Grub configuration is auto-generated through univention-grub-generate-menu-lst.")
75
    "# This Grub configuration is auto-generated through univention-grub-generate-menu-lst.",
79
lst.append("# It is used when booting UCS 3.0 as a Xen DomU with an older version of Pygrub")
76
    "# It is used when booting UCS 3.0 as a Xen DomU with an older version of Pygrub",
80
lst.append(" ")
77
    "",
81
lst.append("default 0")
78
    "default 0",
82
lst.append("timeout 5 ")
79
    "timeout 5 ",
83
lst.append(" ")
80
    "",
81
]
84
82
85
RE_MENUENTRY = re.compile(r"^\s*menuentry '([^']*)' .*")
83
RE_MENUENTRY = re.compile(r"^\s*menuentry '([^']*)' .*")
86
RE_ROOT = re.compile(r"^\s+set\s+root='\(?(hd[0-9]+|/dev/\w+d[a-z]),[a-z]+([0-9]+)\)?'")
84
RE_ROOT = re.compile(r"^\s+set\s+root='\(?(hd[0-9]+|/dev/\w+d[a-z]),[a-z]+([0-9]+)\)?'")
 Lines 88-94   RE_LINUX = re.compile(r"^\s+linux\s+(.+)") Link Here 
88
RE_INITRD = re.compile(r"^\s+initrd\s+(.+)")
86
RE_INITRD = re.compile(r"^\s+initrd\s+(.+)")
89
RE_CLOSE = re.compile(r"^}")
87
RE_CLOSE = re.compile(r"^}")
90
88
91
name = kernel = initrd = None
89
name = root = kernel = initrd = None
92
90
93
for line in grub2:
91
for line in grub2:
94
	m = RE_MENUENTRY.match(line)
92
	m = RE_MENUENTRY.match(line)
 Lines 105-111   for line in grub2: Link Here 
105
			if device.startswith('hd'):
103
			if device.startswith('hd'):
106
				root = "(%s,%d)" % (device, int(part) - 1)
104
				root = "(%s,%d)" % (device, int(part) - 1)
107
			elif device.startswith('/dev/'):
105
			elif device.startswith('/dev/'):
108
				root = "(hd0,%d)" % (int(part) - 1)
106
				root = "(hd0,%d)" % (int(part) - 1,)
109
			else:
107
			else:
110
				print >>sys.stderr, "Unhandled root=%s" % (line,)
108
				print >>sys.stderr, "Unhandled root=%s" % (line,)
111
109
 Lines 127-133   for line in grub2: Link Here 
127
			lst.append("kernel          " + kernel)
125
			lst.append("kernel          " + kernel)
128
			if initrd:
126
			if initrd:
129
				lst.append("initrd          " + initrd)
127
				lst.append("initrd          " + initrd)
130
			lst.append(" ")
128
			lst.append("")
131
		name = root = kernel = initrd = None
129
		name = root = kernel = initrd = None
132
		continue
130
		continue
133
131

Return to bug 39126