xaizek / rocketgit (License: AGPLv3+) (since 2018-12-09)
Light and fast Git hosting solution suitable to serve both as a hub or as a personal code storage with its tickets, pull requests, API and much more.
<root> / selinux / build.sh (0a8a2e7a7acf63ce01813d47bab7ab61eb0d46c9) (1,207B) (mode 100755) [raw]
#!/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
Hints

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