32 lines
		
	
	
		
			973 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			973 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
| #!/bin/bash
 | |
| 
 | |
| # This script should echo only the name of the profile that should be used
 | |
| # It should assume it is called before any other scripts. In particular, it
 | |
| # cannot rely on environment variables set in /etc/profile or elsewhere. The
 | |
| # script may assume it will be run as root.
 | |
| 
 | |
| # To determine the boot profile, first check whether a profile has been
 | |
| # explicitly set on the kernel command line. If not, use VMWare's checkvm
 | |
| # tool to find out whether we are in VMWare or Dualboot mode.
 | |
| 
 | |
| cmdline_option="hprofile"
 | |
| cmdline="/proc/cmdline"
 | |
| 
 | |
| profile=""
 | |
| 
 | |
| # Check kernel command line (lilo append line) for an "hprofile=" option
 | |
| if grep -i "${cmdline_option}=" "${cmdline}" >/dev/null 2>&1 ; then
 | |
|   profile=$(cat "${cmdline}" | 
 | |
| 							sed "s/^.*${cmdline_option}=\([^[:space:]]*\).*$/\1/")
 | |
| else
 | |
| 	if test -x /usr/sbin/vmware-checkvm ; then
 | |
| 		if /usr/sbin/vmware-checkvm >/dev/null 2>&1 ; then
 | |
| 			profile="vmware"
 | |
| 		else
 | |
| 			profile="dualboot"
 | |
| 		fi
 | |
| 	fi
 | |
| fi
 | |
| 
 | |
| echo ${profile}
 |