Last active
December 20, 2015 16:38
-
-
Save h4rm0n1c/6162498 to your computer and use it in GitHub Desktop.
This is a template derived from a script I wrote with some ideas taken from https://gist.github.com/pklaus/931579
with the original scripts coming from Ricardo Gameiro, Philipp Klaus and Daniel Jenkins.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Template for first boot script creator. | |
#feel free to modify this to make use of arguments, allowing for script installation on a different volume. | |
#I have made use of nowdoc syntax to intepret the enclosed strings as literal strings with no parsing done. | |
#Harrison Mclean a.k.a h4rm0n1c | |
#better than using cd, we pop this directory off of the stack at the end of the script. | |
pushd /System/Library/StartupItems | |
mkdir FirstRun | |
chown -R root:wheel FirstRun | |
chmod -R u+rwX,g+rX,o+rX FirstRun | |
cat << 'EOF' > FirstRun/FirstRun | |
#!/bin/bash | |
#Begin Post-install (first boot) script. | |
#Insert what you want to run once on first boot here, I've used this for dock plists, default preferences, just about anything really. | |
#End Post-install (first boot) script. | |
rm -rf /System/Library/StartupItems/FirstRun/ | |
EOF | |
chmod u+x,g+x,o+x FirstRun/FirstRun | |
cat << 'EOF' > FirstRun/StartupParameters.plist | |
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd"> | |
<plist version="0.9"> | |
<dict> | |
<key>Description</key> | |
<string>FirstRun Script</string> | |
<key>OrderPreference</key> | |
<string>Late</string> | |
<key>Provides</key> | |
<array> | |
<string>FirstRun</string> | |
</array> | |
<key>Uses</key> | |
<array> | |
<string>Disks</string> | |
</array> | |
</dict> | |
</plist> | |
EOF | |
#back where we started | |
popd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note: This script uses Apple's older Startup Items system to execute, which is officially Deprecated.
Rewriting this to use the launchd system would be a good idea.