#!/bin/bash
#
#	Fake running a with privilege. If we cant fake it, prompt the user.
#
#	Copyright (c) Mbedthis Software LLC, 2003-2007. All Rights Reserved.
#
################################################################################

if [ `id -u` = 0 ] ; then
	sh -c "$*"
else
	if type fakeroot >/dev/null 2>&1 ; then
		fakeroot $*
	elif type sudo >/dev/null 2>&1 ; then
		echo
		PASS_PROMPT="Root privilege required, please enter the root password: "
		sudo -S -p "$PASS_PROMPT" sh -c "$*"
	else
		sh -c "$*"
	fi
fi
