home *** CD-ROM | disk | FTP | other *** search
/ ftp.jcu.edu.au / 2014.06.ftp.jcu.edu.au.tar / ftp.jcu.edu.au / v6.3.2b / SWBD63 / fabos-6.3.2b-10.ppc.rpm / fabos-6.3.2b.10.cpio.gz / fabos-6.3.2b.10.cpio / fabos / libexec / fastbootenv < prev    next >
Text File  |  2010-11-10  |  2KB  |  97 lines

  1. #!/bin/sh
  2. #
  3. #    Copyright (c) 2003-2005 Brocade Communications Systems, Inc.
  4. #    All rights reserved.
  5. #
  6. #    Set (and reset) env for faster boot
  7. #
  8.  
  9. PATH=/sbin:/bin:/usr/sbin:/usr/bin:/fabos/sbin:/fabos/bin
  10.  
  11. #
  12. # main
  13. #
  14. case "$1" in
  15.  
  16. 'fast')
  17.  
  18.     cur=`bootenv BootTest 2>/dev/null`
  19.     if [ ! -z "${cur}" ] ; then
  20.         # Save previous setting so we can restore later.
  21.         /sbin/bootenv FastBootTest "${cur}" > /dev/null 2>&1
  22.             # Then delete.
  23.         /sbin/bootenv -u BootTest > /dev/null 2>&1
  24.     fi
  25.     cur=`bootenv InitTest 2>/dev/null`
  26.     if [ ! -z "${cur}" ] ; then
  27.         # Save previous setting so we can restore later.
  28.         /sbin/bootenv FastInitTest "${cur}" > /dev/null 2>&1
  29.         /sbin/bootenv -u InitTest > /dev/null 2>&1
  30.     fi
  31.     al=`bootenv AutoLoadTimeout 2>/dev/null`
  32.     if [ $? != 0 -o X${al} != X0 ]; then
  33.         /sbin/bootenv AutoLoadTimeout 0
  34.     fi
  35.  
  36.     # quiet added to OSLoadOptions in kernel.spec.in. and here too
  37.     OPT="$(echo $(cat /boot/extra_boot_opts 2>/dev/null) quiet)"
  38.     bootenv OSLoadOptions "$OPT;$OPT"
  39.  
  40.     ;;
  41.  
  42. 'regular')
  43.  
  44.     # restore saved InitTest setting.
  45.     cur=`bootenv FastInitTest 2>/dev/null`
  46.     if [ -z "${cur}" ] ; then
  47.         nv="MEM()"
  48.     else
  49.         nv=${cur}
  50.     fi
  51.     it=`bootenv InitTest 2>/dev/null`
  52.     if { [ $? != 0 ]  || [ -z "${it}" ] ; }
  53.     then
  54.         /sbin/bootenv InitTest "${nv}"
  55.     fi
  56.  
  57.     # Wipe setting after InitTest is restored.
  58.     if [ ! -z "${cur}" ] ; then
  59.         /sbin/bootenv -u FastInitTest > /dev/null 2>&1
  60.     fi
  61.  
  62.     # restore saved BootTest setting.
  63.     cur=`bootenv FastBootTest 2>/dev/null`
  64.     # No default
  65.     if [ ! -z "${cur}" ] ; then
  66.         it=`bootenv BootTest 2>/dev/null`
  67.         if { [ $? != 0 ]  || [ -z "${it}" ] ; }
  68.         then
  69.             /sbin/bootenv BootTest "${cur}"
  70.         fi
  71.  
  72.         # Wipe setting after InitTest is restored.
  73.         /sbin/bootenv -u FastBootTest > /dev/null 2>&1
  74.     fi
  75.  
  76.     # Do not enable PROM if FIPS requires it
  77.     fips=$(cat /etc/fabos/pwron_fips_status 2>/dev/null)
  78.     if [ -z "$fips" -o "$fips" = "0" ] ; then
  79.         if bootenv AutoLoadTimeout >/dev/null 2>&1; then
  80.             /sbin/bootenv -u AutoLoadTimeout > /dev/null 2>&1
  81.         fi
  82.     fi
  83.  
  84.     if [ ! -e /etc/fabos/lo/persistent ]
  85.     then
  86.         rm -f /var/log/fsslo.data
  87.     fi
  88.  
  89.     ;;
  90.  
  91. *)
  92.     echo "Usage: $0 {fast | regular}"
  93.  
  94.     ;;
  95.  
  96. esac
  97.