Skip to content

Commit

Permalink
Chnages
Browse files Browse the repository at this point in the history
  • Loading branch information
Akanksha-kedia committed Mar 5, 2024
2 parents 835a0d2 + fb05502 commit 2e73cd5
Show file tree
Hide file tree
Showing 3 changed files with 134 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bigtop-packages/src/common/ranger/install_ranger.sh
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ else
COMPONENT_LIB_DIR=${PREFIX}/${RANGER_COMPONENT_DIR}/tomcat/webapps/kylin/WEB-INF/lib
elif [ "${RANGER_COMPONENT}" = "elasticsearch" ]; then
COMPONENT_LIB_DIR=${PREFIX}/${RANGER_COMPONENT_DIR}/plugins
elif [ "${RANGER_COMPONENT}" = "presto" ]; then
elif [ "${RANGER_COMPONENT}" = "trino" ]; then
COMPONENT_LIB_DIR=${PREFIX}/${RANGER_COMPONENT_DIR}/plugin/ranger
if [ ! -d "${COMPONENT_LIB_DIR}" ]; then
echo "INFO: Creating ${COMPONENT_LIB_DIR}"
Expand Down
13 changes: 9 additions & 4 deletions bigtop-packages/src/rpm/ranger/SPECS/ranger.spec
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
%define usr_lib_sqoop %{parent_dir}/usr/lib/sqoop
%define usr_lib_kylin %{parent_dir}/usr/lib/kylin
%define usr_lib_elasticsearch %{parent_dir}/usr/lib/elasticsearch
%define usr_lib_presto %{parent_dir}/usr/lib/presto
%define usr_lib_trino %{parent_dir}/usr/lib/trino

%define doc_dir %{parent_dir}/%{_docdir}

Expand Down Expand Up @@ -409,17 +409,22 @@ AutoReq: no
%description elasticsearch-plugin
Ranger ELASTICSEARCH plugin component runs within elasticsearch to provide enterprise security using ranger framework

%package presto-plugin
Summary: ranger plugin for presto
%package trino-plugin
Summary: ranger plugin for trino
Group: System/Daemons
# On Rocky 8, find-requires picks up /usr/bin/python, but it's not provided by any package.
# So installing ranger-*-plugin fails with a "nothing provides /usr/bin/python" message,
# even when python3 is installed and /usr/bin/python is created as a symlink to python3.
# Therefore we disable find-requires for each plugins with the following option.
AutoReq: no

<<<<<<< HEAD
%description presto-plugin
Ranger presto plugin component runs within presto to provide enterprise security using ranger framework
=======
%description trino-plugin
Ranger trino plugin component runs within trino to provide enterprise security using ranger framework
>>>>>>> fb055028b8c3541998e92f1066ff7a3eb3c0666a


%prep
Expand All @@ -438,7 +443,7 @@ bash %{SOURCE1}
#########################
%install
%__rm -rf $RPM_BUILD_ROOT
for comp in admin usersync kms tagsync hdfs-plugin yarn-plugin hive-plugin hbase-plugin knox-plugin storm-plugin kafka-plugin atlas-plugin sqoop-plugin solr-plugin kylin-plugin elasticsearch-plugin presto-plugin
for comp in admin usersync kms tagsync hdfs-plugin yarn-plugin hive-plugin hbase-plugin knox-plugin storm-plugin kafka-plugin atlas-plugin sqoop-plugin solr-plugin kylin-plugin elasticsearch-plugin trino-plugin
do
env RANGER_VERSION=%{ranger_base_version} /bin/bash %{SOURCE2} \
--prefix=$RPM_BUILD_ROOT \
Expand Down
124 changes: 124 additions & 0 deletions install_trino.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
#!/bin/bash

# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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.

set -e

usage() {
echo "
usage: $0 <options>
Required not-so-options:
--build-dir=DIR path to dist.dir
--source-dir=DIR path to package shared files dir
--prefix=PREFIX path to install into
Optional options:
--doc-dir=DIR path to install docs into [/usr/share/doc/trino]
--lib-dir=DIR path to install trino home [/usr/lib/trino]
--installed-lib-dir=DIR path where lib-dir will end up on target system
--bin-dir=DIR path to install bins [/usr/bin]
... [ see source for more similar options ]
"
exit 1
}

OPTS=$(getopt \
-n $0 \
-o '' \
-l 'prefix:' \
-l 'lib-dir:' \
-l 'installed-lib-dir:' \
-l 'bin-dir:' \
-l 'trino-version:' \
-l 'source-dir:' \
-l 'cli-dir:' \
-l 'build-dir:' -- "$@")

if [ $? != 0 ] ; then
usage
fi

eval set -- "$OPTS"
while true ; do
case "$1" in
--prefix)
PREFIX=$2 ; shift 2
;;
--build-dir)
BUILD_DIR=$2 ; shift 2
;;
--source-dir)
SOURCE_DIR=$2 ; shift 2
;;
--cli-dir)
CLI_BUILD_DIR=$2 ; shift 2
;;
--lib-dir)
LIB_DIR=$2 ; shift 2
;;
--installed-lib-dir)
INSTALLED_LIB_DIR=$2 ; shift 2
;;
--bin-dir)
BIN_DIR=$2 ; shift 2
;;
--)
shift ; break
;;
*)
echo "Unknown option: $1"
usage
exit 1
;;
esac
done

for var in PREFIX BUILD_DIR SOURCE_DIR ; do
if [ -z "$(eval "echo \$$var")" ]; then
echo Missing param: $var
usage
fi
done

if [ -f "$SOURCE_DIR/bigtop.bom" ]; then
. $SOURCE_DIR/bigtop.bom
fi

MAN_DIR=${MAN_DIR:-/usr/share/man}/man1
DOC_DIR=${DOC_DIR:-/usr/share/doc/trino}
CLI_DIR=${CLI_DIR:-/usr/lib/trino-cli}
LIB_DIR=${TRINO_DIR:-/usr/lib/trino}
VAR_DIR=${VAR_DIR:-/var/lib/trino}
LOG_DIR=${LOG_DIR:-/var/log/trino}
RUN_DIR=${RUN_DIR:-/var/run/trino}
INSTALLED_LIB_DIR=${INSTALLED_LIB_DIR:-/usr/lib/trino}
BIN_DIR=${BIN_DIR:-/usr/bin}
CONF_DIR=${CONF_DIR:-/etc/trino}
CONF_DIST_DIR=${CONF_DIST_DIR:-/etc/trino.dist}
DEFAULT_DIR=${DEFAULT_DIR:-/etc/default}

install -d -m 0755 $PREFIX/$CONF_DIST_DIR
install -d -m 0755 $PREFIX/$LIB_DIR
install -d -m 0755 $PREFIX/$CLI_DIR
install -d -m 0755 $PREFIX/$DOC_DIR
install -d -m 0755 $PREFIX/$VAR_DIR
install -d -m 0755 $PREFIX/$LOG_DIR
install -d -m 0755 $PREFIX/$RUN_DIR
install -d -m 0755 $PREFIX/$DEFAULT_DIR

cp -ra ${BUILD_DIR}/* $PREFIX/$LIB_DIR/
cp -ra ${CLI_BUILD_DIR}/* $PREFIX/$CLI_DIR/

chmod +x $PREFIX/$LIB_DIR/bin/launcher

0 comments on commit 2e73cd5

Please sign in to comment.