[kernel-xen] kernel-xen-3.9.7-1 packages available - TESTERS REQUIRED!

Steven Haigh netwiz at crc.id.au
Wed Jun 26 13:51:03 EST 2013

On 26/06/2013 1:28 PM, Adi Pircalabu wrote:
> Steve,
> Unfortunately I haven't followed the thread in much detail and I haven't
> been able to test the new packages so I'm just making plain assumptions
> here:
> Looking at kernel & kernel-xen postinstall scripts I found that
> /sbin/new-kernel-pkg, which is part of grubby package, is used to
> install/remove kernels from the system. It's a shell script and in there
> the packager uses "grubConfig=$(readlink -f /etc/grub.conf 2>/dev/null)"
> for the path to the actual /boot/grub/grub.conf file. Is this perhaps
> something you're looking at replicating in the upcoming kernel-xen
> packages? It makes sense to me to first test for the existence of
> /etc/grub.conf as a symlink to /boot/grub/grub.conf, then decide what to
> do based on the returned value:
> 1. symlink correct -> do this
> 2. symlink points to somewhere else -> do that
> 3. symlink missing -> use hardcoded /boot/grub/grub.conf for backwards
> compatibility
> Something along these lines.

You know what, this is probably the best way to do it. In theory, the 
following should exist on all systems:
/etc/grub.conf -> /boot/grub/grub.conf
/boot/grub/menu.lst -> ./grub.conf
/boot/grub/grub.conf (the actual config file).

This makes me think I should use something like:
GRUB_CONF=$(readlink -f /etc/grub.conf 2>/dev/null)
if [ -z $GRUB_CONF ]; then
	if [ -f "/boot/grub/grub.conf" ]; then
		echo "No valid grub.conf found. You'll need to fix this manually!"
	#### Do the actual work here.

Logically, this means:
1) Check where /etc/grub.conf links to, then use that.
2) If we can't figure out where the symlink goes or it doesn't exist, 
see if /boot/grub/grub.conf exists, if so, use it.
3) If we can't figure out the symlink, nor find a /boot/grub/grub.conf, 
print an error and give up.

This way, if we find a major issue and can't locate the grub config, we 
at least print a message instead of silently failing.


Steven Haigh

Email: netwiz at crc.id.au
Web: https://www.crc.id.au
Phone: (03) 9001 6090 - 0412 935 897
Fax: (03) 8338 0299

More information about the kernel-xen mailing list