#!/bin/bash
# Detect distribution
distro="fedora"
if [ -r /etc/redhat-release ]; then
tmp=`cat /etc/redhat-release`
if [ "${tmp:0:41}" = "Red Hat Enterprise Linux Server release 6" ]; then
distro="redhat6"
fi
fi
echo "distro=${distro}"
if [ -z "${selinux_variants}" ]; then
selinux_variants="mls targeted minimum"
fi
if [ -z "${PRJ}" ]; then
PRJ="rocketgit"
fi
# test if we need to rebuild the policy
last_mod=`stat --format=%Y ${PRJ}.{te.tmpl,if,fc} ${distro}.sed | sort -r -n | head -n 1`
if [ -r "out/done-${distro}" ]; then
last_done=`stat --format=%Y out/done-${distro}`
else
last_done="0"
fi
if [ "${last_done}" -gt ${last_mod} ]; then
echo "No need to rebuild SELinux policy."
exit 0
fi
# Different distribution = different gen_require/rules
# Do the replacements
sed -f ${distro}.sed rocketgit.te.tmpl > rocketgit.te
# Destroy extra stuff
sed -i -e 's/@@.*@@//' rocketgit.te
for type in ${selinux_variants}; do
make NAME=${type} -f /usr/share/selinux/devel/Makefile
mkdir -p out
mv ${PRJ}.pp out/${PRJ}-${type}.pp
make NAME=${type} -f /usr/share/selinux/devel/Makefile clean
done
# Hard link identical policies (thanks, crossfire)
/usr/bin/hardlink -cv out
touch out/done
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"
Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/rocketgit
Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/rocketgit
You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a
pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master