http://git-wip-us.apache.org/repos/asf/bigtop/blob/b1d707c2/bigtop-packages/src/common/ambari/ambari.defaults ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/common/ambari/ambari.defaults b/bigtop-packages/src/common/ambari/ambari.defaults new file mode 100644 index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/bigtop/blob/b1d707c2/bigtop-packages/src/common/ambari/do-component-build ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/common/ambari/do-component-build b/bigtop-packages/src/common/ambari/do-component-build new file mode 100644 index 0000000..2760f61 --- /dev/null +++ b/bigtop-packages/src/common/ambari/do-component-build @@ -0,0 +1,21 @@ +#!/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 -ex +. `dirname $0`/bigtop.bom + +export _JAVA_OPTIONS="-Xmx2048m -XX:MaxPermSize=512m -Djava.awt.headless=true" +mvn clean package -DskipTests -Drat.skip http://git-wip-us.apache.org/repos/asf/bigtop/blob/b1d707c2/bigtop-packages/src/common/ambari/install_ambari.sh ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/common/ambari/install_ambari.sh b/bigtop-packages/src/common/ambari/install_ambari.sh new file mode 100755 index 0000000..1a66af5 --- /dev/null +++ b/bigtop-packages/src/common/ambari/install_ambari.sh @@ -0,0 +1,157 @@ +#!/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 -ex + +usage() { + echo " +usage: $0 <options> + Required not-so-options: + --build-dir=DIR path to ambari dist.dir + --prefix=PREFIX path to install into + --source-dir=DIR path to the source code + " + exit 1 +} + +OPTS=$(getopt \ + -n $0 \ + -o '' \ + -l 'prefix:' \ + -l 'source-dir:' \ + -l 'distro-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 + ;; + --distro-dir) + DISTRO_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 + +install -d -m 0755 ${PREFIX} + +#Ambari Server +LIB_DIR=${LIB_DIR:-/usr/lib/ambari-server} +LIB_DIR_CLIENT=${LIB_DIR_CLIENT:-/usr/lib/ambari-client} +ETC_DIR=${ETC_DIR:-/etc/ambari-server} +CONF_DIR=${CONF_DIR:-${ETC_DIR}/conf} + +VAR_LIB_DIR=/var/lib/ambari-server +SBIN_DIR=/usr/sbin +SERVER_DIR=$BUILD_DIR/ambari-server/target/ambari-server-*-dist + +cp -ra $SERVER_DIR/* ${PREFIX}/ +cp -a $SOURCE_DIR/ambari-common/src/main/unix/ambari-python-wrap ${PREFIX}/${VAR_LIB_DIR} +rm -rf ${PREFIX}/var/lib/ambari-server/resources/stacks/HDP* +cp -r ${DISTRO_DIR}/ODPi ${PREFIX}/var/lib/ambari-server/resources/stacks/ + +# End of Ambari Server + +LIB_DIR=/usr/lib/ambari-agent +ETC_DIR=/etc/ambari-agent +VAR_LIB_DIR=/var/lib/ambari-agent + +CONF_DIR=${ETC_DIR}/conf +AGENT_BUILD_DIR=${BUILD_DIR}/ambari-agent/target/ambari-agent-* +AGENT_DEST_DIR=/usr/lib/python2.6/site-packages/ambari_agent + +cp -ra $AGENT_BUILD_DIR/* ${PREFIX}/ +cp -a $SOURCE_DIR/ambari-common/src/main/unix/ambari-python-wrap ${PREFIX}/${VAR_LIB_DIR} +rm -rf ${PREFIX}/var/lib/ambari-agent/cache/stacks/HDP* +cp -r ${DISTRO_DIR}/ODPi ${PREFIX}/var/lib/ambari-agent/cache/stacks/ + +#Ambari Groovy Client + + +PREFIX_AMBARI_CLIENT=${PREFIX}/${LIB_DIR_CLIENT} +CLIENT_BUILD_DIR=${BUILD_DIR}/ambari-client/groovy-client +SHELL_BUILD_DIR=${BUILD_DIR}/ambari-shell/ambari-groovy-shell/ + +install -d -m 0755 ${PREFIX_AMBARI_CLIENT}/lib +cp -a ${CLIENT_BUILD_DIR}/target/groovy-client*.jar ${PREFIX_AMBARI_CLIENT}/lib +cp -a ${SHELL_BUILD_DIR}/target/ambari-groovy-shell-*.jar ${PREFIX_AMBARI_CLIENT}/lib + +install -d -m 0755 ${PREFIX}/usr/bin +cat > ${PREFIX}/usr/bin/ambari-shell <<'__EOT__' +#!/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. + +# Autodetect JAVA_HOME if not defined +source /usr/lib/bigtop-utils/bigtop-detect-javahome 2>/dev/null || : + +JAVA=${JAVA:-java} +[ -n "$JAVA_HOME" ] && JAVA=${JAVA:-$JAVA_HOME/bin/java} + +$JAVA -jar /usr/lib/ambari-client/lib/ambari-groovy-shell-*.jar --ambari.server=${AMBARI_SERVER:-localhost} \ + --ambari.port=${AMBARI_PORT:-8080} \ + --ambari.user=${AMBARI_USER:-admin} \ + --ambari.password=${AMBARI_PASSWD:-admin} +__EOT__ +chmod 755 ${PREFIX}/usr/bin/ambari-shell + +#Ambari Python Client + +LIB_DIR=/usr/lib +CLIENT_BUILD_DIR=${SOURCE_DIR}/ambari-client/python-client + +#install -d -m 0755 ${PREFIX_GROOVY_CLIENT}/${LIB_DIR} +#cp -a ${CLIENT_BUILD_DIR}/src/main/python-client ${PREFIX_GROOVY_CLIENT}/${LIB_DIR} http://git-wip-us.apache.org/repos/asf/bigtop/blob/b1d707c2/bigtop-packages/src/deb/ambari/ambari-agent.install ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/ambari/ambari-agent.install b/bigtop-packages/src/deb/ambari/ambari-agent.install new file mode 100644 index 0000000..2cafa38 --- /dev/null +++ b/bigtop-packages/src/deb/ambari/ambari-agent.install @@ -0,0 +1,8 @@ +/etc/ambari-agent +/etc/init.d/ambari-agent +/usr/sbin/ambari-agent +/usr/lib/ambari-agent +/usr/lib/python2.6/site-packages/ambari_agent +/var/run/ +/var/lib/ambari-agent +/var/log/ http://git-wip-us.apache.org/repos/asf/bigtop/blob/b1d707c2/bigtop-packages/src/deb/ambari/ambari-agent.postinst ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/ambari/ambari-agent.postinst b/bigtop-packages/src/deb/ambari/ambari-agent.postinst new file mode 100755 index 0000000..ceca9be --- /dev/null +++ b/bigtop-packages/src/deb/ambari/ambari-agent.postinst @@ -0,0 +1,33 @@ +#!/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 + +if [ "$1" == "configure" ]; then # Action is install + if [ -f "/var/lib/ambari-agent/install-helper.sh" ]; then + /var/lib/ambari-agent/install-helper.sh install + fi + update-rc.d ambari-agent defaults +fi + +BAK=/etc/ambari-agent/conf/ambari-agent.ini.old +ORIG=/etc/ambari-agent/conf/ambari-agent.ini + +if [ -f $BAK ];then + if [ -f "/var/lib/ambari-agent/upgrade_agent_configs.py" ]; then + /var/lib/ambari-agent/upgrade_agent_configs.py + fi + mv $BAK ${BAK}_$(date '+%d_%m_%y_%H_%M').save +fi +exit 0 http://git-wip-us.apache.org/repos/asf/bigtop/blob/b1d707c2/bigtop-packages/src/deb/ambari/ambari-agent.postrm ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/ambari/ambari-agent.postrm b/bigtop-packages/src/deb/ambari/ambari-agent.postrm new file mode 100755 index 0000000..16d5b7c --- /dev/null +++ b/bigtop-packages/src/deb/ambari/ambari-agent.postrm @@ -0,0 +1,24 @@ +#!/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 + +if [ "$1" == "upgrade" ]; # Action is upgrade +then + if [ -d "/etc/ambari-agent/conf.save" ] + then + cp -f /etc/ambari-agent/conf.save/* /etc/ambari-agent/conf + mv /etc/ambari-agent/conf.save /etc/ambari-agent/conf_$(date '+%d_%m_%y_%H_%M').save + fi +fi http://git-wip-us.apache.org/repos/asf/bigtop/blob/b1d707c2/bigtop-packages/src/deb/ambari/ambari-agent.posttrm ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/ambari/ambari-agent.posttrm b/bigtop-packages/src/deb/ambari/ambari-agent.posttrm new file mode 100644 index 0000000..21a01fa --- /dev/null +++ b/bigtop-packages/src/deb/ambari/ambari-agent.posttrm @@ -0,0 +1,15 @@ +#!/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 http://git-wip-us.apache.org/repos/asf/bigtop/blob/b1d707c2/bigtop-packages/src/deb/ambari/ambari-agent.preinst ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/ambari/ambari-agent.preinst b/bigtop-packages/src/deb/ambari/ambari-agent.preinst new file mode 100755 index 0000000..7265c55 --- /dev/null +++ b/bigtop-packages/src/deb/ambari/ambari-agent.preinst @@ -0,0 +1,55 @@ +#!/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 + +STACKS_FOLDER="/var/lib/ambari-agent/cache/stacks" +STACKS_FOLDER_OLD=/var/lib/ambari-agent/cache/stacks_$(date '+%d_%m_%y_%H_%M').old + +COMMON_SERVICES_FOLDER="/var/lib/ambari-agent/cache/common-services" +COMMON_SERVICES_FOLDER_OLD=/var/lib/ambari-agent/cache/common-services_$(date '+%d_%m_%y_%H_%M').old + +AMBARI_ENV="/var/lib/ambari-agent/ambari-env.sh" +AMBARI_ENV_OLD="$AMBARI_ENV.rpmsave" + +if [ -d "/etc/ambari-agent/conf.save" ] +then + mv /etc/ambari-agent/conf.save /etc/ambari-agent/conf_$(date '+%d_%m_%y_%H_%M').save +fi + +BAK=/etc/ambari-agent/conf/ambari-agent.ini.old +ORIG=/etc/ambari-agent/conf/ambari-agent.ini + +BAK_SUDOERS=/etc/sudoers.d/ambari-agent.bak +ORIG_SUDOERS=/etc/sudoers.d/ambari-agent + +[ -f $ORIG ] && mv -f $ORIG $BAK +[ -f $ORIG_SUDOERS ] && echo "Moving $ORIG_SUDOERS to $BAK_SUDOERS. Please restore the file if you were using it for ambari-agent non-root functionality" && mv -f $ORIG_SUDOERS $BAK_SUDOERS + +if [ -d "$STACKS_FOLDER" ] +then + mv -f "$STACKS_FOLDER" "$STACKS_FOLDER_OLD" +fi + +if [ -d "$COMMON_SERVICES_FOLDER_OLD" ] +then + mv -f "$COMMON_SERVICES_FOLDER" "$COMMON_SERVICES_FOLDER_OLD" +fi + +if [ -f "$AMBARI_ENV" ] +then + mv -f "$AMBARI_ENV" "$AMBARI_ENV_OLD" +fi + +exit 0 http://git-wip-us.apache.org/repos/asf/bigtop/blob/b1d707c2/bigtop-packages/src/deb/ambari/ambari-agent.prerm ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/ambari/ambari-agent.prerm b/bigtop-packages/src/deb/ambari/ambari-agent.prerm new file mode 100755 index 0000000..70a9c63 --- /dev/null +++ b/bigtop-packages/src/deb/ambari/ambari-agent.prerm @@ -0,0 +1,35 @@ +#!/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 + +# WARNING: This script is performed not only on uninstall, but also +# during package update. See http://www.ibm.com/developerworks/library/l-rpm2/ +# for details + +if [ "$1" == "remove" ]; then # Action is uninstall + /usr/sbin/ambari-agent stop > /dev/null 2>&1 + if [ -d "/etc/ambari-agent/conf.save" ]; then + mv /etc/ambari-agent/conf.save /etc/ambari-agent/conf_$(date '+%d_%m_%y_%H_%M').save + fi + mv /etc/ambari-agent/conf /etc/ambari-agent/conf.save + + if [ -f "/var/lib/ambari-agent/install-helper.sh" ]; then + /var/lib/ambari-agent/install-helper.sh remove + fi + + update-rc.d -f ambari-agent remove +fi + +exit 0 http://git-wip-us.apache.org/repos/asf/bigtop/blob/b1d707c2/bigtop-packages/src/deb/ambari/ambari-client.install ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/ambari/ambari-client.install b/bigtop-packages/src/deb/ambari/ambari-client.install new file mode 100644 index 0000000..0b76f70 --- /dev/null +++ b/bigtop-packages/src/deb/ambari/ambari-client.install @@ -0,0 +1,2 @@ +/usr/lib/ambari-client +/usr/bin/ambari-shell http://git-wip-us.apache.org/repos/asf/bigtop/blob/b1d707c2/bigtop-packages/src/deb/ambari/ambari-server.install ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/ambari/ambari-server.install b/bigtop-packages/src/deb/ambari/ambari-server.install new file mode 100644 index 0000000..da52c38 --- /dev/null +++ b/bigtop-packages/src/deb/ambari/ambari-server.install @@ -0,0 +1,10 @@ +/var/lib/ambari-server/ +/etc/init.d/ambari-server +/etc/ambari-server +/usr/sbin/ambari-server.py +/usr/sbin/ambari_server_main.py +/usr/lib/python2.6/site-packages/ambari_server +/usr/lib/ambari-server +/var/run/ambari-server +/var/lib/ambari-server +/var/log/ambari-server http://git-wip-us.apache.org/repos/asf/bigtop/blob/b1d707c2/bigtop-packages/src/deb/ambari/ambari-server.postinst ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/ambari/ambari-server.postinst b/bigtop-packages/src/deb/ambari/ambari-server.postinst new file mode 100644 index 0000000..9546009 --- /dev/null +++ b/bigtop-packages/src/deb/ambari/ambari-server.postinst @@ -0,0 +1,27 @@ +#!/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 + +# Warning: don't add changes to this script directly, please add changes to install-helper.sh. + +INSTALL_HELPER="${RPM_INSTALL_PREFIX}/var/lib/ambari-server/install-helper.sh" + +if [ "$1" == "configure" ] ; then + if [ -f "$INSTALL_HELPER" ]; then + "$INSTALL_HELPER" install + fi +fi + +exit 0 http://git-wip-us.apache.org/repos/asf/bigtop/blob/b1d707c2/bigtop-packages/src/deb/ambari/ambari-server.postrm ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/ambari/ambari-server.postrm b/bigtop-packages/src/deb/ambari/ambari-server.postrm new file mode 100644 index 0000000..21a01fa --- /dev/null +++ b/bigtop-packages/src/deb/ambari/ambari-server.postrm @@ -0,0 +1,15 @@ +#!/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 http://git-wip-us.apache.org/repos/asf/bigtop/blob/b1d707c2/bigtop-packages/src/deb/ambari/ambari-server.posttrm ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/ambari/ambari-server.posttrm b/bigtop-packages/src/deb/ambari/ambari-server.posttrm new file mode 100644 index 0000000..21a01fa --- /dev/null +++ b/bigtop-packages/src/deb/ambari/ambari-server.posttrm @@ -0,0 +1,15 @@ +#!/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 http://git-wip-us.apache.org/repos/asf/bigtop/blob/b1d707c2/bigtop-packages/src/deb/ambari/ambari-server.preinst ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/ambari/ambari-server.preinst b/bigtop-packages/src/deb/ambari/ambari-server.preinst new file mode 100644 index 0000000..34af1c8 --- /dev/null +++ b/bigtop-packages/src/deb/ambari/ambari-server.preinst @@ -0,0 +1,94 @@ +#!/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 + +ROOT="${RPM_INSTALL_PREFIX}" + +STACKS_FOLDER="${ROOT}/var/lib/ambari-server/resources/stacks" +STACKS_FOLDER_OLD=${ROOT}/var/lib/ambari-server/resources/stacks_$(date '+%d_%m_%y_%H_%M').old + +COMMON_SERVICES_FOLDER="${ROOT}/var/lib/ambari-server/resources/common-services" +COMMON_SERVICES_FOLDER_OLD=${ROOT}/var/lib/ambari-server/resources/common-services_$(date '+%d_%m_%y_%H_%M').old + +AMBARI_PROPERTIES="${ROOT}/etc/ambari-server/conf/ambari.properties" +AMBARI_PROPERTIES_OLD="$AMBARI_PROPERTIES.rpmsave" + +AMBARI_ENV="${ROOT}/var/lib/ambari-server/ambari-env.sh" +AMBARI_ENV_OLD="$AMBARI_ENV.rpmsave" + +AMBARI_KRB_JAAS_LOGIN_FILE="${ROOT}/etc/ambari-server/conf/krb5JAASLogin.conf" +AMBARI_KRB_JAAS_LOGIN_FILE_OLD="$AMBARI_KRB_JAAS_LOGIN_FILE.rpmsave" + +AMBARI_VIEWS_FOLDER="${ROOT}/var/lib/ambari-server/resources/views" +AMBARI_VIEWS_BACKUP_FOLDER="$AMBARI_VIEWS_FOLDER/backups" + +AMBARI_SERVER_JAR_FILES="/usr/lib/ambari-server/ambari-server-*.jar" +AMBARI_SERVER_JAR_FILES_BACKUP_FOLDER="/usr/lib/ambari-server-backups" +SERVER_CONF_SAVE="${ROOT}/etc/ambari-server/conf.save" +SERVER_CONF_SAVE_BACKUP="${ROOT}/etc/ambari-server/conf_$(date '+%d_%m_%y_%H_%M').save" + +if [ -d "$SERVER_CONF_SAVE" ] +then + mv "$SERVER_CONF_SAVE" "$SERVER_CONF_SAVE_BACKUP" +fi + +if [ -f "$AMBARI_PROPERTIES" ] +then + mv -f "$AMBARI_PROPERTIES" "$AMBARI_PROPERTIES_OLD" +fi + +if [ -f "$AMBARI_ENV" ] +then + mv -f "$AMBARI_ENV" "$AMBARI_ENV_OLD" +fi + +if [ -f "$AMBARI_KRB_JAAS_LOGIN_FILE" ] +then + mv -f "$AMBARI_KRB_JAAS_LOGIN_FILE" "$AMBARI_KRB_JAAS_LOGIN_FILE_OLD" +fi + +if [ -d "$STACKS_FOLDER" ] +then + mv -f "$STACKS_FOLDER" "$STACKS_FOLDER_OLD" +fi + +if [ -d "$COMMON_SERVICES_FOLDER" ] +then + mv -f "$COMMON_SERVICES_FOLDER" "$COMMON_SERVICES_FOLDER_OLD" +fi + +if [ ! -d "$AMBARI_VIEWS_BACKUP_FOLDER" ] && [ -d "$AMBARI_VIEWS_FOLDER" ] +then + mkdir "$AMBARI_VIEWS_BACKUP_FOLDER" +fi + +if [ -d "$AMBARI_VIEWS_FOLDER" ] && [ -d "$AMBARI_VIEWS_BACKUP_FOLDER" ] +then + cp -u $AMBARI_VIEWS_FOLDER/*.jar $AMBARI_VIEWS_BACKUP_FOLDER/ +fi + +for f in $AMBARI_SERVER_JAR_FILES; +do + if [ -f "$f" ] + then + if [ ! -d "$AMBARI_SERVER_JAR_FILES_BACKUP_FOLDER" ] + then + mkdir -p "$AMBARI_SERVER_JAR_FILES_BACKUP_FOLDER" + fi + mv -f $f $AMBARI_SERVER_JAR_FILES_BACKUP_FOLDER/ + fi +done + +exit 0 http://git-wip-us.apache.org/repos/asf/bigtop/blob/b1d707c2/bigtop-packages/src/deb/ambari/ambari-server.prerm ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/ambari/ambari-server.prerm b/bigtop-packages/src/deb/ambari/ambari-server.prerm new file mode 100644 index 0000000..b85bd3b --- /dev/null +++ b/bigtop-packages/src/deb/ambari/ambari-server.prerm @@ -0,0 +1,27 @@ +#!/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 + +# Warning: don't add changes to this script directly, please add changes to install-helper.sh. + +INSTALL_HELPER="${RPM_INSTALL_PREFIX}/var/lib/ambari-server/install-helper.sh" + +if [ "$1" == "remove" ] ; then # Action is uninstall + if [ -f "$INSTALL_HELPER" ]; then + $INSTALL_HELPER remove + fi +fi + +exit 0 http://git-wip-us.apache.org/repos/asf/bigtop/blob/b1d707c2/bigtop-packages/src/deb/ambari/changelog ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/ambari/changelog b/bigtop-packages/src/deb/ambari/changelog new file mode 100644 index 0000000..547ed02 --- /dev/null +++ b/bigtop-packages/src/deb/ambari/changelog @@ -0,0 +1 @@ +--- This is auto-generated http://git-wip-us.apache.org/repos/asf/bigtop/blob/b1d707c2/bigtop-packages/src/deb/ambari/compat ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/ambari/compat b/bigtop-packages/src/deb/ambari/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/bigtop-packages/src/deb/ambari/compat @@ -0,0 +1 @@ +9 http://git-wip-us.apache.org/repos/asf/bigtop/blob/b1d707c2/bigtop-packages/src/deb/ambari/control ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/ambari/control b/bigtop-packages/src/deb/ambari/control new file mode 100644 index 0000000..2ca1fe5 --- /dev/null +++ b/bigtop-packages/src/deb/ambari/control @@ -0,0 +1,37 @@ +# 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. + +Source: ambari +Section: misc +Priority: extra +Maintainer: Bigtop <[email protected]> +Build-Depends: debhelper (>= 6) +Standards-Version: 3.8.0 +Homepage: http://ambari.apache.org/ + +Package: ambari-server +Architecture: all +Depends: openssl, postgresql (>= 8.1), python (>= 2.6), curl +Description: Ambari Server + +Package: ambari-agent +Architecture: all +Depends: openssl, python (>= 2.6), curl +Description: Ambari Agent + +Package: ambari-client +Architecture: all +Depends: bigtop-utils (>= 0.7) +Description: Ambari Client http://git-wip-us.apache.org/repos/asf/bigtop/blob/b1d707c2/bigtop-packages/src/deb/ambari/copyright ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/ambari/copyright b/bigtop-packages/src/deb/ambari/copyright new file mode 100644 index 0000000..f0199ed --- /dev/null +++ b/bigtop-packages/src/deb/ambari/copyright @@ -0,0 +1,15 @@ +Format: http://dep.debian.net/deps/dep5 +Source: http://ambari.apache.org/ +Upstream-Name: Ambari Project + +Files: * +Copyright: 2010-2011, The Ambari Project +License: Apache-2.0 + +Files debian/* +Copyright: 2011, The Apache Software Foundation +License: Apache-2.0 + +License: Apache-2.0 + On Debian systems, the complete text of the Apache 2.0 license + can be found in "/usr/share/common-licenses/Apache-2.0". http://git-wip-us.apache.org/repos/asf/bigtop/blob/b1d707c2/bigtop-packages/src/deb/ambari/rules ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/ambari/rules b/bigtop-packages/src/deb/ambari/rules new file mode 100644 index 0000000..3943347 --- /dev/null +++ b/bigtop-packages/src/deb/ambari/rules @@ -0,0 +1,42 @@ +#!/usr/bin/make -f + +# 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. +# -*- makefile -*- + +# Uncomment this to turn on verbose mode. +export DH_VERBOSE=1 + +# This has to be exported to make some magic below work. +export DH_OPTIONS + +%: + dh $@ + +override_dh_auto_build: + bash debian/do-component-build + +svcs=ambari-agent + +$(svcs): debian/init.d.tmpl + # bash $< debian/[email protected] deb debian/[email protected] + touch $@ + +override_dh_auto_install: $(svcs) + bash -x debian/install_ambari.sh \ + --build-dir=`pwd` \ + --distro-dir=debian \ + --source-dir=`pwd` \ + --prefix=debian/tmp http://git-wip-us.apache.org/repos/asf/bigtop/blob/b1d707c2/bigtop-packages/src/deb/ambari/source/format ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/ambari/source/format b/bigtop-packages/src/deb/ambari/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/bigtop-packages/src/deb/ambari/source/format @@ -0,0 +1 @@ +3.0 (quilt) http://git-wip-us.apache.org/repos/asf/bigtop/blob/b1d707c2/bigtop-packages/src/deb/ambari/source/include-binaries ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/deb/ambari/source/include-binaries b/bigtop-packages/src/deb/ambari/source/include-binaries new file mode 100644 index 0000000..d4ec7e3 --- /dev/null +++ b/bigtop-packages/src/deb/ambari/source/include-binaries @@ -0,0 +1 @@ +debian/ODPi/1.0/hooks/before-START/files/fast-hdfs-resource.jar http://git-wip-us.apache.org/repos/asf/bigtop/blob/b1d707c2/bigtop-packages/src/rpm/ambari/RPMS/.gitignore ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/rpm/ambari/RPMS/.gitignore b/bigtop-packages/src/rpm/ambari/RPMS/.gitignore new file mode 100644 index 0000000..1ab8c79 --- /dev/null +++ b/bigtop-packages/src/rpm/ambari/RPMS/.gitignore @@ -0,0 +1 @@ +repodata http://git-wip-us.apache.org/repos/asf/bigtop/blob/b1d707c2/bigtop-packages/src/rpm/ambari/SPECS/.gitignore ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/rpm/ambari/SPECS/.gitignore b/bigtop-packages/src/rpm/ambari/SPECS/.gitignore new file mode 100644 index 0000000..caa5471 --- /dev/null +++ b/bigtop-packages/src/rpm/ambari/SPECS/.gitignore @@ -0,0 +1,3 @@ +hadoop.spec +pig.spec +hive.spec http://git-wip-us.apache.org/repos/asf/bigtop/blob/b1d707c2/bigtop-packages/src/rpm/ambari/SPECS/ambari.spec ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/rpm/ambari/SPECS/ambari.spec b/bigtop-packages/src/rpm/ambari/SPECS/ambari.spec new file mode 100644 index 0000000..6d6be69 --- /dev/null +++ b/bigtop-packages/src/rpm/ambari/SPECS/ambari.spec @@ -0,0 +1,504 @@ +# 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. + +%define ambari_name ambari +%define _binaries_in_noarch_packages_terminate_build 0 +%define _unpackaged_files_terminate_build 0 + +%if %{?suse_version:1}0 +%define doc_ambari %{_docdir}/ambari-doc +%global initd_dir %{_sysconfdir}/rc.d +%else +%define doc_ambari %{_docdir}/ambari-doc-%{ambari_version} +%global initd_dir %{_sysconfdir}/rc.d/init.d +%endif + +# disable repacking jars +%define __os_install_post %{nil} + +Name: ambari +Version: %{ambari_version} +Release: %{ambari_release} +Summary: Ambari +URL: http://ambari.apache.org +Group: Development +BuildArch: noarch +Buildroot: %(mktemp -ud %{_tmppath}/apache-%{ambari_name}-%{version}-%{release}-XXXXXX) +License: ASL 2.0 +Source0: apache-%{ambari_name}-%{ambari_version}-src.tar.gz +Source1: do-component-build +Source2: install_%{ambari_name}.sh +Source3: bigtop.bom +# FIXME +AutoProv: no +AutoReqProv: no + +%description +Ambari + +%prep +%setup -n apache-%{ambari_name}-%{ambari_base_version}-src + +%build +bash $RPM_SOURCE_DIR/do-component-build + +%install +%__rm -rf $RPM_BUILD_ROOT +AMBARI_VERSION=%{ambari_version} bash $RPM_SOURCE_DIR/install_ambari.sh \ + --build-dir=`pwd` \ + --distro-dir=$RPM_SOURCE_DIR \ + --source-dir=`pwd` \ + --prefix=$RPM_BUILD_ROOT +%__install -d -m 0755 $RPM_BUILD_ROOT/%{initd_dir} +%__mv ${RPM_BUILD_ROOT}/etc/init.d/ambari-server ${RPM_BUILD_ROOT}/%{initd_dir} || : + +%package server +Summary: Ambari Server +Group: Development/Libraries +Requires: openssl, postgresql-server >= 8.1, python >= 2.6, curl +AutoProv: no +AutoReqProv: no +%description server +Ambari Server + +%pre server +# 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 + +STACKS_FOLDER="/var/lib/ambari-server/resources/stacks" +STACKS_FOLDER_OLD=/var/lib/ambari-server/resources/stacks_$(date '+%d_%m_%y_%H_%M').old + +COMMON_SERVICES_FOLDER="/var/lib/ambari-server/resources/common-services" +COMMON_SERVICES_FOLDER_OLD=/var/lib/ambari-server/resources/common-services_$(date '+%d_%m_%y_%H_%M').old + +AMBARI_VIEWS_FOLDER="/var/lib/ambari-server/resources/views" +AMBARI_VIEWS_BACKUP_FOLDER="$AMBARI_VIEWS_FOLDER/backups" + +if [ -d "/etc/ambari-server/conf.save" ] +then + mv /etc/ambari-server/conf.save /etc/ambari-server/conf_$(date '+%d_%m_%y_%H_%M').save +fi + +if [ -d "$STACKS_FOLDER" ] +then + mv -f "$STACKS_FOLDER" "$STACKS_FOLDER_OLD" +fi + +if [ -d "$COMMON_SERVICES_FOLDER_OLD" ] +then + mv -f "$COMMON_SERVICES_FOLDER" "$COMMON_SERVICES_FOLDER_OLD" +fi + +if [ ! -d "$AMBARI_VIEWS_BACKUP_FOLDER" ] && [ -d "$AMBARI_VIEWS_FOLDER" ] +then + mkdir "$AMBARI_VIEWS_BACKUP_FOLDER" +fi + +if [ -d "$AMBARI_VIEWS_FOLDER" ] && [ -d "$AMBARI_VIEWS_BACKUP_FOLDER" ] +then + cp -u $AMBARI_VIEWS_FOLDER/*.jar $AMBARI_VIEWS_BACKUP_FOLDER/ +fi + +exit 0 + +%post server +# 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 + +if [ -e "/usr/sbin/ambari-server" ]; then # Check is needed for upgrade + # Remove link created by previous package version + rm -f /usr/sbin/ambari-server +fi + +ln -s /etc/init.d/ambari-server /usr/sbin/ambari-server + +case "$1" in + 1) # Action install + if [ -f "/var/lib/ambari-server/install-helper.sh" ]; then + /var/lib/ambari-server/install-helper.sh install + fi + chkconfig --add ambari-server + ;; + 2) # Action upgrade + if [ -f "/var/lib/ambari-server/install-helper.sh" ]; then + /var/lib/ambari-server/install-helper.sh upgrade + fi + ;; +esac + +exit 0 + +%preun server +# 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 + +# WARNING: This script is performed not only on uninstall, but also +# during package update. See http://www.ibm.com/developerworks/library/l-rpm2/ +# for details + +if [ "$1" -eq 0 ]; then # Action is uninstall + /usr/sbin/ambari-server stop > /dev/null 2>&1 + if [ -d "/etc/ambari-server/conf.save" ]; then + mv /etc/ambari-server/conf.save /etc/ambari-server/conf_$(date '+%d_%m_%y_%H_%M').save + fi + + if [ -e "/usr/sbin/ambari-server" ]; then + # Remove link created during install + rm /usr/sbin/ambari-server + fi + + mv /etc/ambari-server/conf /etc/ambari-server/conf.save + + if [ -f "/var/lib/ambari-server/install-helper.sh" ]; then + /var/lib/ambari-server/install-helper.sh remove + fi + + chkconfig --list | grep ambari-server && chkconfig --del ambari-server +fi + +exit 0 + +%posttrans server +# 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 + + +RESOURCE_MANAGEMENT_DIR="/usr/lib/python2.6/site-packages/resource_management" +RESOURCE_MANAGEMENT_DIR_SERVER="/usr/lib/ambari-server/lib/resource_management" +JINJA_DIR="/usr/lib/python2.6/site-packages/ambari_jinja2" +JINJA_SERVER_DIR="/usr/lib/ambari-server/lib/ambari_jinja2" +AMBARI_SERVER_EXECUTABLE_LINK="/usr/sbin/ambari-server" +AMBARI_SERVER_EXECUTABLE="/etc/init.d/ambari-server" + + +# needed for upgrade though ambari-2.2.2 +rm -f "$AMBARI_SERVER_EXECUTABLE_LINK" +ln -s "$AMBARI_SERVER_EXECUTABLE" "$AMBARI_SERVER_EXECUTABLE_LINK" + +# remove RESOURCE_MANAGEMENT_DIR if it's a directory +if [ -d "$RESOURCE_MANAGEMENT_DIR" ]; then # resource_management dir exists + if [ ! -L "$RESOURCE_MANAGEMENT_DIR" ]; then # resource_management dir is not link + rm -rf "$RESOURCE_MANAGEMENT_DIR" + fi +fi +# setting resource_management shared resource +if [ ! -d "$RESOURCE_MANAGEMENT_DIR" ]; then + ln -s "$RESOURCE_MANAGEMENT_DIR_SERVER" "$RESOURCE_MANAGEMENT_DIR" +fi + +# setting jinja2 shared resource +if [ ! -d "$JINJA_DIR" ]; then + ln -s "$JINJA_SERVER_DIR" "$JINJA_DIR" +fi + +exit 0 + +%package agent +Summary: Ambari Agent +Group: Development/Libraries +Requires: openssl, zlib, python >= 2.6, rpm-python +AutoProv: no +AutoReqProv: no +%description agent +Ambari Agent + +%pre agent +# 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 + +STACKS_FOLDER="/var/lib/ambari-agent/cache/stacks" +STACKS_FOLDER_OLD=/var/lib/ambari-agent/cache/stacks_$(date '+%d_%m_%y_%H_%M').old + +COMMON_SERVICES_FOLDER="/var/lib/ambari-agent/cache/common-services" +COMMON_SERVICES_FOLDER_OLD=/var/lib/ambari-agent/cache/common-services_$(date '+%d_%m_%y_%H_%M').old + +if [ -d "/etc/ambari-agent/conf.save" ] +then + mv /etc/ambari-agent/conf.save /etc/ambari-agent/conf_$(date '+%d_%m_%y_%H_%M').save +fi + +BAK=/etc/ambari-agent/conf/ambari-agent.ini.old +ORIG=/etc/ambari-agent/conf/ambari-agent.ini + +BAK_SUDOERS=/etc/sudoers.d/ambari-agent.bak +ORIG_SUDOERS=/etc/sudoers.d/ambari-agent + +[ -f $ORIG ] && mv -f $ORIG $BAK +[ -f $ORIG_SUDOERS ] && echo "Moving $ORIG_SUDOERS to $BAK_SUDOERS. Please restore the file if you were using it for ambari-agent non-root functionality" && mv -f $ORIG_SUDOERS $BAK_SUDOERS + +if [ -d "$STACKS_FOLDER" ] +then + mv -f "$STACKS_FOLDER" "$STACKS_FOLDER_OLD" +fi + +if [ -d "$COMMON_SERVICES_FOLDER_OLD" ] +then + mv -f "$COMMON_SERVICES_FOLDER" "$COMMON_SERVICES_FOLDER_OLD" +fi + +exit 0 + +%post agent +# 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 + + +case "$1" in + 1) # Action install + if [ -f "/var/lib/ambari-agent/install-helper.sh" ]; then + /var/lib/ambari-agent/install-helper.sh install + fi + chkconfig --add ambari-agent + ;; + 2) # Action upgrade + if [ -d "/etc/ambari-agent/conf.save" ]; then + cp -f /etc/ambari-agent/conf.save/* /etc/ambari-agent/conf + mv /etc/ambari-agent/conf.save /etc/ambari-agent/conf_$(date '+%d_%m_%y_%H_%M').save + fi + + if [ -f "/var/lib/ambari-agent/install-helper.sh" ]; then + /var/lib/ambari-agent/install-helper.sh upgrade + fi + ;; +esac + + +BAK=/etc/ambari-agent/conf/ambari-agent.ini.old +ORIG=/etc/ambari-agent/conf/ambari-agent.ini + +if [ -f $BAK ]; then + if [ -f "/var/lib/ambari-agent/upgrade_agent_configs.py" ]; then + /var/lib/ambari-agent/upgrade_agent_configs.py + fi + mv $BAK ${BAK}_$(date '+%d_%m_%y_%H_%M').save +fi + + +exit 0 + +%preun agent +# 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 + +# WARNING: This script is performed not only on uninstall, but also +# during package update. See http://www.ibm.com/developerworks/library/l-rpm2/ +# for details + + +if [ "$1" -eq 0 ]; then # Action is uninstall + /usr/sbin/ambari-agent stop > /dev/null 2>&1 + if [ -d "/etc/ambari-agent/conf.save" ]; then + mv /etc/ambari-agent/conf.save /etc/ambari-agent/conf_$(date '+%d_%m_%y_%H_%M').save + fi + mv /etc/ambari-agent/conf /etc/ambari-agent/conf.save + + if [ -f "/var/lib/ambari-agent/install-helper.sh" ]; then + /var/lib/ambari-agent/install-helper.sh remove + fi + + chkconfig --list | grep ambari-server && chkconfig --del ambari-server +fi + +exit 0 + +%posttrans agent +# 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 + + +RESOURCE_MANAGEMENT_DIR="/usr/lib/python2.6/site-packages/resource_management" +RESOURCE_MANAGEMENT_DIR_AGENT="/usr/lib/ambari-agent/lib/resource_management" +JINJA_DIR="/usr/lib/python2.6/site-packages/ambari_jinja2" +JINJA_AGENT_DIR="/usr/lib/ambari-agent/lib/ambari_jinja2" + +# remove RESOURCE_MANAGEMENT_DIR if it's a directory +if [ -d "$RESOURCE_MANAGEMENT_DIR" ]; then # resource_management dir exists + if [ ! -L "$RESOURCE_MANAGEMENT_DIR" ]; then # resource_management dir is not link + rm -rf "$RESOURCE_MANAGEMENT_DIR" + fi +fi +# setting resource_management shared resource +if [ ! -d "$RESOURCE_MANAGEMENT_DIR" ]; then + ln -s "$RESOURCE_MANAGEMENT_DIR_AGENT" "$RESOURCE_MANAGEMENT_DIR" +fi + +# setting jinja2 shared resource +if [ ! -d "$JINJA_DIR" ]; then + ln -s "$JINJA_AGENT_DIR" "$JINJA_DIR" +fi + +exit 0 + +%package client +Summary: Ambari Client +Group: Development/Libraries +Requires: bigtop-utils >= 0.7 +%description client +Ambari Client + +%files server +%attr(644,root,root) /etc/init/ambari-server.conf +%defattr(644,root,root,755) +/usr/lib/ambari-server +%attr(755,root,root) /usr/sbin/ambari-server.py +%attr(755,root,root) /usr/sbin/ambari_server_main.py +%attr(755,root,root) %{initd_dir}/ambari-server +/var/lib/ambari-server +%attr(755,root,root) /var/lib/ambari-server/ambari-python-wrap +%config /etc/ambari-server/conf +%config %attr(700,root,root) /var/lib/ambari-server//ambari-env.sh +%attr(700,root,root) /var/lib/ambari-server//ambari-sudo.sh +%attr(700,root,root) /var/lib/ambari-server//install-helper.sh +%attr(700,root,root) /var/lib/ambari-server/keys/db +%attr(755,root,root) /var/lib/ambari-server/resources/stacks/stack_advisor.py +%dir %attr(755,root,root) /var/lib/ambari-server/data/tmp +%dir %attr(700,root,root) /var/lib/ambari-server/data/cache +%attr(755,root,root) /var/lib/ambari-server/resources/apps +%attr(755,root,root) /var/lib/ambari-server/resources/scripts +%attr(755,root,root) /var/lib/ambari-server/resources/views +%attr(755,root,root) /var/lib/ambari-server/resources/custom_actions +%attr(755,root,root) /var/lib/ambari-server/resources/host_scripts +%dir /var/lib/ambari-server/resources/upgrade +%dir /var/run/ambari-server +%dir /var/run/ambari-server/bootstrap +%dir /var/run/ambari-server/stack-recommendations +%dir /var/log/ambari-server +%attr(755,root,root) /usr/lib/python2.6/site-packages/ambari_server + +%files agent +%attr(644,root,root) /etc/init/ambari-agent.conf +%attr(-,root,root) /usr/lib/python2.6/site-packages/ambari_agent +%attr(755,root,root) /var/lib/ambari-agent/ambari-python-wrap +%attr(755,root,root) /var/lib/ambari-agent/ambari-sudo.sh +%attr(-,root,root) /usr/lib/ambari-agent/lib/ambari_commons +%attr(-,root,root) /usr/lib/ambari-agent/lib/resource_management +%attr(755,root,root) /usr/lib/ambari-agent/lib/ambari_jinja2 +%attr(755,root,root) /usr/lib/ambari-agent/lib/ambari_simplejson +%attr(755,root,root) /usr/lib/ambari-agent/lib/examples +%attr(755,root,root) /etc/ambari-agent/conf/ambari-agent.ini +%attr(755,root,root) /etc/ambari-agent/conf/logging.conf.sample +%attr(755,root,root) /usr/sbin/ambari-agent +%config %attr(700,root,root) /var/lib/ambari-agent/ambari-env.sh +%attr(700,root,root) /var/lib/ambari-agent/install-helper.sh +%attr(700,root,root) /var/lib/ambari-agent/upgrade_agent_configs.py +%dir %attr(755,root,root) /var/run/ambari-agent +%dir %attr(755,root,root) /var/lib/ambari-agent/data +%dir %attr(777,root,root) /var/lib/ambari-agent/tmp +%dir %attr(755,root,root) /var/lib/ambari-agent/keys +%dir %attr(755,root,root) /var/log/ambari-agent +%attr(755,root,root) /etc/init.d/ambari-agent +%attr(755,root,root) /var/lib/ambari-agent/data +%attr(755,root,root) /var/lib/ambari-agent/cache + +%files client +%defattr(644,root,root,755) +/usr/lib/ambari-client +%attr(755,root,root) /usr/bin/ambari-shell
