Hi,
first of all you can store your shell script anywhere on your system, I prefere the location /usr/local/scripts (this doesn't exist by default).
Second you have to create a LaunchDeamon script in /Library/LaunchDeamons which execute your shell script at boot as root.
An example:
-------------------------snip------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST
1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>YOUR
IDENTIFIERNAME</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/scripts/YOUR_SCRIPT.sh</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>UserName</key>
<string>ROOT</string>
<key>GroupName</key>
<string>WHEEL</string>
</dict>
</plist>
-------------------------snap------------------------
http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPSystemS tartup/Articles/LaunchOnDemandDaemons.html
To run a script as root during a user login you can configure a LoginHook. To create a LoginHook login as the relating user and type the following commad:
sudo defaults write com.apple.loginwindow LoginHook /Path/To/Your/Script
http://support.apple.com/kb/HT2420
Hope that helps
Bye Tom