Hello everyone,
time has passed, but it took me ages to find a workable solution. I did, and I'm back to share:
uses unix;
[..]
procedure rootify(rfile:string);
begin
if not FileExists(rfile) then exit;
rfile := ''''+rfile+'''';
fpSystem('osascript -e "do shell script \"sudo chmod u+s '+ rfile +'; sudo chown root '+ rfile +'; \" with administrator privileges without altering line endings" | sed ''$d''');
//Application.MessageBox(pchar('rootyfied: '+rfile),'done.',1);
end;
Some Explanation: As "Authorization framework" did not work for me, and if one looks into apples examples, it's more than complicated. What is true, is that you don't want all your application running as root, so you need a helper application to preform "admin"-tasks. But how to set the "sticky bit" (run as root, whatever user starts the application) without asking the user for the password? My code uses applescript to ask the user so we have nothing to do with the Authorization and it's as safe as a "setuid" can be. I hope this code well help someone!
leosok