# Copyright (C) 2008 Platform Computing Inc # # This program is free software; you can redistribute it and/or modify # it under the terms of version 2 of the GNU General Public License as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA # # Summary: Platform OFED Kit Name: kit-platform_ofed Version: TAG_OS Release: 3 License: Something Group: System Environment/Base Vendor: Platform Computing Corporation BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot BuildArch: noarch %define driverpack TAG_RPM %define comp1 component-Platform-OFED-v1_4 %define comp2 component-Platform-OFED-devel-v1_4 %define SQLRUNNER /opt/kusu/sbin/sqlrunner %description This package is destined for the installer node and serves as an information container for the database. %prep %define _name platform_ofed %install docdir=$RPM_BUILD_ROOT/depot/www/kits/%{_name}/%{version} plugdir=$RPM_BUILD_ROOT/opt/kusu/lib/plugins rm -rf $RPM_BUILD_ROOT mkdir -p $docdir/kit_ofed_doc_source # Add your own plugins if needed mkdir -p $plugdir/addhost mkdir -p $plugdir/genconfig mkdir -p $plugdir/ngedit /usr/bin/install -m 444 %{_topdir}/docs/index.html $docdir /usr/bin/install -m 444 %{_topdir}/docs/readme.html $docdir /usr/bin/install -m 444 %{_topdir}/docs/LICENSE $docdir /usr/bin/install -m 444 %{_topdir}/docs/kit_ofed_doc_source/* -t $docdir/kit_ofed_doc_source /usr/bin/install -m 444 %{_topdir}/plugins/addhost/*.py $plugdir/addhost /usr/bin/install -m 444 %{_topdir}/plugins/genconfig/*.py $plugdir/genconfig /usr/bin/install -m 444 %{_topdir}/plugins/ngedit/*.py $plugdir/ngedit /usr/bin/install -d $RPM_BUILD_ROOT/opt/kusu/lib/plugins/ngedit/lib /usr/bin/install %{_topdir}/spec-component-Platform-OFED-v1_4.xml $RPM_BUILD_ROOT/opt/kusu/lib/plugins/ngedit/lib/spec-component-Platform-OFED-v1_4.xml /usr/bin/install %{_topdir}/lib-component-Platform-OFED-v1_4.py $RPM_BUILD_ROOT/opt/kusu/lib/plugins/ngedit/lib/lib-component-Platform-OFED-v1_4.py %clean rm -rf $RPM_BUILD_ROOT %files # documentation /depot/www/kits/%{_name}/%{version}/index.html /depot/www/kits/%{_name}/%{version}/readme.html /depot/www/kits/%{_name}/%{version}/LICENSE /depot/www/kits/%{_name}/%{version}/kit_ofed_doc_source/* # plugins /opt/kusu/lib/plugins/addhost/*.py* /opt/kusu/lib/plugins/genconfig/*.py* /opt/kusu/lib/plugins/ngedit/*.py* # %exclude /opt/kusu/lib/plugins/ngedit/*.py? # Req'd for GUI /opt/kusu/lib/plugins/ngedit/lib/spec-component-Platform-OFED-v1_4.xml /opt/kusu/lib/plugins/ngedit/lib/lib-component-Platform-OFED-v1_4.py* %post # the following line is needed because kitops will extract # the %post sections during the kusu installer if [ -e /var/lock/subsys/kusu-installer ]; then exit 0; fi # include Node group creation and component association echo "POST Start" > /tmp/%{_name}.log KID=`%{SQLRUNNER} -q "SELECT kid FROM kits WHERE rname='%{_name}'"` echo "KID = $KID" >> /tmp/%{_name}.log # Setup the kit if [ -z "$KID" ] ; then echo "Adding kit entries to database" >> /tmp/%{_name}.log %{SQLRUNNER} -q "INSERT INTO kits (rname, rdesc, version, removeable, arch) VALUES ('%{_name}', '%{summary}', '%{version}', true, 'noarch')" 2>/dev/null KID=`%{SQLRUNNER} -q "SELECT kid FROM kits WHERE rname='%{_name}'"` echo "KID = $KID" >> /tmp/%{_name}.log fi # Setup the first component cid_imaged=`%{SQLRUNNER} -q "SELECT cid FROM components WHERE cname = '%{comp2}'"` echo "cid_imaged = $cid_imaged" >> /tmp/%{_name}.log if [ -z "$cid_imaged" ]; then echo "%{comp2} does not exist! creating.." >> /tmp/%{_name}.log %{SQLRUNNER} -q "INSERT INTO components (cname, cdesc, os, kid) VALUES ('%{comp2}', 'Platform OFED component', 'rhel-5-x86_64', $KID)" else echo "Updating component %{comp2}" >> /tmp/%{_name}.log %{SQLRUNNER} -q "UPDATE components SET os='rhel-5-x86_64' WHERE cname='%{comp2}' AND kid=$KID" >> /tmp/%{_name}.log fi # Setup the second component cid_full=`%{SQLRUNNER} -q "SELECT cid FROM components WHERE cname='%{comp1}'"` >> /tmp/%{_name}.log echo "cid_full = $cid_full" >> /tmp/%{_name}.log if [ -z "$cid_full" ]; then echo "%{comp1} does not exist! creating.." >> /tmp/%{_name}.log %{SQLRUNNER} -q "INSERT INTO components (cname, cdesc, os, kid) values ('%{comp1}', 'Platform OFED component', 'rhel-5-x86_64', $KID)" >> /tmp/%{_name}.log else echo "Updating component %{comp2}" >> /tmp/%{_name}.log %{SQLRUNNER} -q "UPDATE components SET os='rhel-5-x86_64' WHERE cname='%{comp1}' AND kid=$KID" >> /tmp/%{_name}.log fi echo "Stop post" >> /tmp/%{_name}.log # Setup the driverpacks table cid_full=`%{SQLRUNNER} -q "SELECT cid FROM components WHERE cname='%{comp1}'"` >> /tmp/%{_name}.log dpid=`%{SQLRUNNER} -q "SELECT dpid FROM driverpacks WHERE cid=$cid_full"` >> /tmp/%{_name}.log if [ -z "$dpid" ]; then %{SQLRUNNER} -q "INSERT INTO driverpacks (dpname, dpdesc, cid) VALUES ('%{driverpack}', 'Platform OFED Kernel modules', $cid_full)" >> /tmp/%{_name}.log fi cid_imaged=`%{SQLRUNNER} -q "SELECT cid FROM components WHERE cname = '%{comp2}'"` dpid=`%{SQLRUNNER} -q "SELECT dpid FROM driverpacks WHERE cid=$cid_imaged"` >> /tmp/%{_name}.log if [ -z "$dpid" ]; then %{SQLRUNNER} -q "INSERT INTO driverpacks (dpname, dpdesc, cid) VALUES ('%{driverpack}', 'Platform OFED Kernel modules', $cid_imaged)" >> /tmp/%{_name}.log fi # Setup the associations %{SQLRUNNER} -q "INSERT INTO ng_has_comp (cid, ngid) VALUES ($cid_full, 1)" %{SQLRUNNER} -q "INSERT INTO ng_has_comp (cid, ngid) VALUES ($cid_full, 2)" %postun # ------------------ POST UNINSTALL ------------------------- %changelog * Mon Jan 19 2009 Mehdi Bozzo-Rey TAG_OS.3 - fix for driverpack * Thu Dec 18 2008 Mehdi Bozzo-Rey TAG_OS.2 - update for the GUI / ofed 1.4 * Thu Mar 27 2008 Mike Frisch 1.3-2 - Removed AutoReq tag at the request of Red Hat