add check for /proc/xen in vmware-detection
[grml-autoconfig.git] / autoconfig.functions
index d2a0656..5e0c39e 100755 (executable)
@@ -4,7 +4,7 @@
 # Authors:       grml-team (grml.org), (c) Klaus Knopper <knopper@knopper.net>, (c) Michael Prokop <mika@grml.org>
 # Bug-Reports:   see http://grml.org/bugs/
 # License:       This file is licensed under the GPL v2.
-# Latest change: Mon Nov 27 21:02:23 CET 2006 [mika]
+# Latest change: Mon Feb 05 12:37:33 CET 2007 [mika]
 ################################################################################
 
 # {{{ path, variables, signals, umask, zsh
@@ -357,7 +357,20 @@ config_time(){
 # {{{ print kernel info
 config_kernel(){
   vmware-detect &>/dev/null && VMWARE="inside ${WHITE}VMWare${NORMAL}"
+  [ -d /proc/xen ] && VMWARE='' # vmware-detect returns '0' when running with a Xen-enabled kernel
   einfo "Running Linux Kernel $KERNEL $VMWARE" ; eend 0
+  if [ -r /proc/cpuinfo ] ; then
+     if egrep -q '^flags.*(vmx|svm)' /proc/cpuinfo ; then
+       eindent
+       einfo 'CPU(s) featuring virtualization technology detected' ; eend 0
+       eoutdent
+     fi
+  fi
+  if [ -d /proc/xen ] ; then
+     eindent
+     einfo 'Running kernel featuring support for Xen detected' ; eend 0
+     eoutdent
+  fi
 }
 # }}}
 
@@ -1607,9 +1620,20 @@ if checkbootparam startx ; then
 sudo -u $fstabuser -i /usr/bin/grml-x $WINDOWMANAGER 1>>$DEBUG
 EOF
    chmod 755 /etc/init.d/xstartup
-   sed -i 's/^allowed_users=.*/allowed_users=anybody/' /etc/X11/Xwrapper.config
-   sed -i 's#^6.*#6:2345:respawn:/bin/zsh --login -c "/etc/init.d/xstartup ; /bin/zsh"#'   /etc/inittab
+
+   if grep -q xstartup /etc/inittab ; then
+        sed -i 's#^6.*#6:2345:respawn:/bin/zsh --login -c "/etc/init.d/xstartup ; /bin/zsh"#'   /etc/inittab
+   else
+        echo '6:2345:respawn:/bin/zsh --login -c "/etc/init.d/xstartup ; /bin/zsh"' >> /etc/inittab
+   fi
    /sbin/telinit q ; eend $?
+
+   if grep -q '^allowed_users=' /etc/X11/Xwrapper.config ; then
+      sed -i 's/^allowed_users=.*/allowed_users=anybody/' /etc/X11/Xwrapper.config
+   else
+      echo 'allowed_users=anybody' >> /etc/X11/Xwrapper.config
+   fi
+
   else
     eerror "We are not running from CD - startx will not work, skipping it.
      Please use something like xdm, gdm or kdm for starting X on a harddisk system!" ; eend 1