X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=dib_elements%2Fmyproduct%2Ffinalise.d%2F99-generate-binary-checksum;fp=dib_elements%2Fmyproduct%2Ffinalise.d%2F99-generate-binary-checksum;h=1668ceba277f6767abc90d6343bc232a8e11c827;hb=4ded4f2a805e9447be90751d7d4fb7e11552e545;hp=0000000000000000000000000000000000000000;hpb=3b1226294aa9e47692e15279e669d159675deeb9;p=ta%2Fbuild-tools.git diff --git a/dib_elements/myproduct/finalise.d/99-generate-binary-checksum b/dib_elements/myproduct/finalise.d/99-generate-binary-checksum new file mode 100755 index 0000000..1668ceb --- /dev/null +++ b/dib_elements/myproduct/finalise.d/99-generate-binary-checksum @@ -0,0 +1,63 @@ +#!/bin/bash +# Copyright 2019 Nokia +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then + set -x +fi +set -eu +set -o pipefail + +md5sum $(find / ! -path "/tmp/*" -executable -type f) > /root/binary_checksum.md5 +sha256sum $(find / ! -path "/tmp/*" -executable -type f) > /root/binary_checksum.sha256 + +# Remove checksum that has been modified during deployment +changed_checksums=( "resolv.conf" "mariadb.sg" "rabbitmq-server.sg" "audit.rules" "influxdb.conf" "influxdb-1" ) +for checksum in ${changed_checksums[@]} +do + sed -i "/${checksum}/d" /root/binary_checksum.md5 + sed -i "/${checksum}/d" /root/binary_checksum.sha256 +done + +# Add checksums that will be added during deployment +checksums_to_add=(\ +"/etc/openstack-dashboard/enabled/_2200_ironic.py" \ +"/etc/openstack-dashboard/enabled/_2200_ironic.pyc" \ +"/etc/openstack-dashboard/enabled/_2200_ironic.pyo" \ +"/etc/openstack-dashboard/local_settings" \ +"/etc/openstack-dashboard/nova_policy.json" \ +"/etc/openstack-dashboard/neutron_policy.json" \ +"/etc/openstack-dashboard/keystone_policy.json" \ +"/etc/openstack-dashboard/glance_policy.json" \ +"/etc/openstack-dashboard/cinder_policy.json" \ +"/etc/openstack-dashboard/cinder_policy.d/consistencygroup.yaml" \ +"/etc/openstack-dashboard/nova_policy.d/api-extensions.yaml" \ +) +for f in ${checksums_to_add[@]}; do + if test -f ${f}; then + md5sum ${f} >> /root/binary_checksum.md5 + sha256sum ${f} >> /root/binary_checksum.sha256 + fi +done + +# Include docker images +docker_images=$( find /var/lib/crf-images/docker-images/infra/ -type f ) || : +if [ -n "${docker_images}" ]; then + md5sum ${docker_images} >> /root/binary_checksum.md5 + sha256sum ${docker_images} >> /root/binary_checksum.sha256 +fi + +# Sort the checksum files +sort -k2 -o /root/binary_checksum.md5 /root/binary_checksum.md5 +sort -k2 -o /root/binary_checksum.sha256 /root/binary_checksum.sha256