BIGTOP-1185. Spark service won't start on Debian-based platforms
Project: http://git-wip-us.apache.org/repos/asf/bigtop/repo Commit: http://git-wip-us.apache.org/repos/asf/bigtop/commit/f921de44 Tree: http://git-wip-us.apache.org/repos/asf/bigtop/tree/f921de44 Diff: http://git-wip-us.apache.org/repos/asf/bigtop/diff/f921de44 Branch: refs/heads/master Commit: f921de44527d2697a690b63cb329c1be70ce2440 Parents: b142504 Author: Sean Mackrory <[email protected]> Authored: Thu Jan 16 11:35:09 2014 -0800 Committer: Sean Mackrory <[email protected]> Committed: Tue Jan 21 12:03:39 2014 -0800 ---------------------------------------------------------------------- .../src/common/spark/install_spark.sh | 5 ++ .../src/deb/spark/spark-core.install | 5 +- .../src/deb/spark/spark-core.postinst | 1 + .../src/deb/spark/spark-core.preinst | 61 ++++++++++++++++++++ bigtop-packages/src/rpm/spark/SPECS/spark.spec | 6 -- 5 files changed, 71 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/bigtop/blob/f921de44/bigtop-packages/src/common/spark/install_spark.sh ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/common/spark/install_spark.sh b/bigtop-packages/src/common/spark/install_spark.sh index 664c271..d29dfd8 100644 --- a/bigtop-packages/src/common/spark/install_spark.sh +++ b/bigtop-packages/src/common/spark/install_spark.sh @@ -126,6 +126,11 @@ install -d -m 0755 $PREFIX/$LIB_DIR/lib install -d -m 0755 $PREFIX/$SPARK_BIN_DIR install -d -m 0755 $PREFIX/$DOC_DIR +install -d -m 0755 $PREFIX/var/lib/spark/ +install -d -m 0755 $PREFIX/var/log/spark/ +install -d -m 0755 $PREFIX/var/run/spark/ +install -d -m 0755 $PREFIX/var/run/spark/work/ + tar --wildcards -C $PREFIX/$LIB_DIR -zxf ${BUILD_DIR}/assembly/target/spark-assembly*-dist.tar.gz 'lib/*' for comp in core repl bagel mllib streaming; do http://git-wip-us.apache.org/repos/asf/bigtop/blob/f921de44/bigtop-packages/src/deb/spark/spark-core.install ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/spark/spark-core.install b/bigtop-packages/src/deb/spark/spark-core.install index 0c5a6f5..a48a222 100644 --- a/bigtop-packages/src/deb/spark/spark-core.install +++ b/bigtop-packages/src/deb/spark/spark-core.install @@ -15,4 +15,7 @@ /usr/lib/spark/spark-class /usr/lib/spark/spark-executor /usr/lib/spark/spark-shell - +/var/lib/spark/ +/var/log/spark/ +/var/run/spark/ +/var/run/spark/work/ http://git-wip-us.apache.org/repos/asf/bigtop/blob/f921de44/bigtop-packages/src/deb/spark/spark-core.postinst ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/spark/spark-core.postinst b/bigtop-packages/src/deb/spark/spark-core.postinst index 6133296..f6cca0a 100644 --- a/bigtop-packages/src/deb/spark/spark-core.postinst +++ b/bigtop-packages/src/deb/spark/spark-core.postinst @@ -20,6 +20,7 @@ case "$1" in configure) # Install config alternatives update-alternatives --install /etc/spark/conf spark-conf /etc/spark/conf.dist 30 + chown -R spark:spark /var/log/spark /var/lib/spark /var/run/spark ;; abort-upgrade|abort-remove|abort-deconfigure) http://git-wip-us.apache.org/repos/asf/bigtop/blob/f921de44/bigtop-packages/src/deb/spark/spark-core.preinst ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/spark/spark-core.preinst b/bigtop-packages/src/deb/spark/spark-core.preinst new file mode 100644 index 0000000..c8950a4 --- /dev/null +++ b/bigtop-packages/src/deb/spark/spark-core.preinst @@ -0,0 +1,61 @@ +#!/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. + +# preinst script for spark +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * <new-preinst> `install' +# * <new-preinst> `install' <old-version> +# * <new-preinst> `upgrade' <old-version> +# * <old-preinst> `abort-upgrade' <new-version> +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + install|upgrade) + if ! getent passwd spark >/dev/null; then + # Adding system user: spark . + adduser \ + --system \ + --group \ + --home /var/lib/spark \ + --gecos "Spark" \ + --shell /bin/false \ + spark >/dev/null + fi + ;; + + abort-upgrade) + ;; + + *) + echo "preinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 http://git-wip-us.apache.org/repos/asf/bigtop/blob/f921de44/bigtop-packages/src/rpm/spark/SPECS/spark.spec ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/rpm/spark/SPECS/spark.spec b/bigtop-packages/src/rpm/spark/SPECS/spark.spec index c78fa97..c646bad 100644 --- a/bigtop-packages/src/rpm/spark/SPECS/spark.spec +++ b/bigtop-packages/src/rpm/spark/SPECS/spark.spec @@ -35,7 +35,6 @@ %define pyspark_python python - # disable repacking jars %define __os_install_post %{nil} @@ -110,11 +109,6 @@ bash $RPM_SOURCE_DIR/do-component-build %install %__rm -rf $RPM_BUILD_ROOT -%__install -d -m 0755 $RPM_BUILD_ROOT/%{bin_spark}/ -%__install -d -m 0755 $RPM_BUILD_ROOT/%{_localstatedir}/lib/%{spark_name}/ -%__install -d -m 0755 $RPM_BUILD_ROOT/%{_localstatedir}/log/%{spark_name}/ -%__install -d -m 0755 $RPM_BUILD_ROOT/%{_localstatedir}/run/%{spark_name}/ -%__install -d -m 0755 $RPM_BUILD_ROOT/%{_localstatedir}/run/%{spark_name}/work/ %__install -d -m 0755 $RPM_BUILD_ROOT/%{initd_dir}/ sh $RPM_SOURCE_DIR/install_spark.sh \
