Added seed code for caas-security.
[ta/caas-security.git] / rpmbuild.spec
1 # Copyright 2019 Nokia
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 %define COMPONENT security
16 %define RPM_NAME caas-%{COMPONENT}
17 %define RPM_MAJOR_VERSION 1.0.0
18 %define RPM_MINOR_VERSION 1
19 %define RBAC_MANIFEST_DIR /var/lib/caas/rbac_manifests/
20
21 Name:           %{RPM_NAME}
22 Version:        %{RPM_MAJOR_VERSION}
23 Release:        %{RPM_MINOR_VERSION}%{?dist}
24 Summary:        Containers as a Service security related playbooks + manifests
25 License:        %{_platform_license}
26 BuildArch:      x86_64
27 Vendor:         %{_platform_vendor}
28 Source0:        %{name}-%{version}.tar.gz
29
30 %description
31 This rpm contains the necessary security related playbooks + manifests for the caas subsystem.
32
33 %prep
34 %autosetup
35
36 %build
37
38 %install
39 mkdir -p %{buildroot}/%{RBAC_MANIFEST_DIR}/
40 rsync -av rbac_manifests/* %{buildroot}/%{RBAC_MANIFEST_DIR}/
41
42 mkdir -p %{buildroot}/%{_playbooks_path}/
43 rsync -av ansible/playbooks/* %{buildroot}/%{_playbooks_path}/
44
45 mkdir -p %{buildroot}/%{_roles_path}/
46 rsync -av ansible/roles/* %{buildroot}/%{_roles_path}/
47
48 %files
49 %{RBAC_MANIFEST_DIR}/*
50 %{_playbooks_path}/*
51 %{_roles_path}/*
52
53
54 %preun
55
56 %post
57 mkdir -p %{_postconfig_path}/
58 ln -sf %{_playbooks_path}/rbac.yaml     %{_postconfig_path}
59 ln -sf %{_playbooks_path}/security.yaml %{_postconfig_path}
60
61
62 %postun
63 if [ $1 -eq 0 ]; then
64     rm -f %{_postconfig_path}/rbac.yaml
65     rm -f %{_postconfig_path}/security.yaml
66 fi
67
68
69 %clean
70 rm -rf ${buildroot}