[-]
[+]
|
Changed |
_service:set_version:inventory-system.spec
|
|
[-]
[+]
|
Changed |
inventory-system.spec
^
|
|
[-]
[+]
|
Changed |
_service:recompress:tar_scm:inventory-system-0.0.6705.tar.bz2/TODO
^
|
@@ -10,3 +10,42 @@
dmidecode
- build a .deb package
+
+* FreeBSD support:
+ - get_system_uuid
+ sysctl kern.hostuuid|awk '{print toupper($2)}'
+ - get_system_cpu
+ sysctl hw.model | awk -F": " '{print $2} ' | sed -r 's@ +@ @g'
+ - get_system_memory
+ expr `sysctl hw.physmem|awk '{print $2}'` / 1024 / 1024
+
+ - get_system_default_ip
+ - get_system_ipv4
+ - get_system_ipv6
+
+ - get_system_disk_sizes
+ kern.disks:
+ kern.geom.conftxt:
+ - get_system_software
+ pkglst="" ; for pkg in `pkg_info | awk '{print $1}'` ; do pkglst="$pkglst $pkg"; done ; echo $pkglst
+
+
+* OpenBSD support:
+ - get_system_uuid
+ sysctl hw.uuid |awk -F= '{print toupper($2)}'
+ - get_system_cpu
+ sysctl hw.model | awk -F= '{print $2}'
+ - get_system_manufacturer
+ sysctl hw.vendor | awk -F= '{print $2}'
+ - get_system_productname
+ sysctl hw.product | awk -F= '{print $2}'
+ - get_system_memory
+ expr `sysctl hw.physmem | awk -F= '{print $2 }'` / 1024 / 1024
+
+ - get_system_default_ip
+ - get_system_ipv4
+ - get_system_ipv6
+ - get_system_disk_sizes
+
+ - get_system_software
+ pkglst="" ; for pkg in `pkg_info | awk '{print $1}'` ; do pkglst="$pkglst $pkg"; done ; echo $pkglst
|
[-]
[+]
|
Added |
_service:recompress:tar_scm:inventory-system-0.0.6705.tar.bz2/client/cron.reboot
^
|
@@ -0,0 +1 @@
+@reboot /etc/cron.daily/inventorysystem
|
[-]
[+]
|
Changed |
_service:recompress:tar_scm:inventory-system-0.0.6705.tar.bz2/client/inventory-system.sh
^
|
@@ -1,8 +1,8 @@
-#!/bin/bash
+#!/usr/bin/env bash
# Inventory System
# Author: Carsten Schoene
-# $LastChangedDate: 2013-08-05 22:54:19 +0200 (Mon, 05 Aug 2013) $
-# $Rev: 6380 $
+# $LastChangedDate: 2013-10-06 11:06:31 +0200 (Sun, 06 Oct 2013) $
+# $Rev: 6703 $
#
# Default options (can be changed by inventory-system.conf)
DEBUG="yes"
@@ -30,7 +30,7 @@
curl
lsb_release
uuidgen
-virtwhat
+virt-what
hostname
ip
ls
@@ -44,10 +44,13 @@
dmsetup
"
-PGKMGR_COMMANDS="
+PKGMGR_COMMANDS="
rpm
dpkg
+dpkg-query
aptitude
+yum
+zypper
"
# clean old logfile
@@ -72,8 +75,8 @@
# check required commands
for CMD in ${REQUIRED_COMMANDS} ; do
- CMDNAME=`echo ${CMD} | awk '{print toupper($1) }'`
- export $(eval "echo $CMDNAME")=`which ${CMD} 2>/dev/null`
+ CMDNAME=`echo ${CMD} | awk '{print toupper($1) }' | sed -e s@"-"@""@g`
+ export $(eval "echo ${CMDNAME}")=`which ${CMD} 2>/dev/null`
if [ -z "${!CMDNAME}" ] ; then
debug "Command: ${CMD} not found!"
exit 1
@@ -83,9 +86,9 @@
done
# check for package manager commands
-for CMD in ${PGKMGR_COMMANDS} ; do
- CMDNAME=`echo ${CMD} | awk '{print toupper($1) }'`
- export $(eval "echo $CMDNAME")=`which ${CMD} 2>/dev/null`
+for CMD in ${PKGMGR_COMMANDS} ; do
+ CMDNAME=`echo ${CMD} | awk '{print toupper($1) }' | sed -e s@"-"@""@g`
+ export $(eval "echo ${CMDNAME}")=`which ${CMD} 2>/dev/null`
if [ -z "${!CMDNAME}" ] ; then
debug "Command: ${CMD} not found, skipped!"
# no exit here because not all commands are available on every os
@@ -229,27 +232,25 @@
;;
*)
PKG=`${RPM} -qf --queryformat '%{name}\n' $0 | ${GREP} -v "^file /"`
- YUM=`which yum 2>/dev/null`
- ZYP=`which zypper 2>/dev/null`
if [ -n "${PKG}" ] ; then
if [ -n "${YUM}" ] && [ -f /etc/redhat-release ] ; then
CUPD="`${YUM} check-update ${PK} | ${TAIL} -n1 | ${AWK} '{print $1}'`"
if [ -n "${CUPD}" ] ; then
${YUM} -q -y update ${PKG}
fi
- elif [ -n "${ZYP}" ] && [ -f /etc/SuSE-release ] ; then
+ elif [ -n "${ZYPPER}" ] && [ -f /etc/SuSE-release ] ; then
REL=`${LSB_RELEASE} -r | ${AWK} '{print $NF}'`
case ${REL} in
11|11.1|11.2|11.3|11.4|12.1|12.2|12.3)
- CUPD="`${ZYP} -q lu | ${GREP} ${PKG}`"
+ CUPD="`${ZYPPER} -q lu | ${GREP} ${PKG}`"
if [ -n "${CUPD}" ] ; then
- ${ZYP} -q -n update ${PKG}
+ ${ZYPPER} -q -n update ${PKG}
fi
;;
10)
- CUPD="`${ZYP} -t lu -t package | ${GREP} ${PKG}`"
+ CUPD="`${ZYPPER} -t lu -t package | ${GREP} ${PKG}`"
if [ -n "${CUPD}" ] ; then
- ${ZYP} -t -n install -y -t package ${PKG}
+ ${ZYPPER} -t -n install -y -t package ${PKG}
fi
;;
esac
@@ -259,11 +260,36 @@
esac
}
+# get product name
+function get_system_productname {
+ [ "`is_disabled $FUNCNAME`" == "1" ] && return
+ case `get_system_type` in
+ xen-dom0|baremetal|kvm|vmware)
+ PRODNAME=`${DMIDECODE} -s system-product-name`
+ ;;
+ *)
+ PRODNAME="n/a"
+ ;;
+ esac
+ debug "SYSTEM-PRODUCTNAME: ${PRODNAME}"
+ echo ${PRODNAME}
+}
+
# get unique system uuid
function get_system_uuid {
[ "`is_disabled $FUNCNAME`" == "1" ] && return
# newer systems have uuid integrated
- UUID=`${LSHW} -quiet -C system | ${GREP} "configuration:" | ${GREP} -i uuid | ${SED} -e 's@.*[ \s]uuid=@@i'`
+
+ # workaround for DELL CloudEdge Servers with duplicate UUIDs
+ case `get_system_productname` in
+ "PowerEdge C61*"|C61*)
+ UUID=""
+ ;;
+ *)
+ UUID=`${LSHW} -quiet -C system | ${GREP} "configuration:" | ${GREP} -i uuid | ${SED} -e 's@.*[ \s]uuid=@@i'`
+ ;;
+ esac
+
# for older systems or virtual create one and save it for later use
if [ "${UUID}" == "" ] ; then
if [ ! -s /etc/system-inventory.uuid ] ; then
@@ -443,21 +469,6 @@
echo ${DEV_SIZES}
}
-# get product name
-function get_system_productname {
- [ "`is_disabled $FUNCNAME`" == "1" ] && return
- case `get_system_type` in
- xen-dom0|baremetal|kvm|vmware)
- PRODNAME=`${DMIDECODE} -s system-product-name`
- ;;
- *)
- PRODNAME="n/a"
- ;;
- esac
- debug "SYSTEM-PRODUCTNAME: ${PRODNAME}"
- echo ${PRODNAME}
-}
-
# get system vendor
function get_system_manufacturer {
[ "`is_disabled $FUNCNAME`" == "1" ] && return
@@ -686,9 +697,7 @@
[ "`is_disabled $FUNCNAME`" == "1" ] && return
case `get_system_os` in
Debian*|Ubuntu*)
- for pkg in `${DPKG} -l | ${GREP} ^ii | ${AWK} '{print $2"-"$3}' | ${AWK} -F+ '{print $1}'` ; do
- PACKAGES="${PACKAGES} ${pkg}"
- done
+ PACKAGES=`${DPKGQUERY} -W -f '${Package}-${Version}.${Architecture} ' | ${SED} -e s@"\+"@"_"@g`
;;
*)
PACKAGES=`${RPM} -qa --queryformat '%{name}-%{version}-%{release}.%{arch} '`
|