#!/bin/sh -e
if [ "$1" != "" ]; then
  SELINUXTYPE="$1"
else
  . /etc/selinux/config
fi

cd /usr/share/selinux/$SELINUXTYPE

echo "Updating \"$SELINUXTYPE\" policy"

semodule -b base.pp $(for n in $(semodule -s $SELINUXTYPE -l | cut -f1); do
  if [ -e $n.pp ]; then
    echo -n " -i $n.pp"
  fi
done)
