File caasp-tools.spec of Package caasp-tools

#
# spec file for package caasp-tools
#
# Copyright (c) 2017 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#


Name:           caasp-tools
Version:        0.18
Release:        0
Summary:        Files and Scripts for SUSE CaaS Platform
License:        GPL-2.0+
Group:          Development/Tools/Other
Source0:        MicroOS-tools-%{version}.tar.bz2
Source1:        create_autoyast_profile.pl
Source2:        COPYING
BuildRequires:  distribution-release
BuildRequires:  dracut
BuildRequires:  systemd
Requires:       perl-JSON
#only needed as directory owners
# Requires:       distribution-release systemd udev
Requires:       util-linux
Requires(post): awk
%{?systemd_requires}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%description
Files, scripts and directories for SUSE Containers as a Service Platform.

%prep
%setup -q -n MicroOS-tools-%{version}

%build

%install
cp -a * %{buildroot}
mkdir -p %{buildroot}%{_sbindir}
install %{SOURCE1} %{buildroot}%{_sbindir}/create_autoyast_profile
mkdir -p %{buildroot}%{_localstatedir}/adm/netconfig
mkdir -p %{buildroot}%{_localstatedir}/lib/overlay
mkdir -p %{buildroot}%{_localstatedir}/lib/overlay/etc
mkdir -p %{buildroot}%{_localstatedir}/lib/overlay/work-etc
mkdir -p %{buildroot}%{_localstatedir}/lib/overlay/netconfig
mkdir -p %{buildroot}%{_localstatedir}/lib/overlay/work-netconfig
mkdir -p %{buildroot}%{_localstatedir}/lib/overlay/apparmor
mkdir -p %{buildroot}%{_localstatedir}/lib/overlay/work-apparmor
mkdir -p %{buildroot}%{_mandir}/man8
pod2man %{SOURCE1} > %{buildroot}%{_mandir}/man8/create_autoyast_profile.8
mkdir -p %{buildroot}%{_docdir}/%{name}
install -D -m644 %{SOURCE2} %{buildroot}%{_docdir}/%{name}/COPYING
%if ! 0%{?is_susecaasp}
mkdir -p %{buildroot}/usr/share/caasp-container-manifests
echo -e "#!/bin/bash\ntrue" > %{buildroot}%{_datadir}/caasp-container-manifests/activate.sh
chmod 755 %{buildroot}%{_datadir}/caasp-container-manifests/activate.sh
%endif

%pre
%service_add_pre adjust-cloud-cfg.service setup-salt-minion.service

%post
if [ -f /etc/fstab -a ! -f /etc/fstab.sys ]; then
  /usr/sbin/setup-fstab.sys-for-overlayfs ||:
fi
%service_add_post adjust-cloud-cfg.service setup-salt-minion.service
exit 0

%preun
%service_del_preun adjust-cloud-cfg.service setup-salt-minion.service

%postun
%service_del_postun adjust-cloud-cfg.service setup-salt-minion.service

%files
%defattr(-,root,root)
%doc %{_docdir}/%{name}
%config %{_sysconfdir}/systemd/system/systemd-firstboot.service
%{_unitdir}
%{_libexecdir}/MicroOS-firstboot
%{_libexecdir}/python*
%{_sbindir}/adjust-cloud-cfg
%{_sbindir}/create_autoyast_profile
%{_sbindir}/setup-fstab.sys-for-overlayfs
%{_mandir}/man8/create_autoyast_profile.8*
%{_localstatedir}/lib/overlay
%dir %{_localstatedir}/adm/netconfig
%{_prefix}/lib/dracut/modules.d/99SUSE_MicroOS
%if ! 0%{?is_susecaasp}
%dir %{_datadir}/caasp-container-manifests
%{_datadir}/caasp-container-manifests/activate.sh
%endif

%changelog
openSUSE Build Service is sponsored by