📄 macosx-dmg
字号:
#!/bin/sh## Posted to the projectbuilder-users list by Mike Ferris# Modified for vlc by Jon Lech Johansen#set -e# Requires at least three argsif [ $# -lt 2 ] ; then echo "usage: $0 imgName dirName ..." 1>&2 exit 1fi# Grab size and nameimgName=$1shiftdirName=$1shiftimgSize=`du -sk ${dirName} | cut -f1`imgSize=$((${imgSize} / 1024 + 2))if [ $((${imgSize} < 5)) != 0 ] ; then imgSize=5;fi# Create the image and format itrm -f "${imgName}.dmg"echo; echo "Creating ${imgSize} MB disk image named ${imgName}"hdiutil create "${imgName}.dmg" -megabytes "${imgSize}" -layout NONE -quietdev=`hdid -nomount "${imgName}.dmg" | grep '/dev/disk[0-9]*' | cut -d " " -f 1`/sbin/newfs_hfs -w -v "${imgName}" -b 4096 "${dev}" > /dev/null# Mount the image and copy stuffmkdir ./mountpointmount -t hfs ${dev} ./mountpointecho "Copying contents to ${imgName}:"for i in ${dirName}/* ; do echo " ${i}" /Developer/Tools/CpMac -r "${i}" ./mountpointdoneumount ./mountpointrmdir ./mountpointhdiutil eject "${dev}" -quiet# Compress the imageecho "Compressing ${imgName} disk image"mv "${imgName}.dmg" "${imgName}.orig.dmg"hdiutil convert "${imgName}.orig.dmg" -format UDZO -o "${imgName}" -quietrm "${imgName}.orig.dmg"# Doneecho; echo "Disk image creation completed:"ls -la "${imgName}.dmg"; echo
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -