summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMin Kang <min1023.kang@samsung.com>2021-08-04 17:12:36 +0900
committerMin Kang <min1023.kang@samsung.com>2021-08-05 16:36:08 +0900
commit9e30bb892ef92bfdcf698a4e760bd9eb8a4ba651 (patch)
tree8cfe65e372a5fff491a7be5af566f139e8edd545
parent9edc25e638c278b7530cd54dca23fd05df06c76e (diff)
downloaddocker-engine-9e30bb892ef92bfdcf698a4e760bd9eb8a4ba651.tar.gz
docker-engine-9e30bb892ef92bfdcf698a4e760bd9eb8a4ba651.tar.bz2
docker-engine-9e30bb892ef92bfdcf698a4e760bd9eb8a4ba651.zip
packaging: refactoring build spec
- remove unnecessry Requires and install command - using install_service macro - using TZ_SYS_ETC instead of /opt/etc - add service restart when install Change-Id: I221de4f7b1f1c0b5598bd460789b93d62377e72c
-rw-r--r--packaging/docker-engine.spec64
-rw-r--r--systemd/docker-engine.service (renamed from packaging/docker-engine.service)0
-rw-r--r--systemd/docker-engine.socket (renamed from packaging/docker-engine.socket)0
3 files changed, 37 insertions, 27 deletions
diff --git a/packaging/docker-engine.spec b/packaging/docker-engine.spec
index 5703397..c929014 100644
--- a/packaging/docker-engine.spec
+++ b/packaging/docker-engine.spec
@@ -6,14 +6,19 @@ Group: Tools/Docker
License: ASL 2.0
ExclusiveArch: armv7l aarch64
-Source0: %{name}.tar.gz
+Source0: %{name}-%{version}.tar.gz
Source1: %{name}.manifest
-Source2: %{name}.service
-Source3: %{name}.socket
-Requires(post): /sbin/ldconfig
-Requires(postun): /sbin/ldconfig
+BuildRequires: pkgconfig(libtzplatform-config)
+Requires(post): systemd
+Requires(preun): systemd
+
+%ifarch aarch64
+%define ARCH aarch64
+%else
+%define ARCH armv7l
+%endif
%define unpackdir source
%description
@@ -37,34 +42,39 @@ chmod g-w %_sourcedir/*
cp %{SOURCE1} ./%{name}.manifest
mkdir -p %{unpackdir}
-tar -xvf prebuilt/docker-%{version}-%{_arch}.tgz -C %{unpackdir}
-
-cp %{SOURCE2} ./%{name}.services
-cp %{SOURCE3} ./%{name}.socket
+tar -xvf prebuilt/docker-%{version}-%{ARCH}.tgz -C %{unpackdir}
%install
-rm -rf %{buildroot}
# install binary
-install -d $RPM_BUILD_ROOT/%{_bindir}
-install -p -m 755 %{unpackdir}/docker/* $RPM_BUILD_ROOT/%{_bindir}
-mkdir -p %{buildroot}/opt/etc/docker
-mkdir -p %{buildroot}/usr/lib/systemd/system/multi-user.target.wants
-mkdir -p %{buildroot}/usr/lib/systemd/system/sockets.target.wants
-install -m 0644 %SOURCE2 %{buildroot}/usr/lib/systemd/system/%{name}.service
-ln -s ../%{name}.service %{buildroot}/usr/lib/systemd/system/multi-user.target.wants/
-install -m 0644 %SOURCE3 %{buildroot}/usr/lib/systemd/system/%{name}.socket
-ln -s ../%{name}.socket %{buildroot}/usr/lib/systemd/system/sockets.target.wants/
+install -d %{buildroot}%{_bindir}
+install -m 755 %{unpackdir}/docker/* %{buildroot}%{_bindir}
+# prepare sysconf directories
+install -d %{buildroot}%{_sysconfdir}
+install -d %{buildroot}%{TZ_SYS_ETC}/docker
+ln -sf %{TZ_SYS_ETC}/docker %{buildroot}%{_sysconfdir}/docker
+# install systemd services
+install -d %{buildroot}%{_unitdir}
+install -m 0644 systemd/%{name}.service %{buildroot}%{_unitdir}/%{name}.service
+install -m 0644 systemd/%{name}.socket %{buildroot}%{_unitdir}/%{name}.socket
+%install_service multi-user.target.wants %{name}.service
+%install_service sockets.target.wants %{name}.socket
%post
-ln -s /opt/etc/docker /etc/docker
+systemctl daemon-reload
+systemctl restart %{name}.service
+
+%preun
+systemctl stop %{name}.service
+systemctl daemon-reload
%files
%manifest %{name}.manifest
%defattr(-,root,root,-)
-/%{_bindir}/*
-%license ./LICENSE
-/opt/etc/docker
-/usr/lib/systemd/system/%{name}.service
-/usr/lib/systemd/system/multi-user.target.wants/%{name}.service
-/usr/lib/systemd/system/%{name}.socket
-/usr/lib/systemd/system/sockets.target.wants/%{name}.socket
+%license LICENSE
+%{_bindir}/*
+%{_sysconfdir}/docker
+%dir %{TZ_SYS_ETC}/docker
+%{_unitdir}/%{name}.service
+%{_unitdir}/multi-user.target.wants/%{name}.service
+%{_unitdir}/%{name}.socket
+%{_unitdir}/sockets.target.wants/%{name}.socket
diff --git a/packaging/docker-engine.service b/systemd/docker-engine.service
index 6bf60c7..6bf60c7 100644
--- a/packaging/docker-engine.service
+++ b/systemd/docker-engine.service
diff --git a/packaging/docker-engine.socket b/systemd/docker-engine.socket
index d3d4d13..d3d4d13 100644
--- a/packaging/docker-engine.socket
+++ b/systemd/docker-engine.socket