RE: how to check for file in the user's Documents
I'm clearly missing something. When I use su, the installer hangs because it's waiting for the password for the user to be entered. I can see that when I enter su in terminal as well--it asks for the password too. Also, if I could just install the folder directly into the user's Documents folder, I wouldn't even need to run a script. If that's possible, what's the syntax for the "Destination" in PackageMaker? I've tried a variety of things (~, $USER, $HOME), but those efforts just set up a folder labeled ~ or $USER or $HOME on the hard drive. Sorry to be so clueless, but I obviously am and seriously need help! Thanks, Ann -----Original Message----- From: Stephane Sudre [mailto:dev.iceberg@gmail.com] Sent: Sunday, July 29, 2012 3:18 AM To: Ann K. Blombach Cc: installer-dev@lists.apple.com Subject: Re: how to check for file in the user's Documents Assuming you are installing items in both / and ~, the usual solution is from the postinstall script to run the commands that needs to be run as the current user with sudo -c. /usr/bin/su $USER -c "/bin/mkdir your_parameters" On Sun, Jul 29, 2012 at 12:47 AM, Ann K. Blombach <ann@macgamut.com> wrote:
Thanks for the suggestion. I actually realized this morning that I could do that, and it did indeed solve the problem.
But now I have a new problem. I really want to create a work folder in the user's Documents, but I end up with a folder that won't allow the user to write to the files in that folder, which is useless for what's supposed to be the user's work folder. The "system" has read/write privileges, and that's it. (Yes, I know the user *should* be able to set up his/her own work folder, but many of our users can't--if the installer can do it for them, it cuts down a LOT on our tech support workload.)
I tried doing it two different ways with a script:
mkdir -m=rwxr-xr-x /${HOME}/Documents/"AppName Work Folder" and that produces a folder that isn't openable or readable by anyone.
mkdir -m=rwxrwxrwxr /${HOME}/Documents/"AppName Work Folder" and that produces the folder that only the "system" can read and write to.
I was able to use Packages (I assume that's yours, Stephane--in which case, thanks you!) to set up a usable work folder in the Users/Shared folder, but I fear with our users, that won't be of any use at all because they'll never understand how to find that folder. And my script doesn't work any better with Packages than it worked with PackageMaker.
Any help would be greatly appreciated.
Thanks, Ann
-----Original Message----- From: Stephane Sudre [mailto:dev.iceberg@gmail.com] Sent: Saturday, July 28, 2012 4:30 PM To: Ann K. Blombach Cc: installer-dev@lists.apple.com Subject: Re: how to check for file in the user's Documents
Interesting challenge from the "File exists" (JavaScript) point of view.
An alternate solution would be to use a shell script requirement (simple if [ -f ]; blah blah fi script) to check for the existence of ~/Documents/thefile.
On Fri, Jul 27, 2012 at 9:08 AM, Ann K. Blombach <ann@macgamut.com> wrote:
My installer needs to check to see whether a file is already in the user's Documents folder. How do I specify the Directory of the user's Documents folder? ${HOME}/Documents works fine for unix commands, but not in PackageMaker using the "File exists on Target" requirement, but I don't know how to specify the target) or Perl (searching for a file, but I need to know how to specify the Directory). All I need is the magic syntax that will do the same thing ${HOME}/Documents does in unix. Doesn't matter whether it's in PackageMaker or in Perl. Thanks.
-- Packaging Resources - http://s.sudre.free.fr/Packaging.html
-- Packaging Resources - http://s.sudre.free.fr/Packaging.html _______________________________________________ Do not post admin requests to the list. They will be ignored. Installer-dev mailing list (Installer-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/installer-dev/site_archiver%40lists.... This email sent to site_archiver@lists.apple.com
participants (1)
-
Ann K. Blombach