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

Steven Haigh netwiz at crc.id.au
Thu Jun 27 10:44:45 EST 2013

On 26/06/2013 2:57 PM, Adi Pircalabu wrote:
> On 26-06-2013 13:51 PM, Steven Haigh wrote:
>> 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
>>     GRUB_CONF="/boot/grub/grub.conf"
> Problem here, $GRUB_CONF link can point to any other file, you don't
> test the value but you then test if /boot/grub/grub.conf exists and use
> it. In this case the symlink test is useless.

Not quite. The -z operator will check for a zero length string. As the 
docs state:

-z string
     True if the length of string is zero.

This would mean that if readlink returns a zero length string (which 
should be if it can't find the symlink) it will then check for the file 
/boot/grub/grub.conf. If it finds that, it will continue - otherwise it 
will print an error and not try any further.

>> 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.
> I really don't know what's supposed to happen in the future with
> /etc/grub.conf and /boot/grub/grub.conf. At the moment the only
> certainty is the existence of /boot/grub/grub.conf on all recent RedHat
> versions to date, so maybe it's not a bad idea to just use
> /boot/grub/grub.conf and forget about /etc/grub.conf. If you want to use
> /etc/grub.conf you'll have to add additional logic to deal with states
> like:
> Is /etc/grub.conf pointing to /boot/grub/grub.conf?
>    If 'yes' use it
>    Else
>      Is the target a valid grub configuration file? How to validate it
> and confirm that it's actually used by grub?
> ... and so on

This is why I thought about the failover in case /etc/grub.conf doesn't 
exist. I can only go on my systems (which are all Scientific Linux 
based) - but I have no guarantee that this will be the same between 
distros - even though it probably should.

I think it would be almost (almost!) impossible to validate that 
grub.conf is bootable. We do use new-kernel-pkg to create the grub 
stanza - which *should* create bootable stanza in all cases. If not, 
something else is quite broken and is probably beyond what we can sanely 
attempt to fix.

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