openwbem: add new recipe

OpenWBEM is a set of software components that help facilitate
deployment of the Common Information Model (CIM) and Web-Based
Enterprise Management (WBEM) technologies of the Distributed Management
Task Force (DMTF).

Signed-off-by: Li Xin <lixin.fnst@cn.fujitsu.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
This commit is contained in:
Li xin 2014-12-12 13:15:32 +08:00 committed by Martin Jansa
parent 6781f9b5dc
commit e2f8425e2d
9 changed files with 476 additions and 0 deletions

View File

@ -0,0 +1,20 @@
#!/bin/bash
if [ ! -f "/etc/openwbem/serverkey.pem" ]; then
if [ -f "/etc/ssl/servercerts/servercert.pem" \
-a -f "/etc/ssl/servercerts/serverkey.pem" ]; then
echo "Using common server certificate /etc/ssl/servercerts/servercert.pem"
ln -s /etc/ssl/servercerts/server{cert,key}.pem /etc/openwbem/
else
echo "FAILED: Starting OpenWBEM server"
echo "There is no ssl server key available for OpenWBEM server to use."
echo -e "Please generate one with the following script and start the OpenWBEM service again:\n"
echo "##################################"
echo "/etc/openwbem/owgencert"
echo "================================="
echo "NOTE: The script uses /dev/random device for generating some random bits while generating the server key."
echo " If this takes too long, you can replace the value of \"RANDFILE\" in /etc/openwsman/ssleay.cnf with /dev/urandom. Please understand the implications"
exit 1
fi
fi

View File

@ -0,0 +1,118 @@
#!/bin/sh
#
# options:
# loadmof.sh <MOF_PATH> <NAMESPACE> <FILES>
#
# - or -
#
# options:
# loadmof.sh -n <NAMESPACE> <FILES> [...]
#
# The former is preserved for compatibility with Pegasus and
# sblim providers. The latter is preferred. If $1 is "-n",
# the latter code path is executed. Otherwise the former is
# executed.
if [ "x$1" != "x-n" -a "x$1" != "x-v" ]; then
# OLD STYLE
if [ -f "/etc/init.d/owcimomd" ]; then
/etc/init.d/owcimomd status 1>&2 > /dev/null
if [ $? = "0" ]; then
CIMOM_RUNNING="true"
else
CIMOM_RUNNING="false"
fi
else
exit 1
fi
if [ "$YAST_IS_RUNNING" = "instsys" ]; then
CIMOM_RUNNING="false"
fi
CIMOM=$1
shift
case "$CIMOM" in
pegasus)
exit 0
;;
esac
MOF_PATH=$1
shift
NS=$1
shift
REPOSITORY="/var/lib/openwbem"
#tmp_dir=`mktemp -d -p /tmp openwbem.XXXXXX`
case "$CIMOM_RUNNING" in
true|false)
while [ "$#" -gt 0 ]
do
echo "Loading $MOF_PATH/$1"
#sed "s/cmpi:/cmpi::/g" $MOF_PATH/$1 > $tmp_dir/$1
/usr/bin/owmofc -c -n $NS -d $REPOSITORY $MOF_PATH/$1 > /dev/null 2>&1
shift
done
;;
esac
#rm -rf $tmp_dir
# END OLD STYLE
else
# NEW STYLE
if [ "x$3" = "x" ]; then
echo "Usage: $0 -n <NAMESPACE> <FILES> [...]"
exit 1
fi
if [ "x$1" = "x-v" ]; then
VERBOSE=1
shift
fi
# get rid of "-n" arg
shift
NS="$1"
shift
DBDIR=/var/lib/openwbem
LOGFILE=$DBDIR/loadmof.log
CIMOM_INIT=/etc/init.d/owcimomd
if [ "$YAST_IS_RUNNING" != "instsys" ] ; then
$CIMOM_INIT status > /dev/null 2>&1
CIMOM_RUNNING=$?
fi
if [ "x$CIMOM_RUNNING" = "x0" ]; then
$CIMOM_INIT stop > /dev/null 2>&1
fi
bkpdir=$DBDIR/backup-$$
mkdir $bkpdir
cp -a $DBDIR/*.{dat,ndx,lock} $bkpdir/
rm -f $LOGFILE.9
for i in 8 7 6 5 4 3 2 1 0; do
let newI=$i+1
if [ -f $LOGFILE.$i ]; then
mv $LOGFILE.$i $LOGFILE.$newI
fi
done
if [ -f $LOGFILE ]; then
mv $LOGFILE $LOGFILE.0
fi
if [ "x$VERBOSE" = "x1" ]; then
/usr/bin/owmofc -c -n $NS -d $DBDIR -s /usr/share/mof/cim-current "$@" 2>&1 | tee $LOGFILE
else
/usr/bin/owmofc -c -n $NS -d $DBDIR -s /usr/share/mof/cim-current "$@" > $LOGFILE 2>&1
fi
RVAL=$?
if [ "x$RVAL" != "x0" ]; then
echo "MOF import failed! Check $LOGFILE for details."
mv $bkpdir/* $DBDIR/
fi
rm -rf $bkpdir
if [ "x$CIMOM_RUNNING" = "x0" ]; then
$CIMOM_INIT start > /dev/null 2>&1
fi
exit $RVAL
fi

View File

@ -0,0 +1,21 @@
#pragma namespace("root/security")
instance of OpenWBEM_NamespaceACL
{
nspace = "root";
capability = "";
};
instance of OpenWBEM_NamespaceACL
{
nspace = "root/cimv2";
capability = "";
};
instance of OpenWBEM_UserACL
{
nspace = "root/cimv2";
username = "root";
capability = "rw";
};

View File

@ -0,0 +1,7 @@
#%PAM-1.0
auth required pam_unix2.so nullok
auth required pam_nologin.so
account required pam_unix2.so
password required pam_pwcheck.so nullok
password required pam_unix2.so nullok use_first_pass use_authtok
session required pam_unix2.so none

View File

@ -0,0 +1,131 @@
#!/bin/sh
#
### BEGIN INIT INFO
# Provides: owcimomd
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: OpenWBEM CIMOM Daemon
# Description: owcimomd
# Start/Stop the OpenWBEM CIMOM Daemon
### END INIT INFO
#
#
# chkconfig: 2345 36 64
# description: OpenWBEM CIMOM Daemon
# processname: owcimomd
NAME=owcimomd
DAEMON=/usr/sbin/$NAME
OPTIONS=
PIDFILE=/var/run/$NAME.pid
if [ $EUID != 0 ]; then
echo "This script must be run as root."
exit 1;
fi
if [ "$DESCRIPTIVE" = "" ]; then
DESCRIPTIVE="OpenWBEM CIMOM Daemon"
fi
lockfile=${SVIlock:-/var/lock/subsys/$NAME}
[ -x $DAEMON ] || exit 0
# See how we were called.
. /etc/init.d/functions
start() {
if [ ! -f "/etc/openwbem/serverkey.pem" ]; then
if [ -f "/etc/ssl/servercerts/servercert.pem" \
-a -f "/etc/ssl/servercerts/serverkey.pem" ]; then
echo "Using common server certificate /etc/ssl/servercerts/servercert.pem"
ln -s /etc/ssl/servercerts/server{cert,key}.pem /etc/openwbem/
else
echo "Generating OpenWBEM server public certificate and private key"
FQDN=`hostname --fqdn`
if [ "x${FQDN}" = "x" ]; then
FQDN=localhost.localdomain
fi
cat << EOF | sh /etc/openwbem/owgencert > /dev/null 2>&1
--
SomeState
SomeCity
SomeOrganization
SomeOrganizationalUnit
${FQDN}
root@${FQDN}
EOF
fi
fi
# Start daemons.
echo -n "Starting the $DESCRIPTIVE"
daemon $DAEMON $OPTIONS > /dev/null 2>&1
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
touch $lockfile
success
fi
echo
return $RETVAL
}
stop() {
# Stop daemons.
echo -n "Shutting down $DESCRIPTIVE"
killproc $DAEMON
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
rm -f $lockfile
success
else
failure
fi
echo
return $RETVAL
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|force-reload)
restart
;;
reload)
echo -n "Reload service $DESCRIPTIVE"
killproc -p $PIDFILE -HUP $DAEMON
RETVAL=$?
echo
exit $RETVAL
;;
status)
echo -n "Checking for service $DESCRIPTIVE"
status $DAEMON
RETVAL=$?
exit $RETVAL
;;
*)
echo "Usage: $0 {restart|start|stop|reload|force-reload|status}"
esac
exit $RETVAL

View File

@ -0,0 +1,2 @@
addFilter("devel-file-in-non-devel-package .*/lib.*\.so")

View File

@ -0,0 +1,12 @@
[Unit]
Description=Web Based Enterprise Management (WBEM) Implementation
After=syslog.target
[Service]
Type=forking
ExecStart=/usr/sbin/owcimomd
ExecStartPre=/etc/openwbem/checkserverkey
PIDFile=/var/run/owcimomd.pid
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,53 @@
#!/bin/sh
#
# options:
# rmmof.sh <MOF_PATH> <NAMESPACE> <FILES>
#
# - or -
#
# options:
# loadmof.sh -n <NAMESPACE> <FILES> [...]
#
# The former is preserved for compatibility with Pegasus and
# sblim providers. The latter is preferred. If $1 is "-n",
# the latter code path is executed. Otherwise the former is
# executed.
if [ "x$3" = "x" ]; then
echo "Usage: $0 -n <NAMESPACE> <FILES> [...]"
exit 1
fi
# get rid of "-n" arg
shift
NS="$1"
shift
DBDIR=/var/lib/openwbem
CIMOM_INIT=/etc/init.d/owcimomd
if [ "$YAST_IS_RUNNING" != "instsys" ] ; then
$CIMOM_INIT status
CIMOM_RUNNING=$?
fi
if [ "x$CIMOM_RUNNING" = "x0" ]; then
$CIMOM_INIT stop
fi
bkpdir=/tmp/owrep.bkp-$$
mkdir $bkpdir
cp -a $DBDIR $bkpdir/
echo "Compiling MOF files"
/usr/bin/owmofc -r -n $NS -d $DBDIR "$@" > /dev/null 2>&1
RVAL=$?
if [ "x$RVAL" != "x0" ]; then
echo "MOF import failed!"
rm -rf $DBDIR
mv $bkpdir/openwbem $DBDIR
fi
rm -rf $bkpdir
if [ "x$CIMOM_RUNNING" = "x0" ]; then
$CIMOM_INIT start
fi
exit $RVAL

View File

@ -0,0 +1,112 @@
SUMMARY = "Web Based Enterprise Management (WBEM) Implementation"
DESCRIPTION = "OpenWBEM is a set of software components that help facilitate \
deployment of the Common Information Model (CIM) and Web-Based \
Enterprise Management (WBEM) technologies of the Distributed Management \
Task Force (DMTF). \
\
Web-Based Enterprise Management (WBEM) is a set of management and \
Internet standard technologies developed to unify the management of \
distributed computing environments. WBEM provides the ability for the \
industry to deliver a well-integrated set of standards-based management \
tools, facilitating the exchange of data across otherwise disparate \
technologies and platforms. \
\
For more information about DMTF and its technologies, visit \
http://www.dmtf.org/standards. "
SECTION = "System/Management"
HOMEPAGE = "http://openwbem.sourceforge.net/"
inherit autotools-brokensep pkgconfig
SOURCE1="novell-openwbem-root-acl.mof"
SOURCE2="loadmof.sh"
SOURCE3="rmmof.sh"
SOURCE4="openwbem-owcimomd.init"
SOURCE5="openwbem-etc_pam.d_openwbem"
SOURCE6="openwbem-rpmlintrc"
SRC_URI = " \
git://github.com/kkaempf/openwbem.git \
file://${SOURCE1} \
file://${SOURCE2} \
file://${SOURCE3} \
file://${SOURCE4} \
file://${SOURCE5} \
file://${SOURCE6} \
file://checkserverkey \
file://owcimomd.service \
"
SRCREV = "5c688eefc1f8e35a4b1c58529aae5f114c25c2a8"
S = "${WORKDIR}/git"
LICENSE = "BSD-3-Clause"
LIC_FILES_CHKSUM += "file://COPYING;md5=0504a2eb85e01aa92c9efd4125a34660"
INSANE_SKIP_${PN} = "dev-so"
DEPENDS += "openssl libpam bash"
RDEPENDS_${PN} += "bash"
EXTRA_OECONF = " \
--prefix=/usr \
--sysconfdir=/etc \
--libdir=${libdir} \
--localstatedir=/var/lib \
--libexecdir=${libdir}/openwbem/bin \
--mandir=/usr/share/man \
--enable-threads-run-as-user \
"
do_configure_prepend() {
autoreconf --force --install
}
do_install() {
oe_runmake DESTDIR=${D} install
install -d ${D}/etc/openwbem/openwbem.conf.d
install -d ${D}/var/adm/fillup-templates
install -m 644 etc/sysconfig/daemons/owcimomd ${D}/var/adm/fillup-templates/sysconfig.owcimomd
# fix up hardcoded paths
sed -i -e 's,/usr/sbin/,${sbindir}/,' ${WORKDIR}/owcimomd.service
if ${@base_contains('DISTRO_FEATURES','systemd','true','false',d)}; then
install -d ${D}/${systemd_unitdir}/system
install -m 644 ${WORKDIR}/owcimomd.service ${D}/${systemd_unitdir}/system
install -m 755 ${WORKDIR}/checkserverkey ${D}${sysconfdir}/openwbem/
fi
install -d ${D}/etc/init.d
ln -sf ../../etc/init.d/owcimomd ${D}/usr/sbin/rcowcimomd
install -m 755 ${WORKDIR}/${SOURCE4} ${D}/etc/init.d/owcimomd
install -d ${D}${sbindir}
install -d ${D}/usr/bin
install -d ${D}/etc/pam.d
install -d ${D}/${libdir}/openwbem/cmpiproviders
install -m 644 etc/pam.d/openwbem ${D}/etc/pam.d
install -d ${D}/${libdir}/openwbem/c++providers
install -d ${D}/var/lib/openwbem
install -m 755 ${WORKDIR}/${SOURCE2} ${D}/usr/bin/ow-loadmof.sh
install -m 755 ${WORKDIR}/${SOURCE3} ${D}/usr/bin/ow-rmmof.sh
install -m 644 ${WORKDIR}/${SOURCE5} ${D}/etc/pam.d/openwbem
MOFPATH=${D}/usr/share/mof/openwbem
install -d $MOFPATH
mv ${D}/usr/share/openwbem/* $MOFPATH/
rmdir ${D}/usr/share/openwbem
install -m 644 ${WORKDIR}/${SOURCE1} $MOFPATH/
touch ${D}/var/lib/openwbem/{classassociation,instances,instassociation,namespaces,schema}.{dat,ndx,lock}
}
inherit ${@base_contains('VIRTUAL-RUNTIME_init_manager','systemd','systemd','', d)}
SYSTEMD_SERVICE_${PN} = "owcimomd.service"
SYSTEMD_AUTO_ENABLE = "disable"
FILES_${PN} += " \
${libdir} \
${datadir}/mof \
${systemd_unitdir} \
"
FILES_${PN}-dbg += " \
${libdir}/openwbem/c++providers/.debug \
${libdir}/openwbem/provifcs/.debug \
${libdir}/openwbem/bin/openwbem/.debug \
"
FILES_${PN}-dev = " \
${includedir} \
${datadir}/aclocal/openwbem.m4 \
"