2010-04-13 20:27:58 +00:00
|
|
|
%define name zhcp
|
|
|
|
|
2013-01-29 23:10:30 +00:00
|
|
|
Summary: System z hardware control point (zHCP)
|
2010-04-13 20:27:58 +00:00
|
|
|
Name: %{name}
|
2013-01-29 23:10:30 +00:00
|
|
|
Version: 2.0
|
|
|
|
Release: snap%(date +"%Y%m%d%H%M")
|
2010-04-13 20:27:58 +00:00
|
|
|
Source: zhcp-build.tar.gz
|
|
|
|
Vendor: IBM
|
2012-05-09 18:31:23 +00:00
|
|
|
License: IBM Copyright 2012 Eclipse Public License
|
2010-04-13 20:27:58 +00:00
|
|
|
Group: System/tools
|
2012-05-09 18:31:23 +00:00
|
|
|
BuildRoot: %{_tmppath}/zhcp
|
|
|
|
Prefix: /opt/zhcp
|
2010-04-13 20:27:58 +00:00
|
|
|
|
|
|
|
%description
|
2010-10-29 14:15:52 +00:00
|
|
|
The System z hardware control point (zHCP) is C program API to interface with
|
2013-01-29 23:10:30 +00:00
|
|
|
z/VM SMAPI. It is used by xCAT to manage virtual machines running Linux on
|
|
|
|
System z.
|
2010-04-13 20:27:58 +00:00
|
|
|
|
|
|
|
%prep
|
2012-03-09 20:18:23 +00:00
|
|
|
tar -zxvf ../SOURCES/zhcp-build.tar.gz -C ../BUILD/ --strip 1
|
2010-04-13 20:27:58 +00:00
|
|
|
|
|
|
|
%build
|
|
|
|
make
|
|
|
|
|
|
|
|
%install
|
|
|
|
make install
|
|
|
|
make post
|
|
|
|
make clean
|
|
|
|
|
2012-05-09 18:31:23 +00:00
|
|
|
mkdir -p $RPM_BUILD_ROOT/usr/bin
|
2013-01-29 23:10:30 +00:00
|
|
|
ln -sfd %{prefix}/bin/smcli $RPM_BUILD_ROOT/usr/bin
|
2012-05-09 18:31:23 +00:00
|
|
|
chmod 644 $RPM_BUILD_ROOT/usr/bin/smcli
|
|
|
|
mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1/
|
|
|
|
cp smcli.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
|
2013-01-29 23:10:30 +00:00
|
|
|
mkdir -p $RPM_BUILD_ROOT/var/opt/zhcp
|
|
|
|
cp config/tracing.conf $RPM_BUILD_ROOT/var/opt/zhcp
|
2012-05-09 18:31:23 +00:00
|
|
|
|
2010-10-29 14:15:52 +00:00
|
|
|
%post
|
|
|
|
echo "/opt/zhcp/lib" > /etc/ld.so.conf.d/zhcp.conf
|
2013-01-29 23:10:30 +00:00
|
|
|
|
|
|
|
# Create log file for zHCP
|
|
|
|
mkdir -p /var/log/zhcp
|
|
|
|
touch /var/log/zhcp/zhcp.log
|
|
|
|
|
|
|
|
# syslog located in different directories in Red Hat/SUSE
|
|
|
|
ZHCP_LOG_HEADER="# Logging for xCAT zHCP"
|
|
|
|
ZHCP_LOG="/var/log/zhcp/zhcp.log"
|
|
|
|
echo "Configuring syslog"
|
|
|
|
|
|
|
|
# SUSE Linux Enterprise Server
|
|
|
|
if [ -e "/etc/init.d/syslog" ]; then
|
|
|
|
# Syslog is the standard for log messages
|
|
|
|
grep ${ZHCP_LOG} /etc/syslog.conf > /dev/null || (echo -e "\n${ZHCP_LOG_HEADER}\nlocal4.* ${ZHCP_LOG}" >> /etc/syslog.conf)
|
|
|
|
fi
|
|
|
|
if [ -e "/etc/syslog-ng/syslog-ng.conf" ]; then
|
|
|
|
# Syslog-ng is the replacement for syslogd
|
|
|
|
grep ${ZHCP_LOG} /etc/syslog-ng/syslog-ng.conf > /dev/null || (echo -e "\n${ZHCP_LOG_HEADER}\n\
|
|
|
|
filter f_xcat_zhcp { facility(local4); };\n\
|
|
|
|
destination zhcplog { file(\"${ZHCP_LOG}\"); };\n\
|
|
|
|
log { source(src); filter(f_xcat_zhcp); destination(zhcplog); };" >> /etc/syslog-ng/syslog-ng.conf)
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Red Hat Enterprise Linux
|
|
|
|
if [ -e "/etc/rc.d/init.d/rsyslog" ]; then
|
|
|
|
grep ${ZHCP_LOG} /etc/rsyslog.conf > /dev/null || (echo -e "\n${ZHCP_LOG_HEADER}\nlocal4.* ${ZHCP_LOG}" >> /etc/rsyslog.conf)
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Restart syslog
|
|
|
|
if [ -e "/etc/redhat-release" ]; then
|
|
|
|
/etc/rc.d/init.d/rsyslog restart
|
|
|
|
else
|
|
|
|
/etc/init.d/syslog restart
|
|
|
|
fi
|
|
|
|
|
2010-10-29 14:15:52 +00:00
|
|
|
/sbin/ldconfig
|
|
|
|
|
2012-05-09 18:31:23 +00:00
|
|
|
%preun
|
|
|
|
# Delete man page and smcli command
|
|
|
|
rm -rf /etc/ld.so.conf.d/zhcp.conf
|
|
|
|
rm -rf /usr/bin/smcli
|
|
|
|
rm -rf /usr/share/man/man1/smcli.1.gz
|
|
|
|
|
2010-04-13 20:27:58 +00:00
|
|
|
%files
|
2012-05-09 18:31:23 +00:00
|
|
|
# Files provided by this package
|
|
|
|
%defattr(-,root,root)
|
2010-04-13 20:27:58 +00:00
|
|
|
/opt/zhcp/*
|
2013-01-29 23:10:30 +00:00
|
|
|
%config(noreplace) /usr/bin/smcli
|
|
|
|
%config(noreplace) /usr/share/man/man1/smcli.1.gz
|
|
|
|
%config(noreplace) /var/opt/zhcp/tracing.conf
|
2010-04-13 20:27:58 +00:00
|
|
|
|