Environment: CentOS 5.5 and 6.4I have a request to analyze the hardware before installation to make sure our customers don't install our software on sub-standard server hardware.  For example, examining memory, disk space, CPU, network card...   So, the %pre section in my ks.cfg file seems like the perfect place to do this??? But, I can't get a command like free to work.... I would like to find out what commands are available in the %pre section and is this the right place to perform hardware analysis before the installation begins???.. If the %pre section of ks.cfg is NOT a good place to do this, then where??  Here is what I've tried so far and I get NO output:ks.cfg:%pre  (echo Analyzing Hardware...) >/dev/tty1  free >/dev/tty1  free_txt=`free -o`  (echo $free_txt) >/dev/tty1%endI see 'Analyzing Hardware...' on the screen during the first part of the install but nothing after that.....
What commands are available in the %pre section of a Kickstart file on CentOS?
linux;centos;kickstart
After digging a bit more, I found a ton of system info in /proc that is available forviewing when the %pre section in ks.cfg executes.  Checkout dmidecode and files in /proc to get all the information you need.  Here is what worked for me:%pre --log=/tmp/ks_pre.log  #!/bin/sh  #----------------------------------------------  # echos message to console screen and a log file  #----------------------------------------------  echo_screen_n_log() {    msg=$1    # Send to console screen    (echo $msg) >/dev/tty1    # Send to log    echo $msg  }  echo_screen_n_log   echo_screen_n_log Analyzing Hardware...  echo_screen_n_log   #----------------------------------------------  # System Memory  #----------------------------------------------  IFS=$'\n'  mem_info=(`dmidecode --type memory`)  unset IFS  sys_mem_sizes=  sys_mem_banks=  sys_tot_mem=0  cntr=0  bank_cntr=0  for i in ${mem_info[@]}  do    # echo_screen_n_log i: $i    # Maximum system memory that can be placed on the motherboard    REG_EX=Maximum Capacity: (.*)$    if [[ $i =~ $REG_EX ]]    then      sys_mem_max=${BASH_REMATCH[1]}     fi    # How many memory slots are on the motherboard    REG_EX=Number Of Devices: (.*)$    if [[ $i =~ $REG_EX ]]    then      sys_mem_slots=${BASH_REMATCH[1]}     fi    REG_EX=^[[:space:]]+Size: (.*)$    if [[ $i =~ $REG_EX ]]    then      sys_mem_sizes[cntr]=${BASH_REMATCH[1]}      cntr=$(( $cntr + 1 ))    fi    REG_EX=^[[:space:]]+Bank Locator: (.*)$    if [[ $i =~ $REG_EX ]]    then      sys_mem_banks[bank_cntr]=${BASH_REMATCH[1]}      bank_cntr=$(( $bank_cntr + 1 ))    fi     done  cntr=$(( $cntr - 1 ))  echo_screen_n_log Max system memory: $sys_mem_max  echo_screen_n_log Total system slots: $sys_mem_slots  i=0  while [ $i -le $cntr ]  do    echo_screen_n_log Memory Bank Location ${sys_mem_banks[$i]} : ${sys_mem_sizes[$i]}    REG_EX=No Module Installed$    if [[ ! ${sys_mem_sizes[$i]} =~ $REG_EX ]]    then      REG_EX=^([0-9]+) [A-Z][A-Z]$      if [[ ${sys_mem_sizes[$i]} =~ $REG_EX ]]      then    sys_tot_mem=$(( $sys_tot_mem + ${BASH_REMATCH[1]} ))      fi    fi    i=$(( $i + 1 ))  done  echo_screen_n_log System Total Memory: $sys_tot_mem MB  #--------------------------------------------  # Get Disk size information  #--------------------------------------------  IFS=$'\n'  disk_info=(`cat /proc/partitions`)  unset IFS  total_disk_space=0  type=  # Grab from minor column starting with 0 ending in 3 letters (drive node)   REG_EX=0\s+([0-9]+) [a-z][a-z][a-z]$  for i in ${disk_info[@]}  do    # echo_screen_n_log i: $i    if [[ $i =~ $REG_EX ]]    then      total_disk_space=${BASH_REMATCH[1]}      total_disk_space=$(( $total_disk_space * 1024 ))      type=GB      div_num=1000000000      if [ $total_disk_space -lt $div_num ]      then        type=MB        div_num=1000000      fi      total_disk_space=$(( $total_disk_space / $div_num ))    fi  done  echo_screen_n_log Disk Space: $total_disk_space $type  #-----------------------------------------------------  # Get CPU model name  #-----------------------------------------------------  cpu_grep=`grep 'model name' /proc/cpuinfo`  cpu_model_nm=Not Found!  REG_EX=^.*: (.*)$  if [[ $cpu_grep =~ $REG_EX ]]  then    cpu_model_nm=${BASH_REMATCH[1]}  fi  echo_screen_n_log CPU Model: $cpu_model_nm  #-------------------------------------------------------  # Get number of physical CPUs  #-------------------------------------------------------  IFS=$'\n'  cpu_count=(`grep physical id /proc/cpuinfo`)  unset IFS  last_cpu_id=  total_cpu_cnt=0  # Add up all cores of the CPU to get total MIPS  total_cpus=0  REG_EX=^physical id\s+: ([0-9]+)$  for i in ${cpu_count[@]}  do    # echo_screen_n_log i: $i    if [[ $i =~ $REG_EX ]]    then  cpu_id=${BASH_REMATCH[1]}      if [ ! $last_cpu_id = $cpu_id ]      then    total_cpu_cnt=$(( $total_cpu_cnt + 1 ))    last_cpu_id=$cpu_id  fi    fi  done  echo_screen_n_log System physical CPUs: $total_cpu_cnt  #-------------------------------------------------------  # Get number of CPU cores  #-------------------------------------------------------  IFS=$'\n'  cpu_cores=(`grep -m 1 cpu cores /proc/cpuinfo`)  unset IFS  total_cpu_cores=0  REG_EX=^cpu cores\s+: ([0-9]+)$  for i in ${cpu_cores[@]}  do    # echo_screen_n_log i: $i    if [[ $i =~ $REG_EX ]]    then  total_cpu_cores=${BASH_REMATCH[1]}    fi  done  echo_screen_n_log CPU cores: $total_cpu_cores  #-------------------------------------------------------  # CPU MHz  #-------------------------------------------------------  IFS=$'\n'  dmi_cpu_MHz=(`dmidecode --string processor-frequency`)  unset IFS  cpu_MHz=0  REG_EX=^[0-9]+   for i in ${dmi_cpu_MHz[@]}  do    # echo_screen_n_log i: $i    if [[ $i =~ $REG_EX ]]    then  cpu_MHz=${BASH_REMATCH[1]}    fi  done  echo_screen_n_log CPU MHz: ${dmi_cpu_MHz:0:1}.${dmi_cpu_MHz:1:$(( ${#dmi_cpu_MHz} - 1 ))}  #-------------------------------------------------------  # Get CPU bogomips (Millions of instructions per second)  #-------------------------------------------------------  IFS=$'\n'  cpu_mips=(`grep bogomips /proc/cpuinfo`)  unset IFS  # Add up all cores of the CPU to get total MIPS  total_mips=0  REG_EX=\s([0-9]+)\..*$  for i in ${cpu_mips[@]}  do    # echo_screen_n_log i: $i    if [[ $i =~ $REG_EX ]]    then  cpu_bogomips=${BASH_REMATCH[1]}      total_mips=$(( $total_mips + $cpu_bogomips ))    fi  done  echo_screen_n_log Total CPU MIPS (Millions of instructions per second) : $total_mips  echo_screen_n_log   (echo -n Press <enter> to continue..) >/dev/tty1  read text%endI just need to add the criteria for determining what a base system for our installations should look like and I'm done.....Updated this with more information...You can also do the following for disk info in the %pre section:IFS=$'\n'parted_txt=(`parted -l`)unset IFSfor i in ${parted_txt[@]}do#    (echo i: \$i\) >/dev/tty1  REG_EX=^Model: (.*)$  if [[ $i =~ $REG_EX ]]  then    disk_model=${BASH_REMATCH[1]}#      (echo Disk Model: \$disk_model\) >/dev/tty1  fi  REG_EX=^Disk (.*): ([0-9]+).[0-9]([A-Z][A-Z])$  if [[ $i =~ $REG_EX ]]  then    disk_device=${BASH_REMATCH[1]}    disk_capacity=${BASH_REMATCH[2]}    disk_capacity_type=${BASH_REMATCH[3]}    (echo Device: \$disk_device\  \$disk_capacity\  $disk_capacity_type) >/dev/tty1    IFS=$'\n'    disk_txt=(`udevadm info --query=all --name=$disk_device`)    unset IFS     is_USB_drive=0    for j in ${disk_txt[@]}    do      #(echo j: \$j\) >/dev/tty1   REG_EX=^ID_BUS=usb$   if [[ $j =~ $REG_EX ]]       then     # USB keys are not to be included in total disk space       #       (echo $disk_device is a USB drive!) >/dev/tty1        is_USB_drive=1   fi    done    if [ $is_USB_drive = 0 ]    then   total_capacity=$(( $total_capacity + $disk_capacity ))    fi  fidone(echo Disk Model: $disk_model) >/dev/tty1(echo Disk $disk_device Capacity: $total_capacity $disk_capacity_type) >/dev/tty1