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

Click here to return to the 'bug in rc script' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
bug in rc script
Authored by: John on Dec 23, '00 12:19:25AM
The problem with the solution as presented above by robg is that, when the rc script detects that swapdir does not exist, it both mounts the disk and creates the directory. If the swapdir was on a previously umounted disk, then a new directory (with a number appended) gets created. The new directory is local on / and not on the desired physical drive. I worked around the problem by skipping steps 6. and 7. Instead just replace
swapdir=/private/var/vm # Make sure the swapfile exists if [ ! -d ${swapdir} ]; then ConsoleMessage "Creating default swap directory" mount -uw / mkdir -p -m 755 ${swapdir} chown root:wheel ${swapdir} else rm -rf ${swapdir}/swap* fi
swapdir=/disk-name/path_to_swap_directory # Make sure the swapfile exists, # first check existence # if not first make sure disk is mounted if [ ! -d ${swapdir} ]; then ConsoleMessage "mounting directories" mount -t hfs /dev/disk**** /disk-name mount -uw / fi # Make sure the swapfile exists, # if not, create directory since disk should be mouned if [ ! -d ${swapdir} ]; the ConsoleMessage "Creating default swap directory" mkdir -p -m 755 ${swapdir} chown root:wheel ${swapdir} else rm -rf ${swapdir}/swap* fi

[ Reply to This | # ]
Nice find...
Authored by: robg on Dec 23, '00 01:03:03AM

Thanks for finding the bug in the script! As I said at the end, I hadn't tried it myself yet due to
a lack of extra hard drive space (and hard drives in general!). Patpro (who wrote the how-to)
has said it was working fine on his machine, but I can see how your changes will make
it a safer script. Thanks again for the fix!

[ Reply to This | # ]