#!/bin/ksh #============================================================================== # $Id: sysconfig,v 1.1 1998/12/01 08:42:23 peters Exp $ # # NAME: sysconfig # DESCRIPTION: Shows a summary of useful configuration information on # Solaris systems. # DATE: 2 Dec 1998 # AUTHOR: Peter Sundstrom (peters@ginini.com.au) # SOURCE: http://www.ginini.com.au/tools/sysconfig # #============================================================================== USAGE="Usage: `basename $0` [-Ddgkhnpst]" SCRIPT=`basename $0` # Shortname of this script RELEASE=`uname -r` # OS Release PLATFORM=`uname -s` # Machine platform #------------------------------------------------------------------------------ function help { cat </dev/null |grep "[0-9]\."|sed "s/^ *//"` echo "$disks" } #------------------------------------------------------------------------------ function Disk_partitions { [ "$DEBUG" = TRUE ] && set -x echo "\n\n" echo "==========Disk Partitions======================================================\n" disks=`echo "0\nq"|format 2>/dev/null |grep "[0-9]\."|sed "s/^ *//"` for disk in `echo "$disks" | awk '{print $2}'` do echo "\nDisk $disk" echo "--------------" prtvtoc -s /dev/rdsk/${disk}s2 done } #------------------------------------------------------------------------------ function Installed_packages { [ "$DEBUG" = TRUE ] && set -x echo "\n\n" echo "==========Installed Packages====================================================\n" pkginfo } #------------------------------------------------------------------------------ function Installed_patches { [ "$DEBUG" = TRUE ] && set -x echo "\n\n" echo "==========Installed Patches=====================================================\n" showrev -p } #------------------------------------------------------------------------------ # END OF FUNCTIONS #============================================================================== # # Some functions need root access # if [ `id|sed -e "s/uid=//" -e "s/(.*//"` != 0 ] then echo "$SCRIPT needs to be run as root" >&2 exit 1 fi # # Check to see what platform we are running on. # if [ $PLATFORM != SunOS ] then echo "$SCRIPT can only run on Sun systems" >&2 exit 1 fi # # Check to see if we are on Solaris 2.5 (SunOS 5.5) or higher # if echo $RELEASE | grep 5.[5-9] >/dev/null 2>&1 then : # OS level is OK else echo "$SCRIPT needs to be run on Solaris version 2.5 and higher" >&2 exit 1 fi # # Set an appropriate path # export PATH=/usr/bin:/usr/sbin # # If no parameters are supplied, set flag to indicate to display # all information. # [ $# -eq 0 ] && ALL=TRUE while getopts :Ddghknpst opt do case $opt in D) DEBUG=TRUE set -x ;; d) Disks ;; h) help ;; g) General_info ;; k) Installed_packages ;; n) Network_interfaces ;; p) Disk_partitions ;; s) Swap_space ;; t) Installed_patches ;; ?) echo "$USAGE" >&2 exit 1 ;; esac done # # Exit if flags have been specified # [ "$ALL" = TRUE ] || exit 0 # # By default, display all information # General_info Swap_space Network_interfaces Disks Disk_partitions Installed_packages Installed_patches