Skip to content

Commit 6c4aac7

Browse files
Add legacy for 1.x and move new changes to current
Signed-off-by: Peter Zhu <zhujiaxi@amazon.com>
1 parent 0bc17f2 commit 6c4aac7

36 files changed

+927
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright OpenSearch Contributors
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
4+
# The OpenSearch Contributors require contributions made to
5+
# this file be licensed under the Apache-2.0 license or a
6+
# compatible open source license.
7+
8+
# deb opensearch-dashboards Makefile
9+
10+
all: install
11+
12+
install:
13+
./debmake_opensearch_dashboards_install.sh $(CURDIR)
14+
15+
clean: ;
16+
17+
distclean: clean
18+
19+
.PHONY: all clean distclean install
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright OpenSearch Contributors
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
4+
# The OpenSearch Contributors require contributions made to
5+
# this file be licensed under the Apache-2.0 license or a
6+
# compatible open source license.
7+
8+
Source: opensearch-dashboards
9+
Section: web
10+
Priority: optional
11+
Maintainer: OpenSearch Team <opensearch@amazon.com>
12+
Build-Depends: debhelper-compat (= 12)
13+
Standards-Version: 4.5.0
14+
Homepage: https://opensearch.org/
15+
16+
Package: opensearch-dashboards
17+
Architecture: any
18+
Description: Open source visualization dashboards for OpenSearch
19+
OpenSearch Dashboards is the visualization tool for data in OpenSearch
20+
For more information, see: https://opensearch.org/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
2+
Upstream-Name: opensearch-dashboards
3+
Upstream-Contact: opensearch@amazon.com
4+
Source: https://opensearch.org
5+
Files: *
6+
Copyright: OpenSearch Contributors
7+
License: Apache-2.0
8+
Licensed under the Apache License, Version 2.0 (the "License");
9+
you may not use this file except in compliance with the License.
10+
You may obtain a copy of the License at
11+
.
12+
http://www.apache.org/licenses/LICENSE-2.0
13+
.
14+
Unless required by applicable law or agreed to in writing, software
15+
distributed under the License is distributed on an "AS IS" BASIS,
16+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
See the License for the specific language governing permissions and
18+
limitations under the License.
19+
.
20+
On Debian systems, the complete text of the Apache License, Version 2
21+
can be found in "/usr/share/common-licenses/Apache-2.0".
22+
23+
Files: debian/*
24+
License: Apache-2.0
25+
Licensed under the Apache License, Version 2.0 (the "License");
26+
you may not use this file except in compliance with the License.
27+
You may obtain a copy of the License at
28+
.
29+
http://www.apache.org/licenses/LICENSE-2.0
30+
.
31+
Unless required by applicable law or agreed to in writing, software
32+
distributed under the License is distributed on an "AS IS" BASIS,
33+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34+
See the License for the specific language governing permissions and
35+
limitations under the License.
36+
.
37+
On Debian systems, the complete text of the Apache License, Version 2
38+
can be found in "/usr/share/common-licenses/Apache-2.0".
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/bash
2+
3+
# Copyright OpenSearch Contributors
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
# The OpenSearch Contributors require contributions made to
7+
# this file be licensed under the Apache-2.0 license or a
8+
# compatible open source license.
9+
10+
# deb opensearch-dashboards postinst script
11+
12+
set -e
13+
14+
echo "Running OpenSearch-Dashboards Post-Installation Script"
15+
16+
product_dir=/usr/share/opensearch-dashboards
17+
config_dir=/etc/opensearch-dashboards
18+
data_dir=/var/lib/opensearch-dashboards
19+
log_dir=/var/log/opensearch-dashboards
20+
pid_dir=/var/run/opensearch-dashboards
21+
22+
# Reload systemctl daemon
23+
if command -v systemctl > /dev/null; then
24+
systemctl daemon-reload
25+
fi
26+
27+
# Reload other configs
28+
if command -v systemd-tmpfiles > /dev/null; then
29+
systemd-tmpfiles --create opensearch-dashboards.conf
30+
fi
31+
32+
# Messages
33+
echo "### NOT starting on installation, please execute the following statements to configure opensearch-dashboards service to start automatically using systemd"
34+
echo " sudo systemctl daemon-reload"
35+
echo " sudo systemctl enable opensearch-dashboards.service"
36+
echo "### You can start opensearch-dashboards service by executing"
37+
echo " sudo systemctl start opensearch-dashboards.service"
38+
echo "### Upcoming breaking change in packaging"
39+
echo " In a future release of OpenSearch Dashboards, we plan to change the permissions associated with access to installed files"
40+
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"
41+
echo " For more information, see https://github.com/opensearch-project/opensearch-build/pull/4043"
42+
43+
# Set owner
44+
chown -R opensearch-dashboards.opensearch-dashboards ${product_dir}
45+
chown -R opensearch-dashboards.opensearch-dashboards ${config_dir}
46+
chown -R opensearch-dashboards.opensearch-dashboards ${log_dir}
47+
chown -R opensearch-dashboards.opensearch-dashboards ${data_dir}
48+
chown -R opensearch-dashboards.opensearch-dashboards ${pid_dir}
49+
50+
exit 0
51+
52+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
3+
# Copyright OpenSearch Contributors
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
# The OpenSearch Contributors require contributions made to
7+
# this file be licensed under the Apache-2.0 license or a
8+
# compatible open source license.
9+
10+
# deb opensearch-dashboards preinst script
11+
12+
set -e
13+
14+
echo "Running OpenSearch-Dashboards Pre-Installation Script"
15+
16+
# Stop existing service
17+
if command -v systemctl >/dev/null && systemctl is-active opensearch-dashboards.service >/dev/null; then
18+
echo "Stop existing opensearch-dashboards.service"
19+
systemctl --no-reload stop opensearch-dashboards.service
20+
fi
21+
22+
# Create user and group if they do not already exist.
23+
getent group opensearch-dashboards > /dev/null 2>&1 || groupadd -r opensearch-dashboards
24+
getent passwd opensearch-dashboards > /dev/null 2>&1 || \
25+
useradd -r -g opensearch-dashboards -M -s /sbin/nologin \
26+
-c "opensearch-dashboards user/group" opensearch-dashboards
27+
exit 0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
# Copyright OpenSearch Contributors
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
# The OpenSearch Contributors require contributions made to
7+
# this file be licensed under the Apache-2.0 license or a
8+
# compatible open source license.
9+
10+
# deb opensearch-dashboards prerm script
11+
12+
set -e
13+
14+
echo "Running OpenSearch-Dashboards Pre-Removal Script"
15+
16+
# Stop existing service
17+
if command -v systemctl >/dev/null && systemctl is-active opensearch-dashboards.service >/dev/null; then
18+
echo "Stop existing opensearch-dashboards.service"
19+
systemctl --no-reload stop opensearch-dashboards.service
20+
fi
21+
22+
exit 0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/make -f
2+
3+
# Copyright OpenSearch Contributors
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
# The OpenSearch Contributors require contributions made to
7+
# this file be licensed under the Apache-2.0 license or a
8+
# compatible open source license.
9+
10+
# You must remove unused comment lines for the released package.
11+
#export DH_VERBOSE = 1
12+
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
13+
#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
14+
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
15+
16+
%:
17+
dh $@
18+
19+
override_dh_builddeb:
20+
dh_builddeb -- -Zgzip
21+
22+
override_dh_gencontrol:
23+
dh_gencontrol -- -DLicense=Apache-2.0
24+
25+
#override_dh_auto_install:
26+
# dh_auto_install -- prefix=/usr
27+
28+
#override_dh_install:
29+
# dh_install --list-missing -X.pyc -X.pyo
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/bash
2+
3+
# Copyright OpenSearch Contributors
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
# The OpenSearch Contributors require contributions made to
7+
# this file be licensed under the Apache-2.0 license or a
8+
# compatible open source license.
9+
10+
# debmake opensearch-dashboards install script
11+
12+
set -ex
13+
14+
if [ -z "$1" ]; then
15+
echo "Missing curdir path"
16+
exit 1
17+
fi
18+
19+
curdir=$1
20+
product_dir=/usr/share/opensearch-dashboards
21+
config_dir=/etc/opensearch-dashboards
22+
data_dir=/var/lib/opensearch-dashboards
23+
log_dir=/var/log/opensearch-dashboards
24+
pid_dir=/var/run/opensearch-dashboards
25+
buildroot=${curdir}/debian/opensearch-dashboards
26+
27+
# Create necessary directories
28+
mkdir -p ${buildroot}
29+
mkdir -p ${buildroot}${pid_dir}
30+
mkdir -p ${buildroot}${product_dir}/assets
31+
mkdir -p ${buildroot}${product_dir}/plugins
32+
mkdir -p ${buildroot}${log_dir}
33+
34+
# Install directories/files
35+
# Service files stored in /usr/lib/systemd for pkg installation, /etc/systemd is meant for manual changes by sysadmin
36+
rm -rvf ${curdir}/etc/systemd
37+
cp -a ${curdir}/etc ${curdir}/usr ${curdir}/var ${buildroot}/
38+
chmod -c 0755 ${buildroot}${product_dir}/bin/*
39+
40+
# Symlinks (do not symlink config dir as security demo installer has dependency, if no presense it will switch to rpm/deb mode)
41+
ln -s ${data_dir} ${buildroot}${product_dir}/data
42+
ln -s ${log_dir} ${buildroot}${product_dir}/logs
43+
44+
# Change Permissions
45+
chmod -Rf a+rX,u+w,g-w,o-w ${buildroot}/*
46+
47+
exit 0

0 commit comments

Comments
 (0)