#!/bin/sh

# Enable systemd units on target
#
# This has the effect of reloading them if they have changed.

set -e

# Config vars
SERVICE_NAME="${SERVICE_NAME:-"<%= service_name %>"}"

echo "==> Enabling systemd unit $SERVICE_NAME"
/bin/systemctl enable "${SERVICE_NAME}"

<%= if restart_method == :systemd_flag do %>
echo "==> Enabling systemd unit ${SERVICE_NAME}-restart"
/bin/systemctl enable "${SERVICE_NAME}-restart"
<% end %>

<%= if runtime_environment_service_script && runtime_environment_service_script != "" do %>
echo "==> Enabling systemd unit ${SERVICE_NAME}-runtime-environment"
/bin/systemctl enable "${SERVICE_NAME}-runtime-environment"
<% end %>
