#!/bin/bash

set -eux

DISTRO=`lsb_release -si` || true

if [[ "RedHatEnterpriseServer CentOS Fedora" =~ "$DISTRO" ]]; then
    # This is a fix so that we can use the service file from the source install
    # with our packaged nova-baremetal-deploy-helper, which is missing the service:
    # https://bugzilla.redhat.com/show_bug.cgi?id=1055788
    os-svc-daemon -i "$NOVA_VENV_DIR" nova-baremetal-deploy-helper nova nova-baremetal-deploy-helper "--config-dir /etc/nova"

    mkdir -p $NOVA_VENV_DIR/bin/
    ln -s /bin/nova-baremetal-deploy-helper $NOVA_VENV_DIR/bin/nova-baremetal-deploy-helper
fi
