On Tue, 08 Feb 2011, 23:43:15 +0100, dev001x wrote:
> hi,
> 
> what's the correct/recommended way to wrap conditional code in opensuse
> init.d scripts to exec on a -xen boot?
> 
> e.g., i need to add some module exec stmts to /etc/init.d/boot.local
> that are specific to kernel-xen, that cause errors/warnings in boot logs
> -- an an occasional hang -- if they are exec'd at boot to a NON-xen
> (e.g., kernel-default) kernel.  so, i want to check for status = {booted
> to kernel-xen}, and exec only if matched.
> 
> should one check for current kernel via uname?  something in /sys/... of
> /proc/... ?

This is what I have in my /etc/init.d/boot.local to disable VMware in
case Linux is booting on a Xen dom0:

  if [ -s /sys/hypervisor/type ]; then
        if [ "$(cat /sys/hypervisor/type)" = "xen" ]; then
                : echo Add stuff for Xen kernels here
                [ -s /etc/init.d/vmware ] &&    \
                insserv -r /etc/init.d/vmware
        fi
  else
        : echo Add non Xen stuff here
        [ -s /etc/init.d/vmware ] &&    \
        mount /proc/bus/usb
  fi

> i understand there are many possible checks; the question is - which, if
> any, is the 'right' one in this case?
> 
> thanks.

HTH, cheers.

l8er
manfred
-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to