Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Script has some bugs' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Script has some bugs
Authored by: Jayce on Mar 17, '02 01:48:05AM

>However, in looking at the ditto man page to try to use it instead, it looks >like it has to be run as root.

You didn't need root privileges to use ditto... You only need root privileges to copy the system tree...

>As far as the size goes, right now it takes the size reported by du -sk. I get >what you're saying (before it had a static 5MB size) but I'm not aware of a >command that will give me that information. We're probably stuck with a >guesstimate. I've increased the 'fudge factor,' currently at 1MB, to 3MB in my >copy.

I had a problem with this with a script of mine... And, the only solution I had found is to make my diskimage 20% larger of my folder... Here is the command :
sudo hdiutil create -sectors $(expr $(echo $(sudo du -sHx "$Folder")|cut -f1 -d' ') * 12 / 10) $ImageFile

>It took me a bit to figure out what you were getting at with $VOL, but if I >understand correctly, the reason that $VOL will not always be correct is that >the system will sometimes give you foo-1 if foo is already mounted, correct? In >that case, how do you know which one you want? It could be the last one, but >that's not necessarily going to be the case. :)

The only way is to use hdiutil to mount the image :
MOUNT_POINT=$(sudo hdiutil mount -verbose $ImageFile | grep "/Volumes" |sed -e "s#</{0,1}string>##g")

>In any case, the script is a good starting point, and illustrates one of the >cool things that can happen when you bring Unix to the Mac OS.

Sure, it is a good start...



[ Reply to This | # ]