# 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: 1.3 Release: 6 License: Something Group: System Environment/Base Vendor: Platform Computing Corporation BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot BuildArch: noarch %define driverpack kernel-ib-1.3-2.6.18_53.el5.x86_64.rpm %define comp1 component-Platform-OFED-v1_3 %define comp2 component-Platform-OFED-devel-v1_3 %define SQLRUNNER /opt/kusu/sbin/sqlrunner %define _name platform_ofed %define LOGFILE /var/log/kusu/%{_name}.log %description This package is destined for the installer node and serves as an information container for the database. %prep %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_3.xml $RPM_BUILD_ROOT/opt/kusu/lib/plugins/ngedit/lib/spec-component-Platform-OFED-v1_3.xml /usr/bin/install %{_topdir}/lib-component-Platform-OFED-v1_3.py $RPM_BUILD_ROOT/opt/kusu/lib/plugins/ngedit/lib/lib-component-Platform-OFED-v1_3.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* # Req'd for GUI /opt/kusu/lib/plugins/ngedit/lib/spec-component-Platform-OFED-v1_3.xml /opt/kusu/lib/plugins/ngedit/lib/lib-component-Platform-OFED-v1_3.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" > %{LOGFILE} KID=`%{SQLRUNNER} -q "SELECT kid FROM kits WHERE rname='%{_name}'"` echo "KID = $KID" >> %{LOGFILE} # Setup the kit if [ -z "$KID" ] ; then echo "Adding kit entries to database" >> %{LOGFILE} %{SQLRUNNER} -q "INSERT INTO kits (rname, rdesc, version, removeable, arch) VALUES ('%{_name}', '%{summary}', '%{version}', true, 'noarch')" >>%{LOGFILE} 2>/dev/null KID=`%{SQLRUNNER} -q "SELECT kid FROM kits WHERE rname='%{_name}'"` echo "KID = $KID" >> %{LOGFILE} fi # Setup the first component %{SQLRUNNER} -q "DELETE FROM components WHERE kid=$KID" >> %{LOGFILE} %{SQLRUNNER} -q "INSERT INTO components (cname, cdesc, os, kid) VALUES ('%{comp1}', 'Platform OFED component', 'rhel-5-x86_64', $KID)" >> %{LOGFILE} %{SQLRUNNER} -q "INSERT INTO components (cname, cdesc, os, kid) VALUES ('%{comp2}', 'Platform OFED component', 'rhel-5-x86_64', $KID)" >> %{LOGFILE} %{SQLRUNNER} -q "INSERT INTO components (cname, cdesc, os, kid) VALUES ('%{comp1}', 'Platform OFED component', 'centos-5-x86_64', $KID)" >> %{LOGFILE} %{SQLRUNNER} -q "INSERT INTO components (cname, cdesc, os, kid) VALUES ('%{comp2}', 'Platform OFED component', 'centos-5-x86_64', $KID)" >> %{LOGFILE} cid_full=`%{SQLRUNNER} -q "SELECT cid from components where kid=$KID and cname='%{comp1}' and os=(select repos.ostype from repos, nodegroups WHERE nodegroups.ngid=1 AND nodegroups.repoid=repos.repoid)"` cid_imaged=`%{SQLRUNNER} -q "SELECT cid from components where kid=$KID and cname='%{comp2}' and os=(select repos.ostype from repos, nodegroups WHERE nodegroups.ngid=1 AND nodegroups.repoid=repos.repoid)"` echo "cid_imaged = $cid_imaged" >> %{LOGFILE} echo "cid_full = $cid_full" >> %{LOGFILE} # Setup the driverpacks table dpid=`%{SQLRUNNER} -q "SELECT dpid FROM driverpacks WHERE cid=$cid_full"` >> %{LOGFILE} if [ -z "$dpid" ]; then %{SQLRUNNER} -q "INSERT INTO driverpacks (dpname, dpdesc, cid) VALUES ('%{driverpack}', 'Platform OFED Kernel modules', $cid_full)" >> %{LOGFILE} fi dpid=`%{SQLRUNNER} -q "SELECT dpid FROM driverpacks WHERE cid=$cid_imaged"` >> %{LOGFILE} if [ -z "$dpid" ]; then %{SQLRUNNER} -q "INSERT INTO driverpacks (dpname, dpdesc, cid) VALUES ('%{driverpack}', 'Platform OFED Kernel modules', $cid_imaged)" >> %{LOGFILE} fi # Setup the associations %{SQLRUNNER} -q "INSERT INTO ng_has_comp (ngid, cid) VALUES (1, $cid_full)" >> %{LOGFILE} %{SQLRUNNER} -q "INSERT INTO ng_has_comp (ngid, cid) VALUES (2, $cid_full)" >> %{LOGFILE} %postun # ------------------ POST UNINSTALL ------------------------- %changelog * Wed Dec 12 2008 Mike Frisch 1.3-6 - Fixes kit installation problem related to SQL query (#119800) * Tue Nov 11 2008 Mark Black 1.3-5 - Update for postgres * Thu Jul 31 2008 Mike Frisch 1.3-4 - Add configuration file for OCS GUI (#110156) * Thu Mar 27 2008 Mike Frisch 1.3-2 - Removed AutoReq tag at the request of Red Hat