#!/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