#!/bin/sh
#
# Copyright 2006 VMware, Inc.  All rights reserved.
#
# Common VMware ESX Server constants and functions.
#

productName="VMware ESX Server"
buildType=release

vmware_etc_dir=/etc/vmware
vmware_lib_dir=/usr/lib/vmware
vmware_dbg_dir=/usr/lib/vmware-debug
vmkmod_dir=$vmware_lib_dir/vmkmod
modloader=/usr/sbin/vmkload_mod
vmkdump=/usr/sbin/vmkdump
vmkdump_dir=/root
shutdowndir="$vmware_etc_dir/shutdown"
esxconf=$vmware_etc_dir/esx.conf

isDebugMode() {
    grep debug /proc/cmdline > /dev/null
}

# Set up right paths for things when in debug mode.
if isDebugMode ; then
   vmkmod_dir=$vmware_dbg_dir/vmkmod
   modloader=$vmware_dbg_dir/bin/vmkload_mod
   vmkdump=$vmware_dbg_dir/bin/vmkdump
fi

isTSMode() {
   grep tblsht /proc/cmdline > /dev/null
}

isVMnixmodLoaded() {
   [ -e /proc/vmware ] 
}

isVMkernelLoaded() {
   [ -e /proc/vmware/version ] 
}

isStateless() {
   grep -q '/cos/stateless = "1"'  /etc/vmware/esx.conf
}

isFirstRun() {
   ! grep -q '/cos/oneTimeRun = "1"'  $esxconf
}

setFirstRun() {
   echo '/cos/oneTimeRun = "1"' >> $esxconf
}

