/
install
executable file
·52 lines (43 loc) · 1.64 KB
/
install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/sh
SCRIPT_DIR=$(dirname $0)
ADDED_DIR=${SCRIPT_DIR}/added
ARTIFACTS_DIR=/tmp/artifacts
# If there is a zero-length spark tarball, find the verison in the
# name and download from Apache
fullname=$(find $ARTIFACTS_DIR -name spark-[0-9.]*\.tgz)
/bin/sh -x $SCRIPT_DIR/check_for_download $fullname
# Make a place for spark to go (dupe what's done in common in case we're standalone)
if ! [ -d $SPARK_INSTALL ]; then
mkdir -p $SPARK_INSTALL/conf
ln -sfn $SPARK_INSTALL/distro $SPARK_HOME
fi
pushd $SPARK_INSTALL
cp $fullname .
tar -zxf $(basename $fullname)
ln -s $(basename $fullname .tgz) distro
rm $(basename $fullname)
popd
# Add in the configuration files (from the common module)
pushd $SPARK_INSTALL/conf
for conf_file in *; do
if ! [ -f "$SPARK_HOME"/conf/$conf_file ]; then
echo Moving $conf_file to $SPARK_HOME/conf
mv $conf_file $SPARK_HOME/conf
else
echo Not moving $conf_file, $SPARK_HOME/conf/$conf_file already exists
fi
done
popd
# Make everything under the spark directory accessible to the group
chown 185:0 $SPARK_INSTALL/distro && chmod g+rwX $SPARK_INSTALL/distro
# Search for the spark entrypoint file and copy it to $SPARK_INSTALL
entry=$(find $SPARK_HOME/kubernetes -name entrypoint.sh)
if [ -n "$entry" ]; then
cp $entry $SPARK_INSTALL
# We have to patch the entrypoint to toggle error checking
# around the uidentry check for 2.3 (fix on the way)
sed -i '/^uidentry/i set +e' $SPARK_INSTALL/entrypoint.sh
sed -i '/^uidentry/a set -e' $SPARK_INSTALL/entrypoint.sh
# We also want to get rid of the tini invocation
sed -i "s@exec /sbin/tini -s --@exec@" $SPARK_INSTALL/entrypoint.sh
fi