#!/bin/sh
#
# Unregister a binary
#
set -e

if [ ! -f /etc/suid.conf ]; then
	echo "/etc/suid.conf missing. Suidmanager not configured?"
	exit 1
fi

if [ "$1" = "-s" ]; then
        shift
        PACKAGE=$1
        shift
else
        PACKAGE=".*"
fi

if [ "$1" = "" ]; then
	echo "Usage: suidunregister [-s package] <path>"
	exit 1
fi

sed </etc/suid.conf -e "\%^$PACKAGE $1%d" >/tmp/$$

cp /tmp/$$ /etc/suid.conf
rm /tmp/$$
