Re: writing files as root from Installer Plugin
Re: writing files as root from Installer Plugin
- Subject: Re: writing files as root from Installer Plugin
- From: Mike Fischer <email@hidden>
- Date: Sat, 10 May 2008 23:05:57 +0200
Sorry for the late reply...
Am 09.05.2008 um 21:04 schrieb Toby Blake <email@hidden>:
Hi again,
I hope this is the appropriate list to send this to - it's perhaps
more of a general cocoa programming question, so feel free to direct
me elsewhere.
One thing my installer plugin needs to do is take input from the user,
validate it and write it out to a file. There's every possibility
that this file could be only writable by root on any given system, so
my plugin needs to get appropriate authorization for the user to write
this file as root.
I would not reccomend doing anything as root in an Installer Plugin.
Apart from the fact that you would need to get proper authorization
from the user (in addition to what the rest of the installer package
requires) the Installer Package runs before any installation actually
takes place.
So the user might decide to cancel the installation after the plugin
has run and expect no modifications to his system.
Getting root authorization is awkward for the user. And you would
need complicated code including a separate process as you can't
change the rights of the currently running process to root AFAIK.
Great care would need to be placed into making sure that this code
couldn't accidentily do anything bad. All in all a whole lot of
trouble for something rather ugly.
I had a similar problem for a project a while ago. Not having found
any other way to communicate information from the Installer Plugin to
the postflight script I solved it by having the plugin write a file
with a known and (hopefully) unique name (containing a UUID) to /tmp
and then parsing the content of this file in my postlight script
(which runs as root in my installer package).
By writing to /tmp I can be sure that the file will be cleaned up at
some point in time even if my code doesn't get the chance.
HTH
Mike
--
Mike Fischer Softwareentwicklung, EDV-Beratung
Schulung, Vertrieb
Note: I read this list in digest mode!
Send me a private copy for faster responses.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Installer-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden