summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-support
diff options
context:
space:
mode:
authorLi xin <lixin.fnst@cn.fujitsu.com>2014-12-12 13:15:32 +0800
committerMartin Jansa <Martin.Jansa@gmail.com>2014-12-19 20:10:56 +0100
commite2f8425e2d806e511489694ec338c6299eddcddd (patch)
treec9fd885f37dc86bfa48d97a5143db5ef4e01318f /meta-oe/recipes-support
parent6781f9b5dc60bbd39727aeaa74c13dd31eb73838 (diff)
downloadmeta-openembedded-e2f8425e2d806e511489694ec338c6299eddcddd.tar.gz
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>
Diffstat (limited to 'meta-oe/recipes-support')
-rw-r--r--meta-oe/recipes-support/openwbem/openwbem/checkserverkey20
-rw-r--r--meta-oe/recipes-support/openwbem/openwbem/loadmof.sh118
-rw-r--r--meta-oe/recipes-support/openwbem/openwbem/novell-openwbem-root-acl.mof21
-rw-r--r--meta-oe/recipes-support/openwbem/openwbem/openwbem-etc_pam.d_openwbem7
-rw-r--r--meta-oe/recipes-support/openwbem/openwbem/openwbem-owcimomd.init131
-rw-r--r--meta-oe/recipes-support/openwbem/openwbem/openwbem-rpmlintrc2
-rw-r--r--meta-oe/recipes-support/openwbem/openwbem/owcimomd.service12
-rw-r--r--meta-oe/recipes-support/openwbem/openwbem/rmmof.sh53
-rw-r--r--meta-oe/recipes-support/openwbem/openwbem_3.2.3.bb112
9 files changed, 476 insertions, 0 deletions
diff --git a/meta-oe/recipes-support/openwbem/openwbem/checkserverkey b/meta-oe/recipes-support/openwbem/openwbem/checkserverkey
new file mode 100644
index 000000000..bcfa36101
--- /dev/null
+++ b/meta-oe/recipes-support/openwbem/openwbem/checkserverkey
@@ -0,0 +1,20 @@
1#!/bin/bash
2
3if [ ! -f "/etc/openwbem/serverkey.pem" ]; then
4 if [ -f "/etc/ssl/servercerts/servercert.pem" \
5 -a -f "/etc/ssl/servercerts/serverkey.pem" ]; then
6 echo "Using common server certificate /etc/ssl/servercerts/servercert.pem"
7 ln -s /etc/ssl/servercerts/server{cert,key}.pem /etc/openwbem/
8 else
9 echo "FAILED: Starting OpenWBEM server"
10 echo "There is no ssl server key available for OpenWBEM server to use."
11 echo -e "Please generate one with the following script and start the OpenWBEM service again:\n"
12 echo "##################################"
13 echo "/etc/openwbem/owgencert"
14 echo "================================="
15
16 echo "NOTE: The script uses /dev/random device for generating some random bits while generating the server key."
17 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"
18 exit 1
19 fi
20fi
diff --git a/meta-oe/recipes-support/openwbem/openwbem/loadmof.sh b/meta-oe/recipes-support/openwbem/openwbem/loadmof.sh
new file mode 100644
index 000000000..dd87811a3
--- /dev/null
+++ b/meta-oe/recipes-support/openwbem/openwbem/loadmof.sh
@@ -0,0 +1,118 @@
1#!/bin/sh
2#
3# options:
4# loadmof.sh <MOF_PATH> <NAMESPACE> <FILES>
5#
6# - or -
7#
8# options:
9# loadmof.sh -n <NAMESPACE> <FILES> [...]
10#
11# The former is preserved for compatibility with Pegasus and
12# sblim providers. The latter is preferred. If $1 is "-n",
13# the latter code path is executed. Otherwise the former is
14# executed.
15
16if [ "x$1" != "x-n" -a "x$1" != "x-v" ]; then
17# OLD STYLE
18if [ -f "/etc/init.d/owcimomd" ]; then
19 /etc/init.d/owcimomd status 1>&2 > /dev/null
20 if [ $? = "0" ]; then
21 CIMOM_RUNNING="true"
22 else
23 CIMOM_RUNNING="false"
24 fi
25else
26 exit 1
27fi
28if [ "$YAST_IS_RUNNING" = "instsys" ]; then
29 CIMOM_RUNNING="false"
30fi
31
32CIMOM=$1
33shift
34case "$CIMOM" in
35 pegasus)
36 exit 0
37 ;;
38esac
39MOF_PATH=$1
40shift
41NS=$1
42shift
43
44REPOSITORY="/var/lib/openwbem"
45#tmp_dir=`mktemp -d -p /tmp openwbem.XXXXXX`
46case "$CIMOM_RUNNING" in
47 true|false)
48 while [ "$#" -gt 0 ]
49 do
50 echo "Loading $MOF_PATH/$1"
51 #sed "s/cmpi:/cmpi::/g" $MOF_PATH/$1 > $tmp_dir/$1
52 /usr/bin/owmofc -c -n $NS -d $REPOSITORY $MOF_PATH/$1 > /dev/null 2>&1
53 shift
54 done
55 ;;
56esac
57#rm -rf $tmp_dir
58# END OLD STYLE
59
60else
61# NEW STYLE
62if [ "x$3" = "x" ]; then
63 echo "Usage: $0 -n <NAMESPACE> <FILES> [...]"
64 exit 1
65fi
66
67if [ "x$1" = "x-v" ]; then
68 VERBOSE=1
69 shift
70fi
71
72# get rid of "-n" arg
73shift
74
75NS="$1"
76
77shift
78
79DBDIR=/var/lib/openwbem
80LOGFILE=$DBDIR/loadmof.log
81CIMOM_INIT=/etc/init.d/owcimomd
82if [ "$YAST_IS_RUNNING" != "instsys" ] ; then
83 $CIMOM_INIT status > /dev/null 2>&1
84 CIMOM_RUNNING=$?
85fi
86if [ "x$CIMOM_RUNNING" = "x0" ]; then
87 $CIMOM_INIT stop > /dev/null 2>&1
88fi
89bkpdir=$DBDIR/backup-$$
90mkdir $bkpdir
91cp -a $DBDIR/*.{dat,ndx,lock} $bkpdir/
92rm -f $LOGFILE.9
93for i in 8 7 6 5 4 3 2 1 0; do
94 let newI=$i+1
95 if [ -f $LOGFILE.$i ]; then
96 mv $LOGFILE.$i $LOGFILE.$newI
97 fi
98done
99if [ -f $LOGFILE ]; then
100 mv $LOGFILE $LOGFILE.0
101fi
102if [ "x$VERBOSE" = "x1" ]; then
103 /usr/bin/owmofc -c -n $NS -d $DBDIR -s /usr/share/mof/cim-current "$@" 2>&1 | tee $LOGFILE
104else
105 /usr/bin/owmofc -c -n $NS -d $DBDIR -s /usr/share/mof/cim-current "$@" > $LOGFILE 2>&1
106fi
107RVAL=$?
108if [ "x$RVAL" != "x0" ]; then
109 echo "MOF import failed! Check $LOGFILE for details."
110 mv $bkpdir/* $DBDIR/
111fi
112rm -rf $bkpdir
113if [ "x$CIMOM_RUNNING" = "x0" ]; then
114 $CIMOM_INIT start > /dev/null 2>&1
115fi
116exit $RVAL
117fi
118
diff --git a/meta-oe/recipes-support/openwbem/openwbem/novell-openwbem-root-acl.mof b/meta-oe/recipes-support/openwbem/openwbem/novell-openwbem-root-acl.mof
new file mode 100644
index 000000000..c9970c79e
--- /dev/null
+++ b/meta-oe/recipes-support/openwbem/openwbem/novell-openwbem-root-acl.mof
@@ -0,0 +1,21 @@
1#pragma namespace("root/security")
2
3instance of OpenWBEM_NamespaceACL
4{
5 nspace = "root";
6 capability = "";
7};
8
9instance of OpenWBEM_NamespaceACL
10{
11 nspace = "root/cimv2";
12 capability = "";
13};
14
15instance of OpenWBEM_UserACL
16{
17 nspace = "root/cimv2";
18 username = "root";
19 capability = "rw";
20};
21
diff --git a/meta-oe/recipes-support/openwbem/openwbem/openwbem-etc_pam.d_openwbem b/meta-oe/recipes-support/openwbem/openwbem/openwbem-etc_pam.d_openwbem
new file mode 100644
index 000000000..b3785aa49
--- /dev/null
+++ b/meta-oe/recipes-support/openwbem/openwbem/openwbem-etc_pam.d_openwbem
@@ -0,0 +1,7 @@
1#%PAM-1.0
2auth required pam_unix2.so nullok
3auth required pam_nologin.so
4account required pam_unix2.so
5password required pam_pwcheck.so nullok
6password required pam_unix2.so nullok use_first_pass use_authtok
7session required pam_unix2.so none
diff --git a/meta-oe/recipes-support/openwbem/openwbem/openwbem-owcimomd.init b/meta-oe/recipes-support/openwbem/openwbem/openwbem-owcimomd.init
new file mode 100644
index 000000000..47fa8a7c6
--- /dev/null
+++ b/meta-oe/recipes-support/openwbem/openwbem/openwbem-owcimomd.init
@@ -0,0 +1,131 @@
1#!/bin/sh
2#
3### BEGIN INIT INFO
4# Provides: owcimomd
5# Required-Start: $network
6# Required-Stop: $network
7# Default-Start: 2 3 4 5
8# Default-Stop: 0 1 6
9# Short-Description: OpenWBEM CIMOM Daemon
10# Description: owcimomd
11# Start/Stop the OpenWBEM CIMOM Daemon
12### END INIT INFO
13#
14#
15# chkconfig: 2345 36 64
16# description: OpenWBEM CIMOM Daemon
17# processname: owcimomd
18
19NAME=owcimomd
20DAEMON=/usr/sbin/$NAME
21OPTIONS=
22PIDFILE=/var/run/$NAME.pid
23
24if [ $EUID != 0 ]; then
25 echo "This script must be run as root."
26 exit 1;
27fi
28
29if [ "$DESCRIPTIVE" = "" ]; then
30 DESCRIPTIVE="OpenWBEM CIMOM Daemon"
31fi
32
33lockfile=${SVIlock:-/var/lock/subsys/$NAME}
34
35[ -x $DAEMON ] || exit 0
36
37# See how we were called.
38. /etc/init.d/functions
39
40start() {
41 if [ ! -f "/etc/openwbem/serverkey.pem" ]; then
42 if [ -f "/etc/ssl/servercerts/servercert.pem" \
43 -a -f "/etc/ssl/servercerts/serverkey.pem" ]; then
44 echo "Using common server certificate /etc/ssl/servercerts/servercert.pem"
45 ln -s /etc/ssl/servercerts/server{cert,key}.pem /etc/openwbem/
46 else
47 echo "Generating OpenWBEM server public certificate and private key"
48 FQDN=`hostname --fqdn`
49 if [ "x${FQDN}" = "x" ]; then
50 FQDN=localhost.localdomain
51 fi
52cat << EOF | sh /etc/openwbem/owgencert > /dev/null 2>&1
53--
54SomeState
55SomeCity
56SomeOrganization
57SomeOrganizationalUnit
58${FQDN}
59root@${FQDN}
60EOF
61 fi
62 fi
63
64 # Start daemons.
65 echo -n "Starting the $DESCRIPTIVE"
66 daemon $DAEMON $OPTIONS > /dev/null 2>&1
67 RETVAL=$?
68
69 if [ $RETVAL -eq 0 ]; then
70 touch $lockfile
71 success
72 fi
73
74 echo
75 return $RETVAL
76}
77
78stop() {
79 # Stop daemons.
80 echo -n "Shutting down $DESCRIPTIVE"
81 killproc $DAEMON
82 RETVAL=$?
83
84 if [ $RETVAL -eq 0 ]; then
85 rm -f $lockfile
86 success
87 else
88 failure
89 fi
90 echo
91 return $RETVAL
92}
93
94restart() {
95 stop
96 start
97}
98
99case "$1" in
100 start)
101 start
102 ;;
103
104 stop)
105 stop
106 ;;
107
108 restart|force-reload)
109 restart
110 ;;
111
112 reload)
113 echo -n "Reload service $DESCRIPTIVE"
114 killproc -p $PIDFILE -HUP $DAEMON
115 RETVAL=$?
116 echo
117 exit $RETVAL
118 ;;
119
120 status)
121 echo -n "Checking for service $DESCRIPTIVE"
122 status $DAEMON
123 RETVAL=$?
124 exit $RETVAL
125 ;;
126
127 *)
128 echo "Usage: $0 {restart|start|stop|reload|force-reload|status}"
129esac
130
131exit $RETVAL
diff --git a/meta-oe/recipes-support/openwbem/openwbem/openwbem-rpmlintrc b/meta-oe/recipes-support/openwbem/openwbem/openwbem-rpmlintrc
new file mode 100644
index 000000000..785e32aaa
--- /dev/null
+++ b/meta-oe/recipes-support/openwbem/openwbem/openwbem-rpmlintrc
@@ -0,0 +1,2 @@
1addFilter("devel-file-in-non-devel-package .*/lib.*\.so")
2
diff --git a/meta-oe/recipes-support/openwbem/openwbem/owcimomd.service b/meta-oe/recipes-support/openwbem/openwbem/owcimomd.service
new file mode 100644
index 000000000..c6694b719
--- /dev/null
+++ b/meta-oe/recipes-support/openwbem/openwbem/owcimomd.service
@@ -0,0 +1,12 @@
1[Unit]
2Description=Web Based Enterprise Management (WBEM) Implementation
3After=syslog.target
4
5[Service]
6Type=forking
7ExecStart=/usr/sbin/owcimomd
8ExecStartPre=/etc/openwbem/checkserverkey
9PIDFile=/var/run/owcimomd.pid
10
11[Install]
12WantedBy=multi-user.target
diff --git a/meta-oe/recipes-support/openwbem/openwbem/rmmof.sh b/meta-oe/recipes-support/openwbem/openwbem/rmmof.sh
new file mode 100644
index 000000000..a495415be
--- /dev/null
+++ b/meta-oe/recipes-support/openwbem/openwbem/rmmof.sh
@@ -0,0 +1,53 @@
1#!/bin/sh
2#
3# options:
4# rmmof.sh <MOF_PATH> <NAMESPACE> <FILES>
5#
6# - or -
7#
8# options:
9# loadmof.sh -n <NAMESPACE> <FILES> [...]
10#
11# The former is preserved for compatibility with Pegasus and
12# sblim providers. The latter is preferred. If $1 is "-n",
13# the latter code path is executed. Otherwise the former is
14# executed.
15
16if [ "x$3" = "x" ]; then
17 echo "Usage: $0 -n <NAMESPACE> <FILES> [...]"
18 exit 1
19fi
20
21# get rid of "-n" arg
22shift
23
24NS="$1"
25
26shift
27
28DBDIR=/var/lib/openwbem
29CIMOM_INIT=/etc/init.d/owcimomd
30if [ "$YAST_IS_RUNNING" != "instsys" ] ; then
31 $CIMOM_INIT status
32 CIMOM_RUNNING=$?
33fi
34if [ "x$CIMOM_RUNNING" = "x0" ]; then
35 $CIMOM_INIT stop
36fi
37bkpdir=/tmp/owrep.bkp-$$
38mkdir $bkpdir
39cp -a $DBDIR $bkpdir/
40echo "Compiling MOF files"
41/usr/bin/owmofc -r -n $NS -d $DBDIR "$@" > /dev/null 2>&1
42RVAL=$?
43if [ "x$RVAL" != "x0" ]; then
44 echo "MOF import failed!"
45 rm -rf $DBDIR
46 mv $bkpdir/openwbem $DBDIR
47fi
48rm -rf $bkpdir
49if [ "x$CIMOM_RUNNING" = "x0" ]; then
50 $CIMOM_INIT start
51fi
52exit $RVAL
53
diff --git a/meta-oe/recipes-support/openwbem/openwbem_3.2.3.bb b/meta-oe/recipes-support/openwbem/openwbem_3.2.3.bb
new file mode 100644
index 000000000..1b186329c
--- /dev/null
+++ b/meta-oe/recipes-support/openwbem/openwbem_3.2.3.bb
@@ -0,0 +1,112 @@
1SUMMARY = "Web Based Enterprise Management (WBEM) Implementation"
2DESCRIPTION = "OpenWBEM is a set of software components that help facilitate \
3deployment of the Common Information Model (CIM) and Web-Based \
4Enterprise Management (WBEM) technologies of the Distributed Management \
5Task Force (DMTF). \
6 \
7Web-Based Enterprise Management (WBEM) is a set of management and \
8Internet standard technologies developed to unify the management of \
9distributed computing environments. WBEM provides the ability for the \
10industry to deliver a well-integrated set of standards-based management \
11tools, facilitating the exchange of data across otherwise disparate \
12technologies and platforms. \
13 \
14For more information about DMTF and its technologies, visit \
15http://www.dmtf.org/standards. "
16SECTION = "System/Management"
17HOMEPAGE = "http://openwbem.sourceforge.net/"
18
19inherit autotools-brokensep pkgconfig
20
21SOURCE1="novell-openwbem-root-acl.mof"
22SOURCE2="loadmof.sh"
23SOURCE3="rmmof.sh"
24SOURCE4="openwbem-owcimomd.init"
25SOURCE5="openwbem-etc_pam.d_openwbem"
26SOURCE6="openwbem-rpmlintrc"
27
28SRC_URI = " \
29 git://github.com/kkaempf/openwbem.git \
30 file://${SOURCE1} \
31 file://${SOURCE2} \
32 file://${SOURCE3} \
33 file://${SOURCE4} \
34 file://${SOURCE5} \
35 file://${SOURCE6} \
36 file://checkserverkey \
37 file://owcimomd.service \
38"
39SRCREV = "5c688eefc1f8e35a4b1c58529aae5f114c25c2a8"
40S = "${WORKDIR}/git"
41LICENSE = "BSD-3-Clause"
42LIC_FILES_CHKSUM += "file://COPYING;md5=0504a2eb85e01aa92c9efd4125a34660"
43INSANE_SKIP_${PN} = "dev-so"
44DEPENDS += "openssl libpam bash"
45RDEPENDS_${PN} += "bash"
46EXTRA_OECONF = " \
47 --prefix=/usr \
48 --sysconfdir=/etc \
49 --libdir=${libdir} \
50 --localstatedir=/var/lib \
51 --libexecdir=${libdir}/openwbem/bin \
52 --mandir=/usr/share/man \
53 --enable-threads-run-as-user \
54"
55do_configure_prepend() {
56 autoreconf --force --install
57}
58
59do_install() {
60 oe_runmake DESTDIR=${D} install
61 install -d ${D}/etc/openwbem/openwbem.conf.d
62 install -d ${D}/var/adm/fillup-templates
63 install -m 644 etc/sysconfig/daemons/owcimomd ${D}/var/adm/fillup-templates/sysconfig.owcimomd
64
65 # fix up hardcoded paths
66 sed -i -e 's,/usr/sbin/,${sbindir}/,' ${WORKDIR}/owcimomd.service
67 if ${@base_contains('DISTRO_FEATURES','systemd','true','false',d)}; then
68 install -d ${D}/${systemd_unitdir}/system
69 install -m 644 ${WORKDIR}/owcimomd.service ${D}/${systemd_unitdir}/system
70 install -m 755 ${WORKDIR}/checkserverkey ${D}${sysconfdir}/openwbem/
71 fi
72
73 install -d ${D}/etc/init.d
74 ln -sf ../../etc/init.d/owcimomd ${D}/usr/sbin/rcowcimomd
75 install -m 755 ${WORKDIR}/${SOURCE4} ${D}/etc/init.d/owcimomd
76 install -d ${D}${sbindir}
77 install -d ${D}/usr/bin
78 install -d ${D}/etc/pam.d
79 install -d ${D}/${libdir}/openwbem/cmpiproviders
80 install -m 644 etc/pam.d/openwbem ${D}/etc/pam.d
81 install -d ${D}/${libdir}/openwbem/c++providers
82 install -d ${D}/var/lib/openwbem
83 install -m 755 ${WORKDIR}/${SOURCE2} ${D}/usr/bin/ow-loadmof.sh
84 install -m 755 ${WORKDIR}/${SOURCE3} ${D}/usr/bin/ow-rmmof.sh
85 install -m 644 ${WORKDIR}/${SOURCE5} ${D}/etc/pam.d/openwbem
86
87 MOFPATH=${D}/usr/share/mof/openwbem
88 install -d $MOFPATH
89 mv ${D}/usr/share/openwbem/* $MOFPATH/
90 rmdir ${D}/usr/share/openwbem
91 install -m 644 ${WORKDIR}/${SOURCE1} $MOFPATH/
92
93 touch ${D}/var/lib/openwbem/{classassociation,instances,instassociation,namespaces,schema}.{dat,ndx,lock}
94}
95
96inherit ${@base_contains('VIRTUAL-RUNTIME_init_manager','systemd','systemd','', d)}
97SYSTEMD_SERVICE_${PN} = "owcimomd.service"
98SYSTEMD_AUTO_ENABLE = "disable"
99FILES_${PN} += " \
100 ${libdir} \
101 ${datadir}/mof \
102 ${systemd_unitdir} \
103"
104FILES_${PN}-dbg += " \
105 ${libdir}/openwbem/c++providers/.debug \
106 ${libdir}/openwbem/provifcs/.debug \
107 ${libdir}/openwbem/bin/openwbem/.debug \
108"
109FILES_${PN}-dev = " \
110 ${includedir} \
111 ${datadir}/aclocal/openwbem.m4 \
112"