[openbeos] Re: Sudo not the best but better than nothing

  • From: Mat Hounsell <mat_geek@xxxxxxxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Sun, 3 Jun 2007 17:47:02 -0700 (PDT)

gksudo is the gnome graphical sudo. But it has issues with how it woks (more 
like su) and a different and incompatible command line structure. 

What follows is a bash sell exert that runs a command with gui or cli sudo. 
Arguments are handled incompatibly by sudo and gksudo and so can't be provided.

setup_sudo()
{
    MSG="$NAME : Needs to run '$2' as root to $1." 
    echo "$MSG"
    if which 'gksudo' > /dev/null
    then
        if ! gksudo '--sudo-mode' -m "$MSG" -- $2
        then
            echo "$NAME" ': WARNING : gksudo cancelled or failed'
        fi                       
    else
        if ! sudo $2
        then
            echo "$NAME" ': WARNING : sudo cancelled or failed'
        fi                       
    fi
}

 
Haiku OS - Free, Open, and Fantastic: http://haiku-os.org/




      
_________________________________________________________________________________
              

How would you spend $50,000 to create a more sustainable environment in 
Australia? Go to Yahoo!7 Answers and share your idea.
http://advision.webevents.yahoo.com/aunz/lifestyle/answers/y7ans-babp_reg.html




Other related posts: