On Jun 23, 2009, at 9:17 PM, Greg Neagle wrote: On Jun 23, 2009, at 6:24 PM, Peter Lee wrote: Regarding PackageMaker and setting up owners and groups
- Should I definitely do this in the temporary structure first - and not use the PackageMaker interface?
- I was thinking that I'd prefer to not set the owners and groups within my temporary package setup folder -
That's what I do - I set the owner, group and mode for all filesystem items and tell PackageMaker to leave them alone (--no-recommend via the command-line)
Several people at WWDC were surprised to find out about the "--no-recommend" option.
If you haven't typed "man packagemaker" -- you might find out something new. (And if you find a bug in the man page, file it!)
not being a *nix guru, but I think that'd mean that I'd then need to cleanup using sudo or logged in as root? Maybe that's not so bad....
Use sudo. `sudo -s` will allow you to operate as root without enabling a root login.
To clarify for the non-geeks, read this comic:
Why is that funny?
Because if you were to say in terminal (DO NOT ACTUALLY DO THIS), rm -rf /Library/Application Support/Apple/Foo, you will probably get errors that say, for instance, "Permission denied"
Saying sudo rm -rf /Library/Application Support/Apple/Foo instead, you would enter your password, and lots more things will be deleted.
Yes, even though you are entering your very same password that you logged in with.
The reason you have to enter your password is twofold: 1) It's the unix version of "are you REALLY sure?" 2) If you were to run a program/shell script, and it wanted to delete that stuff, it would ALSO have to ask for your password.
So it's a safety net and also a kind of protection against bad surprises.
Now, sudo -s is a special unix command. It changes the command prompt to "root#" instead of "user%" -- and every single command is run as root.
No second chances, no do-overs.
You can easily ruin your Mac OS X installation in less than one second if you make a typo.
That's why you don't want to use sudo -s except when you are 100% sure you know what you're doing, and you are really sure that you will not make a typo.
What I usually do is to make a file, cleanstuffup.sh, with contents like this: #!/bin/sh
# remove certain components so the iLife installer will install fresh copies sudo /bin/rm -rf /Applications/GarageBand.app sudo /bin/rm -rf /Library/Application\ Support/GarageBand/ sudo /bin/rm -rf /Library/Application\ Support/GarageBand\ Content/ sudo /bin/rm -rf /Library/Audio/Apple\ Loops/ sudo /bin/rm -rf /Library/Audio/Apple\ Loops\ Index/
(file continues for about another 100 lines)
Then I just type cleanstuffup.sh and enter my password, and it does all that, correctly, same as last time. (Unless my coworkers add lines causing Safari to open up random noisy webpages, as they are wont to do.)
Going far afield:
THE SINGLE MOST DEFINITIVE, CLASSIC, "UNIX IS EVIL" STORY
Everyone should know this story. If you don't, learn it well.
Many unix text editors, when you edit a file, will create a file with the same name, ending in ~. It will be the file before you started editing. They did this because editors (and also the humans running them) would often die (or maybe just fall asleep) and having the backup was kinda handy. (Except when your entire disk allotment is full of backups, cluttering the place up.)
So when you ls, you'd see bar bar~ directory/ foo foo~
So suppose you decided to clean up ALL these leftovers, once and for all. So you'd type: sudo rm -rf * ~
and a minute later, unix would spit out rm: ~: No such file or directory
At this point, you would usually start cursing or crying, and when you calm down, you'd start looking to see if your backups actually worked.
Because what Unix did was delete everything (the * means everything), including all your sub-directories, and THEN try to delete the file called "~".
But that file didn't exist any more, so it put up that error instead.
Because of that extra space between * and ~.
In conclusion: Don't do that.
(I never have done that. On the other hand, one time I decided to sudo mv /etc out of the way for some reason that, in retrospect, was the actually "I was being a damned idiot." Oh, I am sure I had a grandiose and eloquent explanation for doing it, espousing a reason I was completely certain was not "damnfool idiocy," but I was entirely wrong.
Note to future self: Although you CAN mv /etc to some other place, you CANNOT mv /etc back to its original location, because although the mv command is not in /etc, and the sudo command is not in /etc, the list of users authorized to use sudo is in /etc.
This and many more topics are covered in detail in this book: http://web.mit.edu/~simsong/www/ugh.pdf -- some of the words in the book came from me. Even more humorously, when the book was written in the Eighties, the esteemed professor Don Norman, PhD claimed to have left UNIX to get a Macintosh --and the Eighties Mac had its own cryptic, horrid problems -- well, now the Mac is running UNIX.
Full fathom five thy father lies; Of his bones are coral made; Those are pearls that were his eyes; Nothing of him that doth fade, But doth suffer a sea-change Into something rich and strange.
|