#!/bin/bash
#
#   Run a command with privilege
#
#   Copyright (c) Embedthis Software LLC, 2003-2009. All Rights Reserved.
#
################################################################################

if [ `id -u` = 0 ] ; then
    sh -c "$*"
else
    if 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
