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


Click here to return to the 'A tad more elegant solution using patch' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A tad more elegant solution using patch
Authored by: peterhil on Sep 25, '03 02:23:53PM

I struggled quite a bit to make this work.

The first problem was that there appeared backslashes before every quote in the scripts in /Library/StartupItems/ISharing directory for some odd reason (copy in Safari paste in Vim?).

You can make sure there are no syntax errors in the scripts by issuing command: sudo SystemStarter -nv

The -n option is for "don't actually perform action on items (no-run mode)". Option -d is debug, which gives you a more detailed output.

Secondly, as the previous poster wrote, newer versions of Jaguar (I'm using 10.2.8 now) will overwrite the file /var/db/SystemConfiguration/com.apple.nat.xml on startup to indicate that the Internet Sharing is not enabled.

In order to enable Internet Sharing at startup, you must change the file in startup script to indicate that Internet Sharing should be enabled. I did this by using diff and patch like this:

  1. Ensure that Internet Sharing is off using the Sharing pane in System Preferences
  2. Make a copy of the com.apple.nat.xml file:
    cd /var/db/SystemConfiguration/
    sudo cp com.apple.nat.xml nat.off
  3. Enable Internet sharing in System Preferences
  4. Make context patchfile from differences of the two files (Diff can't write output to SystemConfiguration directory, so I used home directory for temporary location):
    diff -c1 nat.off com.apple.nat.xml > ~/nat.patch
  5. Move the patch file to the same directory as other files:
    sudo mv /Users/[usernamehere]/nat.patch .
  6. Remove the unnecessary file nat.off and make sure that the files are owned by user root and group wheel:
    sudo rm nat.off
    sudo chown root:wheel /var/db/SystemConfiguration/*
  7. Add this command to the file /Library/StartupItems/ISharing/ISharing, just before issuing the /usr/libexec/InternetSharing command (Following comes into one line!):
    /usr/bin/patch -f /var/db/SystemConfiguration/com.apple.nat.xml /var/db/System Configuration/nat.patch > /dev/null &2>1
  8. Test the startup scripts with sudo SystemStarter -nv, restart and VĂ³ila!. You should now have the Internet Sharing automatically enabled at startup.


[ Reply to This | # ]