#!/bin/bash # Copyright OpenSearch Contributors # SPDX-License-Identifier: Apache-2.0 # # The OpenSearch Contributors require contributions made to # this file be licensed under the Apache-2.0 license or a # compatible open source license. # deb opensearch-dashboards preinst script set -e echo "Running OpenSearch-Dashboards Pre-Installation Script" # Stop existing service if command -v systemctl >/dev/null && systemctl is-active opensearch-dashboards.service >/dev/null; then echo "Stop existing opensearch-dashboards.service" systemctl --no-reload stop opensearch-dashboards.service fi # Create user and group if they do not already exist. getent group opensearch-dashboards > /dev/null 2>&1 || groupadd -r opensearch-dashboards getent passwd opensearch-dashboards > /dev/null 2>&1 || \ useradd -r -g opensearch-dashboards -M -s /sbin/nologin \ -c "opensearch-dashboards user/group" opensearch-dashboards exit 0