Skip to content

Commit

Permalink
Add legacy for 1.x and move new changes to current
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Zhu <[email protected]>
  • Loading branch information
peterzhuamazon committed Mar 13, 2024
1 parent 0bc17f2 commit 6c4aac7
Show file tree
Hide file tree
Showing 36 changed files with 927 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# 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 Makefile

all: install

install:
./debmake_opensearch_dashboards_install.sh $(CURDIR)

clean: ;

distclean: clean

.PHONY: all clean distclean install
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 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.

Source: opensearch-dashboards
Section: web
Priority: optional
Maintainer: OpenSearch Team <[email protected]>
Build-Depends: debhelper-compat (= 12)
Standards-Version: 4.5.0
Homepage: https://opensearch.org/

Package: opensearch-dashboards
Architecture: any
Description: Open source visualization dashboards for OpenSearch
OpenSearch Dashboards is the visualization tool for data in OpenSearch
For more information, see: https://opensearch.org/
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: opensearch-dashboards
Upstream-Contact: [email protected]
Source: https://opensearch.org
Files: *
Copyright: OpenSearch Contributors
License: Apache-2.0
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.
.
On Debian systems, the complete text of the Apache License, Version 2
can be found in "/usr/share/common-licenses/Apache-2.0".

Files: debian/*
License: Apache-2.0
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.
.
On Debian systems, the complete text of the Apache License, Version 2
can be found in "/usr/share/common-licenses/Apache-2.0".
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/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 postinst script

set -e

echo "Running OpenSearch-Dashboards Post-Installation Script"

product_dir=/usr/share/opensearch-dashboards
config_dir=/etc/opensearch-dashboards
data_dir=/var/lib/opensearch-dashboards
log_dir=/var/log/opensearch-dashboards
pid_dir=/var/run/opensearch-dashboards

# Reload systemctl daemon
if command -v systemctl > /dev/null; then
systemctl daemon-reload
fi

# Reload other configs
if command -v systemd-tmpfiles > /dev/null; then
systemd-tmpfiles --create opensearch-dashboards.conf
fi

# Messages
echo "### NOT starting on installation, please execute the following statements to configure opensearch-dashboards service to start automatically using systemd"
echo " sudo systemctl daemon-reload"
echo " sudo systemctl enable opensearch-dashboards.service"
echo "### You can start opensearch-dashboards service by executing"
echo " sudo systemctl start opensearch-dashboards.service"
echo "### Upcoming breaking change in packaging"
echo " In a future release of OpenSearch Dashboards, we plan to change the permissions associated with access to installed files"
echo " If you are configuring tools that require read access to the OpenSearch Dashboards configuration files, we recommend you add the user that runs these tools to the 'opensearch-dashboards' group"
echo " For more information, see https://github.com/opensearch-project/opensearch-build/pull/4043"

# Set owner
chown -R opensearch-dashboards.opensearch-dashboards ${product_dir}
chown -R opensearch-dashboards.opensearch-dashboards ${config_dir}
chown -R opensearch-dashboards.opensearch-dashboards ${log_dir}
chown -R opensearch-dashboards.opensearch-dashboards ${data_dir}
chown -R opensearch-dashboards.opensearch-dashboards ${pid_dir}

exit 0


Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/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
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/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 prerm script

set -e

echo "Running OpenSearch-Dashboards Pre-Removal 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

exit 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/make -f

# 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.

# You must remove unused comment lines for the released package.
#export DH_VERBOSE = 1
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

%:
dh $@

override_dh_builddeb:
dh_builddeb -- -Zgzip

override_dh_gencontrol:
dh_gencontrol -- -DLicense=Apache-2.0

#override_dh_auto_install:
# dh_auto_install -- prefix=/usr

#override_dh_install:
# dh_install --list-missing -X.pyc -X.pyo
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/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.

# debmake opensearch-dashboards install script

set -ex

if [ -z "$1" ]; then
echo "Missing curdir path"
exit 1
fi

curdir=$1
product_dir=/usr/share/opensearch-dashboards
config_dir=/etc/opensearch-dashboards
data_dir=/var/lib/opensearch-dashboards
log_dir=/var/log/opensearch-dashboards
pid_dir=/var/run/opensearch-dashboards
buildroot=${curdir}/debian/opensearch-dashboards

# Create necessary directories
mkdir -p ${buildroot}
mkdir -p ${buildroot}${pid_dir}
mkdir -p ${buildroot}${product_dir}/assets
mkdir -p ${buildroot}${product_dir}/plugins
mkdir -p ${buildroot}${log_dir}

# Install directories/files
# Service files stored in /usr/lib/systemd for pkg installation, /etc/systemd is meant for manual changes by sysadmin
rm -rvf ${curdir}/etc/systemd
cp -a ${curdir}/etc ${curdir}/usr ${curdir}/var ${buildroot}/
chmod -c 0755 ${buildroot}${product_dir}/bin/*

# Symlinks (do not symlink config dir as security demo installer has dependency, if no presense it will switch to rpm/deb mode)
ln -s ${data_dir} ${buildroot}${product_dir}/data
ln -s ${log_dir} ${buildroot}${product_dir}/logs

# Change Permissions
chmod -Rf a+rX,u+w,g-w,o-w ${buildroot}/*

exit 0
Loading

0 comments on commit 6c4aac7

Please sign in to comment.