-
Notifications
You must be signed in to change notification settings - Fork 1
/
zthin_sles.spec
105 lines (86 loc) · 3.17 KB
/
zthin_sles.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# Copyright 2024 Contributors to the Open Mainframe Project.
%define name zthin
Summary: System z hardware control point (zThin)
Name: %{name}
Version: 3.1.2
Release: 1
Source: zthin-build.tar.gz
Vendor: IBM
License: Apache-2.0
Group: System/tools
BuildRoot: %{_tmppath}/zthin
Prefix: /opt/zthin
%description
The System z hardware control point (zThin) is a set of APIs to interface with
z/VM SMAPI. It is used to manage virtual machines running Linux on
System z.
BuildRequires: libtirpc-devel
%define builddate %(date)
%prep
tar -zxvf ../SOURCES/zthin-build.tar.gz -C ../BUILD/ --strip 1
%build
make
%install
make install
mkdir -p $RPM_BUILD_ROOT/usr/bin
mkdir -p $RPM_BUILD_ROOT/opt/zthin/bin
cp smcli $RPM_BUILD_ROOT/opt/zthin/bin/
chmod 755 $RPM_BUILD_ROOT/opt/zthin/bin/smcli
mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1/
cp smcli.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
mkdir -p $RPM_BUILD_ROOT/var/opt/zthin
cp config/tracing.conf $RPM_BUILD_ROOT/var/opt/zthin
cp config/settings.conf $RPM_BUILD_ROOT/var/opt/zthin
mkdir -p $RPM_BUILD_ROOT/etc/ld.so.conf.d
cp config/zthin.conf $RPM_BUILD_ROOT/etc/ld.so.conf.d
chmod -R 755 zthin/bin/*
chmod -R 755 zthin/lib/*
chmod -R 755 zthin/bin/IUCV/iucvserd
chmod -R 755 zthin/bin/IUCV/iucvserd.service
cp -rf zthin/bin/* $RPM_BUILD_ROOT/opt/zthin/bin
cp zthin/lib/* $RPM_BUILD_ROOT/opt/zthin/lib
cp zthinlogs $RPM_BUILD_ROOT/var/opt/zthin
echo "zthin version: "%{version} "Built on: "%{builddate} > $RPM_BUILD_ROOT/opt/zthin/version
make clean
%post
ln -sfd %{prefix}/bin/smcli $RPM_BUILD_ROOT/usr/bin
chmod 755 $RPM_BUILD_ROOT/usr/bin/smcli
# Create log file for zThin
mkdir -p /var/log/zthin
touch /var/log/zthin/zthin.log
# syslog located in different directories in Red Hat/SUSE
ZTHIN_LOG_HEADER="# Logging for SDK zThin"
ZTHIN_LOG="/var/log/zthin/zthin.log"
echo "Configuring syslog"
# SUSE Linux Enterprise Server
if [ -e "/etc/init.d/syslog" ]; then
# Syslog is the standard for log messages
grep ${ZTHIN_LOG} /etc/syslog.conf > /dev/null || (echo -e "\n${ZTHIN_LOG_HEADER}\nlocal5.* ${ZTHIN_LOG}" >> /etc/syslog.conf)
elif [ -e "/opt/ibm/cmo/version" ]; then
grep ${ZTHIN_LOG} /etc/rsyslog.conf > /dev/null || (echo -e "\n${ZTHIN_LOG_HEADER}\nlocal5.* ${ZTHIN_LOG}" >> /etc/rsyslog.conf)
fi
if [ -e "/etc/syslog-ng/syslog-ng.conf" ]; then
# Syslog-ng is the replacement for syslogd
grep ${ZTHIN_LOG} /etc/syslog-ng/syslog-ng.conf > /dev/null || (echo -e "\n${ZTHIN_LOG_HEADER}\n\
filter f_zthin { facility(local5); };\n\
destination zthinlog { file(\"${ZTHIN_LOG}\"); };\n\
log { source(src); filter(f_zthin); destination(zthinlog); };" >> /etc/syslog-ng/syslog-ng.conf)
fi
# Copy a zthin logrotate configuration file if it does not exist
if [ ! -f "/etc/logrotate.d/zthinlogs" ]; then
cp /var/opt/zthin/zthinlogs /etc/logrotate.d
fi
# Restart syslog
%systemd_post rsyslog.service
/sbin/ldconfig
%files
# Files provided by this package
%defattr(-,root,root)
/opt/zthin/*
%dir /opt/zthin
%dir /var/opt/zthin
%doc /usr/share/man/man1/smcli.1.gz
%config(noreplace) /var/opt/zthin/tracing.conf
%config(noreplace) /var/opt/zthin/settings.conf
%config(noreplace) /var/opt/zthin/zthinlogs
%config(noreplace) /etc/ld.so.conf.d/zthin.conf