#!/bin/bash
LIBSELINUX_VERSION=2.5-rc1
REPO=https://github.com/fedora-selinux/selinux
BRANCH=master-rc
REBASEDIR=`mktemp -d rebase.XXXXXX`
pushd $REBASEDIR
git clone $REPO
pushd selinux; git checkout $BRANCH; COMMIT=`git rev-parse --verify HEAD`; popd
# prepare libselinux-rhat.patch
tar xfz ../libselinux-$LIBSELINUX_VERSION.tar.gz
pushd libselinux-$LIBSELINUX_VERSION
git init; git add .; git commit -m "init"
cp -r ../selinux/libselinux/* .
git add -A .
git diff --cached --src-prefix=libselinux-$LIBSELINUX_VERSION/ --dst-prefix=libselinux-$LIBSELINUX_VERSION/ > ../../libselinux-rhat.patch
popd
popd
# echo rm -rf $REBASEDIR
echo libselinux-rhat.patch created from $REPO/commit/$COMMIT