syscontainer-tools/syscontainer-tools.spec

146 lines
4.0 KiB
RPMSpec
Raw Normal View History

2019-09-30 10:53:51 -04:00
#Basic Information
Name: syscontainer-tools
Version: 0.9
Release: 52
Summary: syscontainer tools for IT, work with iSulad
License: Mulan PSL v2
URL: https://gitee.com/openeuler/syscontainer-tools
Source0: https://gitee.com/openeuler/syscontainer-tools/repository/archive/v%{version}.tar.gz
2019-09-30 10:53:51 -04:00
BuildRoot: %{_tmppath}/%{name}-root
Patch1: 0001-fix-failed-build-with-golang-1.15.5.patch
Patch2: 0002-syscontainer-tools-build-security-option.patch
Patch3: 0003-enable-external-linkmode-for-cgo-build.patch
2022-10-17 17:11:39 +08:00
Patch4: 0004-add-dt-test.patch
Patch5: 0005-syscontainer-tools-Add-sw64-architecture.patch
2019-09-30 10:53:51 -04:00
#Dependency
BuildRequires: glibc-static
BuildRequires: golang > 1.6
Requires: iSulad
Requires: util-linux
%description
This is syscontainer tools, to make it work, you need a isulad and util-linux
2019-09-30 10:53:51 -04:00
#Build sections
%prep
%autosetup -n %{name}-v%{version} -p1
%ifnarch sw_64
%patch5 -R -p1
%endif
2019-09-30 10:53:51 -04:00
%build
make init && make
%install
HOOK_DIR=$RPM_BUILD_ROOT/var/lib/isulad/hooks
2019-09-30 10:53:51 -04:00
ISULAD_TOOLS_DIR=$RPM_BUILD_ROOT/usr/local/bin
ISULAD_TOOLS_WRAPPER=$RPM_BUILD_ROOT/lib/udev
mkdir -p -m 0700 ${HOOK_DIR}
mkdir -p -m 0750 ${ISULAD_TOOLS_DIR}
mkdir -p -m 0750 ${ISULAD_TOOLS_WRAPPER}
install -m 0750 build/syscontainer-hooks ${HOOK_DIR}
install -m 0750 build/syscontainer-tools ${ISULAD_TOOLS_DIR}
install -m 0750 hack/syscontainer-tools_wrapper ${ISULAD_TOOLS_WRAPPER}/syscontainer-tools_wrapper
2019-09-30 10:53:51 -04:00
2022-10-17 17:11:39 +08:00
%check
make localtest
2019-09-30 10:53:51 -04:00
#Install and uninstall scripts
%pre
%preun
%post
GRAPH=`isula info | grep -Eo "iSulad Root Dir:.+" | grep -Eo "\/.*"`
2019-09-30 10:53:51 -04:00
if [ "$GRAPH" == "" ]; then
GRAPH="/var/lib/isulad"
2019-09-30 10:53:51 -04:00
fi
if [[ "$GRAPH" != "/var/lib/isulad" ]]; then
2019-09-30 10:53:51 -04:00
mkdir -p -m 0550 $GRAPH/hooks
install -m 0550 -p /var/lib/isulad/hooks/syscontainer-hooks $GRAPH/hooks
2019-09-30 10:53:51 -04:00
echo
echo "=================== WARNING! ================================================"
echo " 'iSulad Root Dir' is $GRAPH, move /var/lib/isulad/hooks/syscontainer-hooks to $GRAPH/hooks"
2019-09-30 10:53:51 -04:00
echo "============================================================================="
echo
fi
HOOK_SPEC=/etc/syscontainer-tools
2019-09-30 10:53:51 -04:00
HOOK_DIR=${GRAPH}/hooks
mkdir -p -m 0750 ${HOOK_SPEC}
mkdir -p -m 0550 ${HOOK_DIR}
cat << EOF > ${HOOK_SPEC}/hookspec.json
{
"prestart": [
{
"path": "${HOOK_DIR}/syscontainer-hooks",
"args": ["syscontainer-hooks", "--state", "prestart"],
2019-09-30 10:53:51 -04:00
"env": []
}
],
"poststart":[
{
"path": "${HOOK_DIR}/syscontainer-hooks",
"args": ["syscontainer-hooks", "--state", "poststart"],
2019-09-30 10:53:51 -04:00
"env": []
}
],
"poststop":[
{
"path": "${HOOK_DIR}/syscontainer-hooks",
"args": ["syscontainer-hooks", "--state", "poststop"],
2019-09-30 10:53:51 -04:00
"env": []
}
]
}
EOF
chmod 0640 ${HOOK_SPEC}/hookspec.json
%postun
#Files list
%files
%defattr(0550,root,root,0550)
/usr/local/bin/syscontainer-tools
%attr(0550,root,root) /var/lib/isulad/hooks
%attr(0550,root,root) /var/lib/isulad/hooks/syscontainer-hooks
%attr(0550,root,root) /lib/udev/syscontainer-tools_wrapper
2019-09-30 10:53:51 -04:00
#Clean section
%clean
rm -rfv %{buildroot}
%changelog
* Thu Nov 17 2022 yangjiaqi<yangjiaqi16@huawei.com> - 0.9-52
- fix source
* Thu Oct 27 2022 wuzx<wuzx1226@qq.com> - 0.9-51
- Add sw64 architecture
2022-10-17 17:11:39 +08:00
* Mon Oct 17 2022 vegbir <yangjiaqi16@huawei.com> - 0.9-50
- add dt-test
* Thu Sep 02 2021 zhangsong234 <zhangsong34@huawei.com> - 0.9-49
- DESC: enable external linkmode for cgo build
2021-07-30 23:37:01 +08:00
* Fri Jul 30 2021 chenyanpanHW <chenyanpan@huawei.com> - 0.9-48
- DESC: delete -Sgit from %autosetup
* Mon Feb 08 2021 zhangsong234<zhangsong34@huawei.com> - 0.9-47
- update version to 0.9-47
* Wed Dec 23 2020 wangkang101<873229877@qq.com> - 0.9-3
- fix failed build with golang 1.15.5
* Mon Sep 07 2020 wangkang101<873229877@qq.com> - 0.9-2
- modify url of source0
* Tue Apr 26 2020 Zhangsong<zhangsong34@huawei.com> - 0.9-1
- release version 0.9