aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2010-02-20 10:47:26 +0200
committerFilipp Lepalaan <filipp@mac.com>2010-02-20 10:47:26 +0200
commit4e860e3faed2a3bea16868a317f08071d0c1fc0e (patch)
treed67a9cef9edd931d0f274e81e62e4ed77adbcdb0
parent25500ceb5032cb227036696e25b21e33e9494d61 (diff)
downloadmtk-4e860e3faed2a3bea16868a317f08071d0c1fc0e.tar.gz
mtk-4e860e3faed2a3bea16868a317f08071d0c1fc0e.tar.bz2
mtk-4e860e3faed2a3bea16868a317f08071d0c1fc0e.zip
Added make_boot
-rw-r--r--.gitignore2
-rwxr-xr-xmake_boot/exclude.txt3
-rwxr-xr-xmake_boot/include.txt43
-rwxr-xr-xmake_boot/makeboot.sh58
4 files changed, 106 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..9ea0f13
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+.*
+!.gitignore
diff --git a/make_boot/exclude.txt b/make_boot/exclude.txt
new file mode 100755
index 0000000..eec1ff3
--- /dev/null
+++ b/make_boot/exclude.txt
@@ -0,0 +1,3 @@
+private/var/vm/sleepimage
+private/var/logs/*
+usr/X11/*
diff --git a/make_boot/include.txt b/make_boot/include.txt
new file mode 100755
index 0000000..0ad5ffe
--- /dev/null
+++ b/make_boot/include.txt
@@ -0,0 +1,43 @@
+Applications/TextEdit.app
+Applications/System Preferences.app
+Applications/Safari.app
+Applications/Preview.app
+Applications/Utilities/Activity Monitor.app
+Applications/Utilities/Console.app
+Applications/Utilities/Disk Utility.app
+Applications/Utilities/System Profiler.app
+Applications/Utilities/Terminal.app
+Applications/Utilities/Network Utility.app
+
+Library/ColorSync
+Library/Preferences
+
+System/Library/Caches
+System/Library/Components
+System/Library/CoreServices
+System/Library/DirectoryServices
+System/Library/ColorSync
+System/Library/Displays
+System/Library/Extensions
+System/Library/Filesystems
+System/Library/Fonts
+System/Library/Frameworks
+System/Library/KerberosPlugins
+System/Library/LaunchDaemons
+System/Library/LoginPlugins
+System/Library/OpenSSL
+System/Library/PreferencePanes/StartupDisk.prefPane
+System/Library/PreferencePanes/Network.prefPane
+System/Library/PrivateFrameworks
+System/Library/Sandbox
+System/Library/ScriptingDefinitions
+System/Library/Sounds
+System/Library/SystemConfiguration
+System/Library/SystemProfiler
+
+bin
+etc
+private
+sbin
+tmp
+usr
diff --git a/make_boot/makeboot.sh b/make_boot/makeboot.sh
new file mode 100755
index 0000000..042f0c5
--- /dev/null
+++ b/make_boot/makeboot.sh
@@ -0,0 +1,58 @@
+#!/usr/bin/env bash
+# makeboot.sh
+# Create NetBoot Image from any OS X volume
+# usage makeboot..sh source destination
+
+if [ $USER != "root" ]; then
+ echo "This must be run as root"
+ exit 1
+fi
+
+USAGE="$(basename $0) source destination"
+
+if [[ -z $1 ]]; then
+ echo $USAGE 2>&1
+ exit 1
+fi
+
+RSYNC_VERSION=$(rsync --version | head -n 1 | cut -d ' ' -f 8)
+if [[ $RSYNC_VERSION -lt 30 ]]; then
+ echo "Sorry but your rsync is too old" 2>&1
+ exit 1
+fi
+
+SOURCE=$1
+VOL_NAME=NetBoot
+TMP_MOUNT_POINT_PATH=/tmp/MakeBoot
+mkdir $TMP_MOUNT_POINT_PATH
+DMG_FILE=./boot.sparseimage
+
+hdiutil create "${DMG_FILE}" -volname "${VOL_NAME}"\
+ -size 5G -type SPARSE -fs HFS+ -stretch 10G\
+ -uid 0 -gid 80 -mode 775 -layout NONE 2>&1
+
+chmod 777 "${DMG_FILE}"
+
+hdiutil attach "${DMG_FILE}" -mountpoint "${TMP_MOUNT_POINT_PATH}"
+
+mdutil -i off "${TMP_MOUNT_POINT_PATH}"
+mdutil -E "${TMP_MOUNT_POINT_PATH}"
+defaults write "${TMP_MOUNT_POINT_PATH}"/.Spotlight-V100/_IndexPolicy Policy -int 3
+
+mkdir "${TMP_MOUNT_POINT_PATH}/Library/Caches"
+
+echo "Cloning system..."
+/Volumes/KINGSTON/rsync\
+ --progress\
+ --protect-args --fileflags --force-change -aNHAXxr\
+ --files-from=include.txt --exclude-from=exclude.txt
+ "${SOURCE}" /tmp/MakeBoot
+
+echo "Doing boot things..."
+ditto /mach_kernel "${TMP_MOUNT_POINT_PATH}/mach_kernel"
+ln -s "${TMP_MOUNT_POINT_PATH}/mach_kernel" "${TMP_MOUNT_POINT_PATH}/mach"
+
+#kextcache -a i386 -s -l -n -z -m /tmp/macnbi-i386/mach.macosx.mkext /System/Library/Extensions
+
+rm -r "${TMP_MOUNT_POINT_PATH}"
+diskutil eject "${TMP_MOUNT_POINT_PATH}"