blob: 945f055714615f637c95d60295de998b396bf306 [file] [log] [blame]
#!/bin/bash
if (return 0 2>/dev/null); then
echo "Do not source, instead run ${BASH_SOURCE[0]}" >&2
else
export INSTANCE_MODE="release"
export HOST_NAME="giggi.me"
export INSTANCE_DIR=""
export MANIFEST_F="MANIFEST.container.openssh"
export DEFANS="n"
LOG_DIR="/config/logs"
TOD_DIR="/tod"
args="${@}"
declare -ar apache_live=( code-igniter-v3-giggi pelican-subtle-giggi mdcon )
declare -ar gerrit_live=( gerrit-hooks )
declare -A CHANGE=(
[change]=""
[change-url]=""
[change-owner]=""
[change-owner-username]=""
[project]=""
[branch]=""
[topic]=""
[submitter]=""
[submitter-username]=""
[commit]=""
[newrev]=""
)
set -x
while read -a line; do
for K in ${!CHANGE[@]}; do
if [ "${line[0]}" == "--$K" ]; then
CHANGE[$K]="${line[@]:1}"
break
fi
done
done <<< $(echo -e ${args// --/\\n--})
pushd $TOD_DIR >/dev/null
case "${CHANGE[project]}" in
${apache_live[0]} | ${apache_live[1]} | ${apache_live[2]} )
./tod --upmod=apache &> $LOG_DIR/tod.hooks-upmod_apache_live.txt
;;
${gerrit_live[0]} )
./tod --upmod=gerrit &> $LOG_DIR/tod.hooks-upmod_gerrit_live.txt
;;
esac
RET=$?
popd >/dev/null
set +x
fi
[ "$RET" -eq 0 ]