--- /dev/null
+#!/bin/bash
+
+# Copyright 2016 RIFT.IO Inc
+#
+# Licensed 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 [ -z "$RIFT_ROOT" ]; then
+ echo RIFT_ROOT not set. please load rift-shell
+ exit 1
+fi
+
+if ! which wget >/dev/null; then
+ echo "wget not found, install it with: sudo yum install wget"
+ exit 1;
+fi
+
+cd $RIFT_ROOT
+release=$(cat RELEASE)
+if [ -f ".build/BUILD" ]; then
+ build=$(cat .build/BUILD)
+elif [ -z "$JOB_NAME" ]; then
+ echo "No Jenkins JOB_NAME"
+ printenv
+ ALT_JOB_NAME=${ENV, var="JOB_NAME"}
+ echo "ALT_JOB_NAME=${ALT_JOB_NAME}"
+ # not in Jenkins
+ build=1
+else
+ githash=$(git rev-parse HEAD)
+ branch=$(git rev-parse --abbrev-ref HEAD)
+ username=$USER
+ hostname=$(hostname -s)
+ workspace=$RIFT_ROOT
+ jobname=$JOB_NAME
+ build=$(wget -O - -o /dev/null --post-data="githash=$githash&release=$release&branch=$branch&username=$username&hostname=$hostname&workspace=$workspace&jobname=$jobname" "http://charm:8000/postbuild/")
+ if [ -z "$build" ]; then
+ echo "Wget failed, data:githash=$githash&release=$release&branch=$branch&username=$username&hostname=$hostname&workspace=$workspace&jobname=$jobname"
+ build=1
+ fi
+fi
+
+echo build is $build
+
+# used for RPM packaging
+export RIFT_BUILD_NUMBER=$build
+mkdir -p .build
+echo -n $build >.build/BUILD
+echo -n ${release}.${build} >.build/VERSION
+