Changes to Discovery commands
The following sections show the discovery command changes between BMC Discovery versions.
The following changes are not shown:
- Entirely new discovery platforms
- Changes to comments only
- Commands which have been removed and not replaced
- Changes to echo only statements
Discovery command changes from 20.08 to 21.05
Click here to expand...
Solaris
getFileContent
The following code:
else
PRIV_CAT "${P}"
fi
fi
is replaced with:
else
PRIV_CAT "${P}"
ch=`PRIV_CAT "${P}" | tail -1c`
if [ -z "`echo "${ch}" | tr -d '\n'`" ]; then
echo
fi
fi
fi
getProcessList
The following code:
else
/usr/bin/ps -eo pid,ppid,uid,user,args 2>/dev/null
fi
if [ $os_ver -ge 11 ]; then
PRIV_PS /usr/bin/ps axww 2>/dev/null
else
if [ -x /usr/ucb/ps ]; then
PRIV_PS /usr/ucb/ps -axww 2>/dev/null
fi
fi
if [ -x /usr/bin/pargs -a -d /proc ]; then
echo begin pargs:
PRIV_PARGS /usr/bin/pargs `ls -1 /proc` 2>/dev/null
echo end pargs:
is replaced with:
/usr/bin/ps -eo pid,ppid,uid,user,args 2>/dev/null
fi
RUN_PARGS=1
if [ $os_ver -ge 11 ]; then
PRIV_PS /usr/bin/ps axww 2>/dev/null
if [ $os_ver -eq 11 ]; then
os_rev=`pkg list entire | cut -d. -f5 | grep [0-9]+`
if [ $os_rev -gt 3 ]; then
RUN_PARGS=0
elif [ $os_rev -eq 3 ]; then
os_sru_major=`pkg list entire | cut -d. -f6 | grep [0-9]+`
os_sru_minor=`pkg list entire | cut -d. -f7 | grep [0-9]+`
if [ $os_sru_major -gt 5 -o $os_sru_major -eq 5 -a $os_sru_minor -ge 6 ]; then
RUN_PARGS=0
fi
fi
else
RUN_PARGS=0
fi
else
if [ -x /usr/ucb/ps ]; then
PRIV_PS /usr/ucb/ps -axww 2>/dev/null
fi
fi
if [ $RUN_PARGS -eq 1 -a `id | cut -d '=' -f2 | cut -d '(' -f1` -ne 0 -a -x /usr/bin/pargs -a -d /proc ]; then
echo begin pargs:
PRIV_PARGS /usr/bin/pargs `ls -1 /proc` 2>/dev/null
echo end pargs:
IRIX
getFileContent
The following code:
PRIV_TEST -f "${P}" -a -r "${P}"
if [ $? -eq 0 ]; then
echo "begin content:"
PRIV_CAT "${P}" | sed -e 's/[^[:print:][:blank:]]//g'
fi
is replaced with:
if [ $? -eq 0 ]; then
echo "begin content:"
PRIV_CAT "${P}" | sed -e 's/[^[:print:][:blank:]]//g;$a\'
fi
VMware ESX
getDeviceInfo
The following code:
os=""
# VMware appliances
if [ "$os" = "" ]; then
type=`cat /etc/vmware/deployment.node.type 2> /dev/null`
# VMware vCenter Server Appliance
version=`rpm -q --queryformat "%{VERSION} ${type} build %{RELEASE}" VMware-vpxd 2>/dev/null | grep -v VMware-vpxd`
if [ "$version" = "" ]; then
# VMware Platform Service Controller
version=`rpm -q --queryformat "%{VERSION} ${type} build %{RELEASE}" psc_client 2>/dev/null | grep -v psc_client`
fi
if [ "$version" != "" ]; then
os="VMware vCenter Server Appliance $version"
fi
fi
# SuSE lsb_release does not provide service pack so prefer SuSE-release file
# However, this file is being deprecated so we will fallback to os-release
is replaced with:
# VMware appliances
if [ "$os" = "" ]; then
type=`cat /etc/vmware/deployment.node.type 2> /dev/null`
# VMware vCenter Server Appliance
version=`rpm -q --queryformat "%{VERSION} ${type} build %{RELEASE}" VMware-vpxd 2>/dev/null | grep build`
if [ "$version" = "" ]; then
# VMware Platform Service Controller
version=`rpm -q --queryformat "%{VERSION} ${type} build %{RELEASE}" psc_client 2>/dev/null | grep build`
fi
if [ "$version" != "" ]; then
os="VMware vCenter Server Appliance $version"
fi
fi
# SuSE lsb_release does not provide service pack so prefer SuSE-release file
# However, this file is being deprecated so we will fallback to os-release
The following code:
if [ "$os_id" = "" ]; then
os_id=`egrep ^ID= /etc/os-release | cut -f2 -d=`
fi
if [ "$os_id" = "sles" -o "$os_id" = "opensuse" -o "$os_id" = "coreos" ]; then
os=`egrep ^PRETTY_NAME /etc/os-release | cut -f2 '-d"'`
fi
fi
is replaced with:
os_id=`egrep ^ID= /etc/os-release | cut -f2 -d=`
fi
if [ "$os_id" = "sles" -o "$os_id" = "opensuse" -o "$os_id" = "sle_hpc" -o "$os_id" = "coreos" ]; then
os=`egrep ^PRETTY_NAME /etc/os-release | cut -f2 '-d"'`
fi
fi
getFileContent
The following code:
PRIV_TEST -f "${P}" -a -r "${P}"
if [ $? -eq 0 ]; then
echo "begin content:"
PRIV_CAT "${P}" | sed -e 's/[^[:print:][:blank:]]//g'
fi
is replaced with:
if [ $? -eq 0 ]; then
echo "begin content:"
PRIV_CAT "${P}" | sed -e 's/[^[:print:][:blank:]]//g;$a\'
fi
getHostInfo
The following code:
# [https://github.com/mirror/dmidecode/blob/master/dmidecode.c, dmi_print_memory_size()]
# ('KB' stays in to support older versions)
if [ -f /usr/sbin/dmidecode ]; then
dmidecode_ram=`PRIV_DMIDECODE /usr/sbin/dmidecode 2>/dev/null | sed -n '/DMI type 17,/,/^Handle 0x0/p' | awk '
BEGIN {
powers["bytes"] = -1
powers["kB"] = 0 # kilobytes
is replaced with:
# ('KB' stays in to support older versions)
if [ -f /usr/sbin/dmidecode ]; then
BEGIN {
powers["bytes"] = -1
powers["kB"] = 0 # kilobytes
The following code:
powers["EB"] = 5 # Exabytes
powers["ZB"] = 6 # Zetabytes
}
/Size: ([0-9]+) bytes|([kKMGTPEZ]B)/ {
size += int($2 * (1024 ^ powers[$3]))
}
END {
is replaced with:
powers["ZB"] = 6 # Zetabytes
}
/DMI type 17,/ { keep = 1; next }
/^Handle 0x/ { keep = 0 }
keep && /Size: ([0-9]+) (bytes|([kKMGTPEZ]B))/ {
size += int($2 * (1024 ^ powers[$3]))
}
END {
getHBAList
The following code:
# some files are ignored as they do not have read permissions,
# and does not contain relevant data either.
ignore_files=( "issue_lip" "vport_create" "vport_delete" "host_reset"
"scan" "trace" "lpfc_xlane_lun" "lpfc_xlane_lun_status"
"issue_reset" "ctlreg" "lpfc_aer_state_cleanup"
"lpfc_drvr_stat_data" "lpfc_soft_wwn_enable"
)
device_path_fc="/sys/class/fc_host/$device/"
# Resolve symlink as we need to identify source device path.
device_class_path_fc=`readlink -f $device_path_fc`
is replaced with:
# and does not contain relevant data either.
ignore_files="\
issue_lip vport_create vport_delete host_reset scan trace lpfc_xlane_lun\
lpfc_xlane_lun_status issue_reset ctlreg lpfc_aer_state_cleanup\
lpfc_drvr_stat_data lpfc_soft_wwn_enable "
device_path_fc="/sys/class/fc_host/$device/"
# Resolve symlink as we need to identify source device path.
device_class_path_fc=`readlink -f $device_path_fc`
The following code:
do
if [ ! -d $device_path_fc$f ] && [[ ! " ${ignore_files[@]} " =~ " ${f} " ]]; then
echo -e "\t$f =" \"`cat $device_path_fc$f 2>/dev/null`\"
fi
done
is replaced with:
do
word=" $f "
if [ ! -d $device_path_fc$f ] && [ "${ignore_files#*$word}" != "$ignore_files" ]; then
echo -e "\t$f =" \"`cat $device_path_fc$f 2>/dev/null`\"
fi
done
FreeBSD
getFileContent
The following code:
PRIV_TEST -f "${P}" -a -r "${P}"
if [ $? -eq 0 ]; then
echo "begin content:"
PRIV_CAT "${P}" | sed -e 's/[^[:print:][:blank:]]//g'
fi
is replaced with:
if [ $? -eq 0 ]; then
echo "begin content:"
PRIV_CAT "${P}" | sed -e 's/[^[:print:][:blank:]]//g;$a\'
fi
AIX
getFileContent
The following code:
PRIV_TEST -f "${P}" -a -r "${P}"
if [ $? -eq 0 ]; then
echo "begin content:"
PRIV_CAT "${P}" | sed -e 's/[^[:print:][:blank:]]//g'
fi
is replaced with:
if [ $? -eq 0 ]; then
echo "begin content:"
PRIV_CAT "${P}" | sed -e 's/[^[:print:][:blank:]]//g;$a\'
fi
Tru64:
getFileContent
The following code:
PRIV_TEST -f "${P}" -a -r "${P}"
if [ $? -eq 0 ]; then
echo "begin content:"
PRIV_CAT "${P}" | sed -e 's/[^[:print:][:blank:]]//g'
fi
is replaced with:
if [ $? -eq 0 ]; then
echo "begin content:"
PRIV_CAT "${P}" | sed -e 's/[^[:print:][:blank:]]//g;$a\'
fi
OpenBSD
The following code:
PRIV_TEST -f "${P}" -a -r "${P}"
if [ $? -eq 0 ]; then
echo "begin content:"
PRIV_CAT "${P}" | sed -e 's/[^[:print:][:blank:]]//g'
fi
is replaced with:
if [ $? -eq 0 ]; then
echo "begin content:"
PRIV_CAT "${P}" | sed -e 's/[^[:print:][:blank:]]//g;$a\'
fi
Linux
getDeviceInfo
The following code:
os=""
# VMware appliances
if [ "$os" = "" ]; then
type=`cat /etc/vmware/deployment.node.type 2> /dev/null`
# VMware vCenter Server Appliance
version=`rpm -q --queryformat "%{VERSION} ${type} build %{RELEASE}" VMware-vpxd 2>/dev/null | grep -v VMware-vpxd`
if [ "$version" = "" ]; then
# VMware Platform Service Controller
version=`rpm -q --queryformat "%{VERSION} ${type} build %{RELEASE}" psc_client 2>/dev/null | grep -v psc_client`
fi
if [ "$version" != "" ]; then
os="VMware vCenter Server Appliance $version"
fi
fi
# SuSE lsb_release does not provide service pack so prefer SuSE-release file
# However, this file is being deprecated so we will fallback to os-release
is replaced with:
# VMware appliances
if [ "$os" = "" ]; then
type=`cat /etc/vmware/deployment.node.type 2> /dev/null`
# VMware vCenter Server Appliance
version=`rpm -q --queryformat "%{VERSION} ${type} build %{RELEASE}" VMware-vpxd 2>/dev/null | grep build`
if [ "$version" = "" ]; then
# VMware Platform Service Controller
version=`rpm -q --queryformat "%{VERSION} ${type} build %{RELEASE}" psc_client 2>/dev/null | grep build`
fi
if [ "$version" != "" ]; then
os="VMware vCenter Server Appliance $version"
fi
fi
# SuSE lsb_release does not provide service pack so prefer SuSE-release file
# However, this file is being deprecated so we will fallback to os-release
The following code:
if [ "$os_id" = "" ]; then
os_id=`egrep ^ID= /etc/os-release | cut -f2 -d=`
fi
if [ "$os_id" = "sles" -o "$os_id" = "opensuse" -o "$os_id" = "coreos" ]; then
os=`egrep ^PRETTY_NAME /etc/os-release | cut -f2 '-d"'`
fi
fi
is replaced with:
os_id=`egrep ^ID= /etc/os-release | cut -f2 -d=`
fi
if [ "$os_id" = "sles" -o "$os_id" = "opensuse" -o "$os_id" = "sle_hpc" -o "$os_id" = "coreos" ]; then
os=`egrep ^PRETTY_NAME /etc/os-release | cut -f2 '-d"'`
fi
fi
------------------------------------------------------------------------------
getFileContent
The following code:
PRIV_TEST -f "${P}" -a -r "${P}"
if [ $? -eq 0 ]; then
echo "begin content:"
PRIV_CAT "${P}" | sed -e 's/[^[:print:][:blank:]]//g'
fi
is replaced with:
if [ $? -eq 0 ]; then
echo "begin content:"
PRIV_CAT "${P}" | sed -e 's/[^[:print:][:blank:]]//g;$a\'
fi
getHostInfo
The following code:
# [https://github.com/mirror/dmidecode/blob/master/dmidecode.c, dmi_print_memory_size()]
# ('KB' stays in to support older versions)
if [ -f /usr/sbin/dmidecode ]; then
dmidecode_ram=`PRIV_DMIDECODE /usr/sbin/dmidecode 2>/dev/null | sed -n '/DMI type 17,/,/^Handle 0x0/p' | awk '
BEGIN {
powers["bytes"] = -1
powers["kB"] = 0 # kilobytes
is replaced with:
# ('KB' stays in to support older versions)
if [ -f /usr/sbin/dmidecode ]; then
dmidecode_ram=`PRIV_DMIDECODE /usr/sbin/dmidecode 2>/dev/null | awk '
BEGIN {
powers["bytes"] = -1
powers["kB"] = 0 # kilobytes
The following code:
powers["EB"] = 5 # Exabytes
powers["ZB"] = 6 # Zetabytes
}
/Size: ([0-9]+) bytes|([kKMGTPEZ]B)/ {
size += int($2 * (1024 ^ powers[$3]))
}
END {
is replaced with:
powers["ZB"] = 6 # Zetabytes
}
/DMI type 17,/ { keep = 1; next }
/^Handle 0x/ { keep = 0 }
keep && /Size: ([0-9]+) (bytes|([kKMGTPEZ]B))/ {
size += int($2 * (1024 ^ powers[$3]))
}
END {
getHBAList
The following code:
# some files are ignored as they do not have read permissions,
# and does not contain relevant data either.
ignore_files=( "issue_lip" "vport_create" "vport_delete" "host_reset"
"scan" "trace" "lpfc_xlane_lun" "lpfc_xlane_lun_status"
"issue_reset" "ctlreg" "lpfc_aer_state_cleanup"
"lpfc_drvr_stat_data" "lpfc_soft_wwn_enable"
)
device_path_fc="/sys/class/fc_host/$device/"
# Resolve symlink as we need to identify source device path.
device_class_path_fc=`readlink -f $device_path_fc`
is replaced with:
# and does not contain relevant data either.
ignore_files="\
issue_lip vport_create vport_delete host_reset scan trace lpfc_xlane_lun\
lpfc_xlane_lun_status issue_reset ctlreg lpfc_aer_state_cleanup\
lpfc_drvr_stat_data lpfc_soft_wwn_enable "
device_path_fc="/sys/class/fc_host/$device/"
# Resolve symlink as we need to identify source device path.
device_class_path_fc=`readlink -f $device_path_fc`
The following code:
for f in `ls $device_path_fc 2>/dev/null`
do
if [ ! -d $device_path_fc$f ] && [[ ! " ${ignore_files[@]} " =~ " ${f} " ]]; then
echo -e "\t$f =" \"`cat $device_path_fc$f 2>/dev/null`\"
fi
done
is replaced with:
do
word=" $f "
if [ ! -d $device_path_fc$f ] && [ "${ignore_files#*$word}" != "$ignore_files" ]; then
echo -e "\t$f =" \"`cat $device_path_fc$f 2>/dev/null`\"
fi
done
VMware ESXi
getFileContent
The following code:
PRIV_TEST -f "${P}" -a -r "${P}"
if [ $? -eq 0 ]; then
echo "begin content:"
PRIV_CAT "${P}" | sed -e 's/[^[:print:][:blank:]]//g'
fi
is replaced with:
if [ $? -eq 0 ]; then
echo "begin content:"
PRIV_CAT "${P}" | sed -e 's/[^[:print:][:blank:]]//g;$a\'
fi
UnixWare
getFileContent
The following code:
PRIV_TEST -f "${P}" -a -r "${P}"
if [ $? -eq 0 ]; then
echo "begin content:"
PkRIV_CAT "${P}" | sed -e 's/[^[:print:][:blank:]]//g'
fi
is replaced with:
PRIV_TEST -f "${P}" -a -r "${P}"
if [ $? -eq 0 ]; then
echo "begin content:"
PRIV_CAT "${P}" | sed -e 's/[^[:print:][:blank:]]//g;$a\'
fi
Mac OS X
getFileContent
The following code:
PRIV_TEST -f "${P}" -a -r "${P}"
if [ $? -eq 0 ]; then
echo "begin content:"
PkRIV_CAT "${P}" | sed -e 's/[^[:print:][:blank:]]//g'
fi
is replaced with:
PRIV_TEST -f "${P}" -a -r "${P}"
if [ $? -eq 0 ]; then
echo "begin content:"
PRIV_CAT "${P}" | sed -e 's/[^[:print:][:blank:]]//g;$a\'
fi
getHostInfo
The following code:
system_profiler SPHardwareDataType SPSoftwareDataType > /tmp/tideway-hw-$$ 2>/dev/null
grep "Kernel Version: " /tmp/tideway-hw-$$ | sed 's/^.*: \(.*\)$/kernel: \1/'
grep "^[[:blank:]]*Memory: " /tmp/tideway-hw-$$ | sed 's/^.*: \(.*\)$/ram: \1/'
grep "Machine Model: " /tmp/tideway-hw-$$ | sed 's/^.*: \(.*\)$/model: \1/'
grep "Serial Number: " /tmp/tideway-hw-$$ | sed 's/^.*: \(.*\)$/serial: \1/'
rm -f /tmp/tideway-hw-$$
echo 'vendor: Apple'
uptime 2>/dev/null | awk '
is replaced with:
grep "Kernel Version: " /tmp/tideway-hw-$$ | sed 's/^.*: \(.*\)$/kernel: \1/'
grep "^[[:blank:]]*Memory: " /tmp/tideway-hw-$$ | sed 's/^.*: \(.*\)$/ram: \1/'
grep -E "Machine Model: |Model Identifier: " /tmp/tideway-hw-$$ | sed 's/^.*: \(.*\)$/model: \1/'
grep "Serial Number.*: " /tmp/tideway-hw-$$ | sed 's/^.*: \(.*\)$/serial: \1/'
rm -f /tmp/tideway-hw-$$
echo 'vendor: Apple'
uptime 2>/dev/null | awk '
Windows
Method | Change |
---|---|
getRegistryListing | ADDED |
initialise | ADDED |
runWMIQuery | ADDED |
getRegistryValue | ADDED |
getHBAList | ADDED |
getPackageList | packages: REMOVED |
getPackageList | getPackageList: ADDED |
getDeviceInfo | device_info: REMOVED |
getDeviceInfo | getDeviceInfo: ADDED |
getDirectoryListing | dir: REMOVED |
getDirectoryListing | getDirectoryListing: ADDED |
getFileContent | file_content: REMOVED |
getFileContent | getFileContent: ADDED |
getFileSystems | file_systems: REMOVED |
getFileSystems | getFileSystems: ADDED |
getIPAddresses | ip_addresses: REMOVED |
getIPAddresses | getIPAddresses: ADDED |
getServices | services: REMOVED |
getServices | getServices: ADDED |
getHostInfo | host_info: REMOVED |
getHostInfo | getHostInfo: ADDED |
getPatchList | patches: REMOVED |
getPatchList | getPatchList: ADDED |
getMACAddresses | mac_addresses: REMOVED |
getMACAddresses | getMACAddresses: ADDED |
getProcessList | processes: REMOVED |
getProcessList | getProcessList: ADDED |
getNetworkInterfaces | interfaces: REMOVED |
getNetworkInterfaces | getNetworkInterfaces: ADDED |
getNetworkConnectionList | network_connections: REMOVED |
getNetworkConnectionList | getNetworkConnections: ADDED |
getFileMetadata | fileinfo: REMOVED |
getFileMetadata | getFileMetadata: ADDED |
HPUX
initialise
The following code:
cat "$@"
}
# cstm requires superuser privileges
PRIV_CTSM() {
"$@"
}
# df requires superuser privileges to report file systems owned by other
is replaced with:
}
# cstm requires superuser privileges
PRIV_CSTM() {
"$@"
}
# cprop requires superuser privileges
PRIV_CPROP() {
"$@"
}
# df requires superuser privileges to report file systems owned by other
getFileContent
The following code:
PRIV_TEST -f "${P}" -a -r "${P}"
if [ $? -eq 0 ]; then
echo "begin content:"
PRIV_CAT "${P}" | sed -e 's/[^[:print:][:blank:]]//g'
fi
is replaced with:
if [ $? -eq 0 ]; then
echo "begin content:"
PRIV_CAT "${P}" | sed -e 's/[^[:print:][:blank:]]//g;$a\'
fi
getHostInfo
The following code:
echo 'end machinfo:'
else
logical_ram=""
ram=""
if [ -x /usr/sbin/parstatus ]; then
par_id=`/usr/sbin/parstatus -w 2> /dev/null | grep "The local partition number is" | sed 's/.*The local partition number is \([0-9]*\)\..*/\1/'`
if [ "$par_id" ]; then
echo par_id: $par_id
logical_ram=`/usr/sbin/parstatus -C -M |awk -v PAR_ID=$par_id 'BEGIN{ FS=":" };{ if ($NF==PAR_ID) { split($5, memarray,"/"); mem += int(memarray[1])} };END{ printf "logical_ram: %d\n", mem * 1048576 * 1024 }'`
fi
fi
ram=`echo "selclass qualifier memory;infolog" | PRIV_CSTM cstm 2>/dev/null | grep 'System Total'`
if [ "$ram" != "" ]; then
echo $ram | sed -e 's/^.*(\(.*\))[^0-9]*\([0-9]*\).*$/ram: \2\1/'
fi
if [ "$logical_ram" = "" ]; then
is replaced with:
echo 'end machinfo:'
else
ram=""
if [ -f /usr/sbin/cstm ]; then
ram=`echo "selclass qualifier memory;infolog" | PRIV_CSTM /usr/sbin/cstm 2>/dev/null | grep 'System Total'`
if [ "$ram" != "" ]; then
# Value is between parentheses - echo this part only. This will echo there whole string if there are none.
ram=`echo $ram | sed -e 's/^.*(\(.*\))[^0-9]*\([0-9]*\).*$/\2\1/'`
fi
fi
# If we didn't get RAM from cstm and we have cprop, try that.
if [ -z "${ram}" -a -f /opt/propplus/bin/cprop ]; then
if [ "$ram" != "" ]; then
cprop_ram=`PRIV_CPROP /opt/propplus/bin/cprop -detail -c Memory 2>/dev/null | awk '
BEGIN {
powers["bytes"] = -1
powers["kB"] = 0 # kilobytes
powers["KB"] = 0 # Kilobytes
powers["MB"] = 1 # Megabytes
powers["GB"] = 2 # Gigabytes
powers["TB"] = 3 # Terabytes
powers["PB"] = 4 # Petabytes
powers["EB"] = 5 # Exabytes
powers["ZB"] = 6 # Zetabytes
}
/\[Hash ID\]: Memory:/ { keep = 1; next }
/\[Hash ID\]: / { keep = 0 }
keep && /\[Capacity\]: ([0-9]+) (bytes|([kKMGTPEZ]B))/ {
size += int($2 * (1024 ^ powers[$3]))
}
END {
print size
}'`
if [ "${cprop_ram}" != "" ]; then
ram="${cprop_ram}KB"
fi
fi
fi
if [ "${ram}" != "" ]; then
echo "ram: "${ram}
fi
logical_ram=""
if [ -x /usr/sbin/parstatus ]; then
par_id=`/usr/sbin/parstatus -w 2> /dev/null | grep "The local partition number is" | sed 's/.*The local partition number is \([0-9]*\)\..*/\1/'`
if [ "$par_id" ]; then
echo par_id: $par_id
logical_ram=`/usr/sbin/parstatus -C -M |awk -v PAR_ID=$par_id 'BEGIN{ FS=":" };{ if ($NF==PAR_ID) { split($5, memarray,"/"); mem += int(memarray[1])} };END{ printf "logical_ram: %d\n", mem * 1048576 * 1024 }'`
fi
fi
if [ "$logical_ram" = "" ]; then
The following code:
MANIFEST_PATH="/var/opt/ignite/local/manifest/manifest"
if [ -r $MANIFEST_PATH ]; then
logical_ram=`grep "Main Memory" $MANIFEST_PATH | cut -d: -f2 | sed 's/ //g'`
if [ "$logical_ram" != "" ]; then
echo "logical_ram: $logical_ram"
fi
fi
fi
if [ "$logical_ram" = "" ]; then #cannot read manifest or cannot extract RAM info, try to read syslog
SYSLOG_PATH="/var/adm/syslog/syslog.log"
if [ -r $SYSLOG_PATH ]; then
logical_ram=`grep "Physical" $SYSLOG_PATH | sed 's/^.*Physical: *\([0-9]*\).*\([GMK]\)bytes.*$/\1\2B/'`
if [ "$logical_ram" != "" ]; then
echo "logical_ram: $logical_ram"
fi
fi
fi
fi
fi
is replaced with:
if [ -r $MANIFEST_PATH ]; then
logical_ram=`grep "Main Memory" $MANIFEST_PATH | cut -d: -f2 | sed 's/ //g'`
fi
fi
if [ "$logical_ram" = "" ]; then #cannot read manifest or cannot extract RAM info, try to read syslog
SYSLOG_PATH="/var/adm/syslog/syslog.log"
if [ -r $SYSLOG_PATH ]; then
logical_ram=`grep "Physical" $SYSLOG_PATH | sed 's/^.*Physical: *\([0-9]*\).*\([GMK]\)bytes.*$/\1\2B/'`
fi
fi
fi
if [ "$logical_ram" != "" ]; then
echo "logical_ram: $logical_ram"
fi
fi
NetBSD
getFileContent
The following code:
PRIV_TEST -f "${P}" -a -r "${P}"
if [ $? -eq 0 ]; then
echo "begin content:"
PRIV_CAT "${P}" | sed -e 's/[^[:print:][:blank:]]//g'
fi
is replaced with:
if [ $? -eq 0 ]; then
echo "begin content:"
PRIV_CAT "${P}" | sed -e 's/[^[:print:][:blank:]]//g;$a\'
fi