--- /dev/null
+#!/usr/bin/bash
+
+### Constants ###
+HASH=`mkpasswd -l 6 -s 0`
+DATE=`date | cut -f1,2,3,6 -d" "`
+NAME=`git config --get-all user.name`
+EMAIL=`git config --get-all user.email`
+STAP_MAJOR_VERSION=`grep "Version:" systemtap.spec`
+CHANGELOG_VERSION=`echo $STAP_MAJOR_VERSION | cut -f2 -d" "`
+GIT_VERSION_TAG=`echo 0.$(git describe | rev | cut -f1,2 -d- --output-delimiter=. | rev)`
+STAP_DIR=/tmp/systemtap$HASH
+FEDSCM_DIR=/tmp/fedora-scm$HASH/
+FEDSCM_STAP_DIR=$FEDSCM_DIR/systemtap
+
+### lets do some sanity checks first
+if [ -z "$STAP_DIR" ]; then
+echo "Please set your systemtap directory variable (STAP_DIR)"
+exit
+fi
+
+if [ -z "$FEDSCM_STAP_DIR" ]; then
+echo "Please set your fedora-scm directory variable (FEDSCM_STAP_DIR)"
+echo "This is the directory used for fedora releases"
+exit
+fi
+
+if which fedpkg &>/dev/null; then
+ :
+else
+echo "Please install the fedpkg package"
+exit
+fi
+
+#Create the needed directories
+cd /tmp
+
+#Use the hash at the end to relatively ensure uniquness
+git clone git://sourceware.org/git/systemtap.git systemtap$HASH
+
+mkdir -p $FEDSCM_DIR
+cd $FEDSCM_DIR
+fedpkg co systemtap
+
+cd $STAP_DIR
+git archive --prefix=systemtap-$CHANGELOG_VERSION/ -o $FEDSCM_STAP_DIR/systemtap-$CHANGELOG_VERSION-$GIT_VERSION_TAG.tar.gz HEAD
+
+### fedpackage stuff
+
+cd $FEDSCM_STAP_DIR
+
+sed -i "s/Release: .*/Release: $GIT_VERSION_TAG\%\{\?dist\}/" systemtap.spec
+sed -i "s/Source:.*/Source: %{name}-%{version}-$GIT_VERSION_TAG.tar.gz/" systemtap.spec
+sed -i "s/\%changelog/\%changelog\n* $DATE $NAME <$EMAIL> - $CHANGELOG_VERSION-$GIT_VERSION_TAG\n- Automated weekly rawhide release\n/" systemtap.spec
+
+echo "Please ensure that you have an up to date fedoraproject SSL certificate, you can achieve this by running fedora-cert -n"
+
+fedpkg new-sources systemtap-$CHANGELOG_VERSION-$GIT_VERSION_TAG.tar.gz
+
+fedpkg commit -m "Automated weekly systemtap rawhide release: $GIT_VERSION_TAG" -p
+
+fedpkg build
+
+# cleanup
+rm -rf $STAP_DIR
+rm -rf $FEDSCM_DIR