Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Fun with packages

Fun with packages
Thread Tools
Ambrosia - el Presidente
Join Date: Sep 2000
Location: Rochester, NY
Status: Offline
Reply With Quote
Mar 1, 2003, 12:01 AM
 
I'm working on an Installer.app package (yes, I've read the various warnings and caveats, and have followed the file ownership/permission guidelines). What I want to install consists of an application (which will install into /Applications) and a kernel extension (which will install into /System/Library/Extensions).

The application can be installed by any user, but the kext needs root permission to install. In order to avoid ownership/permissions issues, I've created a separate installer package for the application and kernel extension.

Both of these packages work fine separately, but to make things easy for the user, I want to have just one installer package, or meta package. If I put both the "normal" and the "needs root" packages together in this one meta package, the resulting install all seems to take place as root.

The problem with this is that the ownership/permissions of application are not set to the current user, but rather because the installer has authenticated, the ownership/permissions of the application on my machine are preserved during the install.

Since each package works properly when installed separately (the kext is authenticated and installed as root, the application is installed as the current user), I can only assume that the installer looks at all of the packages in the meta package, and installs them all as root, thus preserving the ownership/permissions of the application.

This is what I *don't* want -- I want the 'kext' to have the ownership/permissions I set for it (root/wheel), but I want the application to be installed as whomever the current user is.

Is there any way to do this?
Andrew Welch / el Presidente / Ambrosia Software, Inc.
     
Mac Elite
Join Date: May 2002
Status: Offline
Reply With Quote
Mar 1, 2003, 01:09 AM
 
How about a postinstall script in the application package, which changes the ownership of the application to the current user? id -ru might do what you want, and
Code:
ps -axOuser | grep Installer | perl -e '$_=<STDIN>;s/ [0-9]* ([^ ]+) .*/\1/;print "$_";'
almost certainly will - it'll give you the username of the person who ran Installer.app, and from there you can use chmod -R.
[vash:~] banana% killall killall
Terminated
     
Mac Elite
Join Date: Feb 2001
Location: Vancouver, WA
Status: Offline
Reply With Quote
Mar 1, 2003, 01:52 AM
 
Why not just let the user drag-install the app, and use a package only for the kext?
Rick Roe
icons.cx | weblog
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Mar 1, 2003, 04:14 PM
 
Uhm... Why don't you just install the application as root:staff with g+w?
     
moki  (op)
Ambrosia - el Presidente
Join Date: Sep 2000
Location: Rochester, NY
Status: Offline
Reply With Quote
Mar 2, 2003, 12:02 AM
 
In the end, I wrote a post-install script that grabbed the current user, and chown'd the installed application (using a Perl script and $ENV{'USER'} ).

Seems like this would be a fairly common thing to do, I don't know why it requires such work to accomplish it. Ah well.

As for the other ideas presented here:

Uhm... Why don't you just install the application as root:staff with g+w?
Because it is possible the user will not be in the 'staff' group.

Why not just let the user drag-install the app, and use a package only for the kext?
Because if we're going to have an installer anyway, it seems silly to make the user jump through more hoops to get everything installed. Many people probably would also mess up the installation, either by:

1) Using only the installer, thinking it installed everything for them.

2) Only dragging the application out, and not running the installer at all.
Andrew Welch / el Presidente / Ambrosia Software, Inc.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 08:50 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2