iSulad.spec 7.3 KB
Newer Older
L
lifeng68 已提交
1 2
%global _version 2.0.5
%global _release 20200903.171615.gitf8400084
O
overweight 已提交
3 4 5 6
%global is_systemd 1

Name:      iSulad
Version:   %{_version}
Z
zhuchunyi 已提交
7
Release:   %{_release}
O
overweight 已提交
8
Summary:   Lightweight Container Runtime Daemon
9
License:   Mulan PSL v2
L
LiuHao 已提交
10
URL:       isulad
L
LiFeng 已提交
11
Source:    iSulad-2.0.tar.gz
Z
zhuchunyi 已提交
12 13
BuildRoot: {_tmppath}/iSulad-%{version}
ExclusiveArch:  x86_64 aarch64
O
overweight 已提交
14 15 16

%ifarch x86_64 aarch64
Provides:       libhttpclient.so()(64bit)
L
LiuHao 已提交
17
Provides:       libisula.so()(64bit)
Z
Zhangxiaoyu 已提交
18
Provides:       libisulad_img.so()(64bit)
O
overweight 已提交
19 20 21 22 23 24 25 26 27 28 29 30 31
%endif

%if 0%{?is_systemd}
# Systemd 230 and up no longer have libsystemd-journal
BuildRequires: pkgconfig(systemd)
Requires: systemd-units
%else
Requires(post): chkconfig
Requires(preun): chkconfig
# This is for /sbin/service
Requires(preun): initscripts
%endif

H
haozi007 已提交
32
BuildRequires: cmake gcc-c++ lxc lxc-devel lcr-devel yajl-devel clibcni-devel
W
wujing 已提交
33
BuildRequires: grpc grpc-plugins grpc-devel protobuf-devel
34
BuildRequires: libcurl libcurl-devel sqlite-devel libarchive-devel device-mapper-devel
H
haozi007 已提交
35
BuildRequires: http-parser-devel
W
wujing 已提交
36
BuildRequires: libseccomp-devel libcap-devel libselinux-devel libwebsockets libwebsockets-devel
H
haozi007 已提交
37
BuildRequires: systemd-devel git
O
overweight 已提交
38

39
Requires:      lcr lxc clibcni
H
haozi007 已提交
40
Requires:      grpc protobuf
O
openeuler-iSula 已提交
41
Requires:      libcurl
O
overweight 已提交
42
Requires:      sqlite http-parser libseccomp
43
Requires:      libcap libselinux libwebsockets libarchive device-mapper
H
haozi007 已提交
44
Requires:      systemd
O
overweight 已提交
45 46 47 48 49 50

%description
This is a umbrella project for gRPC-services based Lightweight Container
Runtime Daemon, written by C.

%prep
Z
zhuchunyi 已提交
51
%autosetup -c -n iSulad-%{version}
O
overweight 已提交
52 53 54 55

%build
mkdir -p build
cd build
Y
YoungJQ 已提交
56
%cmake -DDEBUG=ON -DLIB_INSTALL_DIR=%{_libdir} -DCMAKE_INSTALL_PREFIX=/usr ../
O
overweight 已提交
57 58 59 60 61 62
%make_build

%install
rm -rf %{buildroot}
cd build
install -d $RPM_BUILD_ROOT/%{_libdir}
L
LiuHao 已提交
63
install -m 0644 ./src/libisula.so             %{buildroot}/%{_libdir}/libisula.so
L
lifeng68 已提交
64 65
install -m 0644 ./src/utils/http/libhttpclient.so  %{buildroot}/%{_libdir}/libhttpclient.so
install -m 0644 ./src/daemon/modules/image/libisulad_img.so   %{buildroot}/%{_libdir}/libisulad_img.so
Y
YoungJQ 已提交
66 67 68
chmod +x %{buildroot}/%{_libdir}/libisula.so
chmod +x %{buildroot}/%{_libdir}/libhttpclient.so
chmod +x %{buildroot}/%{_libdir}/libisulad_img.so
O
overweight 已提交
69 70

install -d $RPM_BUILD_ROOT/%{_libdir}/pkgconfig
L
LiuHao 已提交
71
install -m 0640 ./conf/isulad.pc              %{buildroot}/%{_libdir}/pkgconfig/isulad.pc
O
overweight 已提交
72 73

install -d $RPM_BUILD_ROOT/%{_bindir}
L
LiuHao 已提交
74
install -m 0755 ./src/isula                  %{buildroot}/%{_bindir}/isula
75
install -m 0755 ./src/isulad-shim            %{buildroot}/%{_bindir}/isulad-shim
L
LiuHao 已提交
76
install -m 0755 ./src/isulad                  %{buildroot}/%{_bindir}/isulad
O
overweight 已提交
77

L
LiuHao 已提交
78
install -d $RPM_BUILD_ROOT/%{_includedir}/isulad
79
install -m 0644 ../src/client/libisula.h			%{buildroot}/%{_includedir}/isulad/libisula.h
80
install -m 0644 ../src/client/connect/isula_connect.h		%{buildroot}/%{_includedir}/isulad/isula_connect.h
L
lifeng68 已提交
81 82
install -m 0644 ../src/utils/cutils/utils_timestamp.h			%{buildroot}/%{_includedir}/isulad/utils_timestamp.h
install -m 0644 ../src/utils/cutils/error.h				%{buildroot}/%{_includedir}/isulad/error.h
L
lifeng68 已提交
83
install -m 0644 ../src/daemon/modules/runtime/engines/engine.h			%{buildroot}/%{_includedir}/isulad/engine.h
L
lifeng68 已提交
84
install -m 0644 ../src/daemon/modules/api/image_api.h         %{buildroot}/%{_includedir}/isulad/image_api.h
O
overweight 已提交
85 86 87 88 89

install -d $RPM_BUILD_ROOT/%{_sysconfdir}/isulad
install -m 0640 ../src/contrib/config/daemon.json           %{buildroot}/%{_sysconfdir}/isulad/daemon.json
install -m 0640 ../src/contrib/config/seccomp_default.json  %{buildroot}/%{_sysconfdir}/isulad/seccomp_default.json

L
LiuHao 已提交
90 91 92 93
install -d $RPM_BUILD_ROOT/%{_sysconfdir}/default/isulad
install -m 0640 ../src/contrib/config/config.json           %{buildroot}/%{_sysconfdir}/default/isulad/config.json
install -m 0640 ../src/contrib/config/systemcontainer_config.json           %{buildroot}/%{_sysconfdir}/default/isulad/systemcontainer_config.json
install -m 0550 ../src/contrib/sysmonitor/isulad-check.sh        %{buildroot}/%{_sysconfdir}/default/isulad/isulad-check.sh
O
overweight 已提交
94 95 96 97

mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/sysmonitor/process
cp ../src/contrib/sysmonitor/isulad-monit $RPM_BUILD_ROOT/etc/sysmonitor/process

L
LiuHao 已提交
98 99
install -d $RPM_BUILD_ROOT/%{_sysconfdir}/default/isulad/hooks
install -m 0640 ../src/contrib/config/hooks/default.json %{buildroot}/%{_sysconfdir}/default/isulad/hooks/default.json
O
overweight 已提交
100 101 102 103 104 105

install -d $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig
install -p -m 0640 ../src/contrib/config/iSulad.sysconfig $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/iSulad

%if 0%{?is_systemd}
install -d $RPM_BUILD_ROOT/%{_unitdir}
L
LiuHao 已提交
106
install -p -m 0640 ../src/contrib/init/isulad.service $RPM_BUILD_ROOT/%{_unitdir}/isulad.service
O
overweight 已提交
107 108
%else
install -d $RPM_BUILD_ROOT/%{_initddir}
L
LiuHao 已提交
109
install -p -m 0640 ../src/contrib/init/isulad.init $RPM_BUILD_ROOT/%{_initddir}/isulad.init
O
overweight 已提交
110 111 112 113 114
%endif

%clean
rm -rf %{buildroot}

L
LiuHao 已提交
115 116
%pre
# support update from lcrd to isulad, will remove in next version
H
haozi007 已提交
117
if [ "$1" = "2" ]; then
L
LiuHao 已提交
118 119 120 121 122 123 124 125 126
%if 0%{?is_systemd}
systemctl stop lcrd
systemctl disable lcrd
if [ -e %{_sysconfdir}/isulad/daemon.json ];then
    sed -i 's#/etc/default/lcrd/hooks#/etc/default/isulad/hooks#g' %{_sysconfdir}/isulad/daemon.json
fi
%else
/sbin/chkconfig --del lcrd
%endif
H
haozi007 已提交
127
fi
L
LiuHao 已提交
128

O
overweight 已提交
129
%post
L
LiuHao 已提交
130 131
if ! getent group isulad > /dev/null; then
    groupadd --system isulad
O
overweight 已提交
132 133 134 135
fi

if [ "$1" = "1" ]; then
%if 0%{?is_systemd}
L
LiuHao 已提交
136 137
systemctl enable isulad
systemctl start isulad
O
overweight 已提交
138
%else
L
LiuHao 已提交
139
/sbin/chkconfig --add isulad
O
overweight 已提交
140 141 142
%endif
elif [ "$1" = "2" ]; then
%if 0%{?is_systemd}
L
LiuHao 已提交
143 144 145 146 147 148
# support update from lcrd to isulad, will remove in next version
if [ -e %{_unitdir}/lcrd.service.rpmsave ]; then
    mv %{_unitdir}/lcrd.service.rpmsave %{_unitdir}/isulad.service
    sed -i 's/lcrd/isulad/g' %{_unitdir}/isulad.service
fi
systemctl status isulad | grep 'Active:' | grep 'running'
O
overweight 已提交
149
if [ $? -eq 0 ]; then
L
LiuHao 已提交
150 151 152
  systemctl restart isulad
else
  systemctl start isulad
O
overweight 已提交
153 154
fi
%else
L
LiuHao 已提交
155
/sbin/service isulad status | grep 'Active:' | grep 'running'
O
overweight 已提交
156
if [ $? -eq 0 ]; then
L
LiuHao 已提交
157
  /sbin/service isulad restart
O
overweight 已提交
158 159 160 161
fi
%endif
fi

L
LiuHao 已提交
162 163
if ! getent group isulad > /dev/null; then
    groupadd --system isulad
O
overweight 已提交
164 165 166 167
fi

%preun
%if 0%{?is_systemd}
L
LiuHao 已提交
168
%systemd_preun isulad
O
overweight 已提交
169 170
%else
if [ $1 -eq 0 ] ; then
L
LiuHao 已提交
171 172
    /sbin/service isulad stop >/dev/null 2>&1
    /sbin/chkconfig --del isulad
O
overweight 已提交
173 174 175 176 177
fi
%endif

%postun
%if 0%{?is_systemd}
L
LiuHao 已提交
178
%systemd_postun_with_restart isulad
O
overweight 已提交
179 180
%else
if [ "$1" -ge "1" ] ; then
L
LiuHao 已提交
181
    /sbin/service isulad condrestart >/dev/null 2>&1 || :
O
overweight 已提交
182 183 184 185 186
fi
%endif

%files
%attr(0600,root,root) %{_sysconfdir}/sysmonitor/process/isulad-monit
L
LiuHao 已提交
187
%attr(0550,root,root) %{_sysconfdir}/default/isulad/isulad-check.sh
O
overweight 已提交
188
%defattr(0640,root,root,0750)
Z
zhuchunyi 已提交
189
%{_sysconfdir}/isulad
O
overweight 已提交
190 191 192 193
%{_sysconfdir}/isulad/*
%{_sysconfdir}/default/*
%defattr(-,root,root,-)
%if 0%{?is_systemd}
L
LiuHao 已提交
194 195
%{_unitdir}/isulad.service
%attr(0640,root,root) %{_unitdir}/isulad.service
O
overweight 已提交
196
%else
L
LiuHao 已提交
197 198
%{_initddir}/isulad.init
%attr(0640,root,root) %{_initddir}/isulad.init
O
overweight 已提交
199
%endif
L
LiuHao 已提交
200
%{_includedir}/isulad/*
O
overweight 已提交
201
%attr(0755,root,root) %{_libdir}/pkgconfig
L
LiuHao 已提交
202
%attr(0640,root,root) %{_libdir}/pkgconfig/isulad.pc
O
overweight 已提交
203 204 205 206 207 208 209 210 211
%defattr(0550,root,root,0750)
%{_bindir}/*
%{_libdir}/*
%attr(0640,root,root) %{_sysconfdir}/sysconfig/iSulad
%attr(0640,root,root) %{_sysconfdir}/isulad/daemon.json

%config(noreplace,missingok) %{_sysconfdir}/sysconfig/iSulad
%config(noreplace,missingok) %{_sysconfdir}/isulad/daemon.json
%if 0%{?is_systemd}
L
LiuHao 已提交
212
%config(noreplace,missingok) %{_unitdir}/isulad.service
O
overweight 已提交
213
%else
L
LiuHao 已提交
214
%config(noreplace,missingok) %{_initddir}/isulad.init
O
overweight 已提交
215
%endif
Y
YoungJQ 已提交
216 217 218 219 220 221 222

%changelog
* Mon Aug 03 2020 openEuler Buildteam <buildteam@openeuler.org> - 2.0.3-20200803.130854.git0c7dc28a
- Type:enhancement
- ID:NA
- SUG:NA
- DESC: add debug packages