File docker-container-starter.spec of Package docker-container-starter

#
# spec file for package docker-container-starter
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


Name:           docker-container-starter
Version:        0.4
Release:        1
Summary:        Helper script to start docker containers with systemd and openVSwitch
BuildArch:      noarch
Group:          System/Management
License:        GPL-3.0-only
URL:            http://martijn-goedhart.nl/projects/docker-container-starter
Source0:        docker-container.defaults
Source1:        docker-container-generator
Source2:        docker-container-ifadd
Source3:        docker-container-ifdel
Source4:        docker-container-start
Source5:        docker-container-pre@.service
Source6:        docker-container@.service
Source7:        docker-containers.target
Source99:       LICENSE

Requires:       bash
# For /usr/bin/ovs-docker
Requires:       openvswitch >= 3
# For /usr/bin/docker
Requires:       docker
# For /usr/bin/lsmem and /usr/bin/lscpu
Requires:       util-linux
# For /etc/resolv.conf
Requires:       sysconfig-netconfig
# For /usr/bin/dig
Requires:       bind-utils
# For /usr/bin/dig
Requires:       bind-utils
# For /sbin/ip
Requires:       iproute2

%{?systemd_ordering}

BuildRequires:  systemd-rpm-macros

%description
Helper systemd service files to start a docker container and connect the container to openvswitch bridge(s).

%prep
cp %{SOURCE99} LICENSE

%build

%install
install -D -m 644 %{SOURCE0} %{buildroot}%{_sysconfdir}/docker-container/docker-container.defaults
install -D -m 755 %{SOURCE1} %{buildroot}%{_bindir}/docker-container-generator
install -D -m 755 %{SOURCE2} %{buildroot}%{_bindir}/docker-container-ifadd
install -D -m 755 %{SOURCE3} %{buildroot}%{_bindir}/docker-container-ifdel
install -D -m 755 %{SOURCE4} %{buildroot}%{_bindir}/docker-container-start
install -D -m 644 %{SOURCE5} %{buildroot}%{_unitdir}/docker-container-pre@.service
install -D -m 644 %{SOURCE6} %{buildroot}%{_unitdir}/docker-container@.service
install -D -m 644 %{SOURCE7} %{buildroot}%{_unitdir}/docker-containers.target

mkdir -p %{buildroot}%{_sbindir}
ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rcdocker-containers

%pre
%service_add_pre docker-container-pre@.service docker-container@.service docker-containers.target

%post
%service_add_post docker-container-pre@.service docker-container@.service docker-containers.target

%preun
%service_del_preun docker-container-pre@.service docker-container@.service docker-containers.target

%postun
%service_del_postun docker-container-pre@.service docker-container@.service docker-containers.target

%files
%license LICENSE
%dir %{_sysconfdir}/docker-container
%config(noreplace) %{_sysconfdir}/docker-container/docker-container.defaults
%{_sbindir}/rcdocker-containers
%{_bindir}/docker-container-generator
%{_bindir}/docker-container-ifadd
%{_bindir}/docker-container-ifdel
%{_bindir}/docker-container-start
%{_unitdir}/docker-container-pre@.service
%{_unitdir}/docker-container@.service
%{_unitdir}/docker-containers.target

%changelog
openSUSE Build Service is sponsored by