diff options
author | Filipp Lepalaan <filipp@mac.com> | 2010-02-20 10:47:26 +0200 |
---|---|---|
committer | Filipp Lepalaan <filipp@mac.com> | 2010-02-20 10:47:26 +0200 |
commit | 4e860e3faed2a3bea16868a317f08071d0c1fc0e (patch) | |
tree | d67a9cef9edd931d0f274e81e62e4ed77adbcdb0 /make_boot/makeboot.sh | |
parent | 25500ceb5032cb227036696e25b21e33e9494d61 (diff) | |
download | mtk-4e860e3faed2a3bea16868a317f08071d0c1fc0e.tar.gz mtk-4e860e3faed2a3bea16868a317f08071d0c1fc0e.tar.bz2 mtk-4e860e3faed2a3bea16868a317f08071d0c1fc0e.zip |
Added make_boot
Diffstat (limited to 'make_boot/makeboot.sh')
-rwxr-xr-x | make_boot/makeboot.sh | 58 |
1 files changed, 58 insertions, 0 deletions
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}" |