2024年11月Linux通过命令行建立dmg文件的方法(2)

发布时间:

  ⑴# 增加Applications目录的软链接

  ⑵echo “Add link to /Applications”

  ⑶pushd /Volumes/“${VOL_NAME}”

  ⑷ln -s /Applications

  ⑸# 拷贝背景图片

  ⑹mkdir /Volumes/“${VOL_NAME}”/.background

  ⑺cp “${DMG_BACKGROUND_IMG}” /Volumes/“${VOL_NAME}”/.background/

  ⑻# 使用applescript设置一系列的窗口属性

  ⑼echo ‘

  ⑽tell application “Finder”

  ⑾tell disk “’${VOL_NAME}‘”

  ⑿set current view of container window to icon view

  ⒀set toolbar visible of container window to false

  ⒁set statusbar visible of container window to false

  ⒂set the bounds of container window to {, , , }

  ⒃set viewOptions to the icon view options of container window

  ⒄set arrangement of viewOptions to not arranged

  ⒅set icon size of viewOptions to

  ⒆set background picture of viewOptions to file “.background:’${DMG_BACKGROUND_IMG}‘”

  ⒇set position of item “’${APP_NAME}‘.app” of container window to {, }

  ⒈set position of item “Applications” of container window to {, }

  ⒉update without registering applications

  ⒊end tell

  ⒋end tell

  ⒌’ | osascript

  ⒍hdiutil detach “${DEVICE}”

  ⒎echo “Creating pressed image”

  ⒏hdiutil convert “${DMG_TMP}” -format UDZO -imagekey zlib-level= -o “${DMG_FINAL}”

  ⒐rm -rf “${DMG_TMP}”

  ⒑rm -rf “${STAGING_DIR}”

  ⒒echo ‘Done.’

  ⒓上面就是Linux使用命令行创建dmg文件的方法介绍了,上文对什么是dmg文件做了详细介绍,让用户对dmg文件有更深入的认识。