sahara-image-pack: remove bashisms from shell scripts
During image generation, some shell scripts are run inside the image (e.g. wget_repo). Those scripts are run with /bin/sh but some parts are written with Bash-specific syntax. This commit replaces those parts by sh-compliant syntaxes. Change-Id: If64b85c7b026a70c99190a2cb6487e3f1b865928 Story: #2003893 Task: #26767 Task: #26776
This commit is contained in:
parent
d89edfc7db
commit
3a2b3f63b7
|
@ -1,4 +1,4 @@
|
|||
#! /bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
hadoop="2.7.1"
|
||||
|
||||
|
@ -16,7 +16,7 @@ if [ ! -f $HDFS_LIB_DIR/$HADOOP_SWIFT_JAR_NAME ]; then
|
|||
fi
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -e "Could not download Swift Hadoop FS implementation.\nAborting"
|
||||
printf "Could not download Swift Hadoop FS implementation.\nAborting\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash -x
|
||||
#!/bin/sh
|
||||
|
||||
AMBARI_AGENT_INI="/etc/ambari-agent/conf/ambari-agent.ini"
|
||||
FORCE_HTTPS_CONF="force_https_protocol=PROTOCOL_TLSv1_2"
|
||||
|
@ -9,7 +9,7 @@ if [ $test_only -eq 0 ]; then
|
|||
sed -i '/^\[security\]/a\'${FORCE_HTTPS_CONF} ${AMBARI_AGENT_INI}
|
||||
fi
|
||||
else
|
||||
echo -e "[security]\n${FORCE_HTTPS_CONF}" >>${AMBARI_AGENT_INI}
|
||||
printf "[security]\n${FORCE_HTTPS_CONF}\n" >>${AMBARI_AGENT_INI}
|
||||
fi
|
||||
else
|
||||
grep -q "${FORCE_HTTPS_CONF}" ${AMBARI_AGENT_INI}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
# NOTE: $(dirname $0) is read-only, use space under $TARGET_ROOT
|
||||
|
@ -24,7 +24,7 @@ if [ ! -d $JAVA_LOCATION ]; then
|
|||
cd $JAVA_LOCATION
|
||||
|
||||
echo "Decompressing Java archive"
|
||||
echo -e "\n" | tar -zxf $JAVA_FILE
|
||||
printf "\n\n" | tar -zxf $JAVA_FILE
|
||||
echo "Setting up $JAVA_NAME"
|
||||
chown -R root:root $JAVA_LOCATION
|
||||
JAVA_DIR=`ls -1 $JAVA_LOCATION | grep -v tar.gz`
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
#!/bin/sh
|
||||
|
||||
hadoop="2.6.0"
|
||||
|
||||
|
@ -12,7 +12,7 @@ if [ $test_only -eq 0 ]; then
|
|||
wget -O $hdfs_lib_dir/$HADOOP_SWIFT_JAR_NAME $SWIFT_LIB_URI
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -e "Could not download Swift Hadoop FS implementation.\nAborting"
|
||||
printf "Could not download Swift Hadoop FS implementation.\nAborting\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
EXTJS_DESTINATION_DIR="/var/lib/oozie"
|
||||
EXTJS_DOWNLOAD_URL="https://tarballs.openstack.org/sahara-extra/dist/common-artifacts/ext-2.2.zip"
|
||||
|
@ -7,7 +7,7 @@ extjs_basepath=$(basename ${EXTJS_DOWNLOAD_URL})
|
|||
extjs_archive=/tmp/${extjs_basepath}
|
||||
extjs_folder="${extjs_basepath%.*}"
|
||||
|
||||
function setup_extjs {
|
||||
setup_extjs() {
|
||||
wget -O $extjs_archive $EXTJS_DOWNLOAD_URL
|
||||
mkdir -p $EXTJS_DESTINATION_DIR
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
if [ ! -f /etc/apt/sources.list.d/cdh5.list ]; then
|
||||
if [ $test_only -eq 0 ]; then
|
||||
# Add repository with postgresql package (it's dependency of cloudera packages)
|
||||
# Base image doesn't contain this repo
|
||||
echo -e 'deb http://nova.clouds.archive.ubuntu.com/ubuntu/ xenial universe multiverse main' >> /etc/apt/sources.list
|
||||
echo 'deb http://nova.clouds.archive.ubuntu.com/ubuntu/ xenial universe multiverse main' >> /etc/apt/sources.list
|
||||
|
||||
# Cloudera repositories
|
||||
echo "deb [arch=amd64] http://archive.cloudera.com/cdh5/ubuntu/xenial/amd64/cdh xenial-cdh$plugin_version contrib" > /etc/apt/sources.list.d/cdh5.list
|
||||
|
@ -21,11 +21,11 @@ if [ ! -f /etc/apt/sources.list.d/cdh5.list ]; then
|
|||
wget -qO - http://archive.cloudera.com/navigator-keytrustee5/ubuntu/xenial/amd64/navigator-keytrustee/archive.key | apt-key add -
|
||||
|
||||
# add Kafka repository
|
||||
echo -e 'deb http://archive.cloudera.com/kafka/ubuntu/xenial/amd64/kafka/ xenial-kafka2.2.0 contrib' >> /etc/apt/sources.list
|
||||
echo 'deb http://archive.cloudera.com/kafka/ubuntu/xenial/amd64/kafka/ xenial-kafka2.2.0 contrib' >> /etc/apt/sources.list
|
||||
wget -qO - https://archive.cloudera.com/kafka/ubuntu/xenial/amd64/kafka/archive.key | apt-key add -
|
||||
|
||||
#change repository priority
|
||||
echo -e 'Package: zookeeper\nPin: origin "archive.cloudera.com"\nPin-Priority: 1001' > /etc/apt/preferences.d/cloudera-pin
|
||||
printf 'Package: zookeeper\nPin: origin "archive.cloudera.com"\nPin-Priority: 1001\n' > /etc/apt/preferences.d/cloudera-pin
|
||||
|
||||
apt-get update
|
||||
else
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
#!/bin/sh
|
||||
|
||||
hadoop="2.6.0"
|
||||
|
||||
|
@ -12,7 +12,7 @@ if [ $test_only -eq 0 ]; then
|
|||
wget -O $hdfs_lib_dir/$HADOOP_SWIFT_JAR_NAME $SWIFT_LIB_URI
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -e "Could not download Swift Hadoop FS implementation.\nAborting"
|
||||
printf "Could not download Swift Hadoop FS implementation.\nAborting\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
EXTJS_DESTINATION_DIR="/var/lib/oozie"
|
||||
EXTJS_DOWNLOAD_URL="https://tarballs.openstack.org/sahara-extra/dist/common-artifacts/ext-2.2.zip"
|
||||
|
@ -7,7 +7,7 @@ extjs_basepath=$(basename ${EXTJS_DOWNLOAD_URL})
|
|||
extjs_archive=/tmp/${extjs_basepath}
|
||||
extjs_folder="${extjs_basepath%.*}"
|
||||
|
||||
function setup_extjs {
|
||||
setup_extjs() {
|
||||
wget -O $extjs_archive $EXTJS_DOWNLOAD_URL
|
||||
mkdir -p $EXTJS_DESTINATION_DIR
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
if [ ! -f /etc/apt/sources.list.d/cdh5.list ]; then
|
||||
if [ $test_only -eq 0 ]; then
|
||||
# Add repository with postgresql package (it's dependency of cloudera packages)
|
||||
# Base image doesn't contain this repo
|
||||
echo -e 'deb http://nova.clouds.archive.ubuntu.com/ubuntu/ xenial universe multiverse main' >> /etc/apt/sources.list
|
||||
echo 'deb http://nova.clouds.archive.ubuntu.com/ubuntu/ xenial universe multiverse main' >> /etc/apt/sources.list
|
||||
|
||||
# Cloudera repositories
|
||||
echo "deb [arch=amd64] http://archive.cloudera.com/cdh5/ubuntu/xenial/amd64/cdh xenial-cdh$plugin_version contrib" > /etc/apt/sources.list.d/cdh5.list
|
||||
|
@ -18,11 +18,11 @@ if [ ! -f /etc/apt/sources.list.d/cdh5.list ]; then
|
|||
wget -qO - http://archive-primary.cloudera.com/cm5/ubuntu/xenial/amd64/cm/archive.key | apt-key add -
|
||||
|
||||
# add Kafka repository
|
||||
echo -e 'deb http://archive.cloudera.com/kafka/ubuntu/xenial/amd64/kafka/ xenial-kafka2.2.0 contrib' >> /etc/apt/sources.list
|
||||
echo 'deb http://archive.cloudera.com/kafka/ubuntu/xenial/amd64/kafka/ xenial-kafka2.2.0 contrib' >> /etc/apt/sources.list
|
||||
wget -qO - https://archive.cloudera.com/kafka/ubuntu/xenial/amd64/kafka/archive.key | apt-key add -
|
||||
|
||||
#change repository priority
|
||||
echo -e 'Package: zookeeper\nPin: origin "archive.cloudera.com"\nPin-Priority: 1001' > /etc/apt/preferences.d/cloudera-pin
|
||||
printf 'Package: zookeeper\nPin: origin "archive.cloudera.com"\nPin-Priority: 1001\n' > /etc/apt/preferences.d/cloudera-pin
|
||||
|
||||
apt-get update
|
||||
else
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
#!/bin/sh
|
||||
|
||||
hadoop="2.6.0"
|
||||
|
||||
|
@ -12,7 +12,7 @@ if [ $test_only -eq 0 ]; then
|
|||
wget -O $hdfs_lib_dir/$HADOOP_SWIFT_JAR_NAME $SWIFT_LIB_URI
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -e "Could not download Swift Hadoop FS implementation.\nAborting"
|
||||
printf "Could not download Swift Hadoop FS implementation.\nAborting\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
EXTJS_DESTINATION_DIR="/var/lib/oozie"
|
||||
EXTJS_DOWNLOAD_URL="https://tarballs.openstack.org/sahara-extra/dist/common-artifacts/ext-2.2.zip"
|
||||
|
@ -7,7 +7,7 @@ extjs_basepath=$(basename ${EXTJS_DOWNLOAD_URL})
|
|||
extjs_archive=/tmp/${extjs_basepath}
|
||||
extjs_folder="${extjs_basepath%.*}"
|
||||
|
||||
function setup_extjs {
|
||||
setup_extjs() {
|
||||
wget -O $extjs_archive $EXTJS_DOWNLOAD_URL
|
||||
mkdir -p $EXTJS_DESTINATION_DIR
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
#!/bin/sh
|
||||
|
||||
hadoop="2.6.0"
|
||||
|
||||
|
@ -12,7 +12,7 @@ if [ $test_only -eq 0 ]; then
|
|||
wget -O $hdfs_lib_dir/$HADOOP_SWIFT_JAR_NAME $SWIFT_LIB_URI
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -e "Could not download Swift Hadoop FS implementation.\nAborting"
|
||||
printf "Could not download Swift Hadoop FS implementation.\nAborting\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
EXTJS_DESTINATION_DIR="/var/lib/oozie"
|
||||
EXTJS_DOWNLOAD_URL="https://tarballs.openstack.org/sahara-extra/dist/common-artifacts/ext-2.2.zip"
|
||||
|
@ -7,7 +7,7 @@ extjs_basepath=$(basename ${EXTJS_DOWNLOAD_URL})
|
|||
extjs_archive=/tmp/${extjs_basepath}
|
||||
extjs_folder="${extjs_basepath%.*}"
|
||||
|
||||
function setup_extjs {
|
||||
setup_extjs() {
|
||||
wget -O $extjs_archive $EXTJS_DOWNLOAD_URL
|
||||
mkdir -p $EXTJS_DESTINATION_DIR
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
# NOTE: $(dirname $0) is read-only, use space under $TARGET_ROOT
|
||||
|
@ -25,7 +25,7 @@ if [ ! -d $JAVA_LOCATION ]; then
|
|||
cd $JAVA_LOCATION
|
||||
|
||||
echo "Decompressing Java archive"
|
||||
echo -e "\n" | tar -zxf $JAVA_FILE
|
||||
printf "\n\n" | tar -zxf $JAVA_FILE
|
||||
echo "Setting up $JAVA_NAME"
|
||||
chown -R root:root $JAVA_LOCATION
|
||||
JAVA_DIR=`ls -1 $JAVA_LOCATION | grep -v tar.gz`
|
||||
|
|
Loading…
Reference in New Issue