In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "how Linux builds dmg files through the command line". In daily operation, I believe many people have doubts about how Linux builds dmg files through the command line. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts of "how Linux establishes dmg files through the command line". Next, please follow the editor to study!
Linux system operation, many people do not know much about dmg files, let alone how to create dmg files, this article is to introduce Linux to use the command line to build dmg files, friends who do not understand can come to understand.
What is a DMG file and how do I open it?
DMG format is a mirror file on the MAC system, which can also be called a compressed file. If you use PC and do not have MAC OS X for X86 installed, don't bother. If you are using a Mac or have MAC OS X for X86 installed on PC, double-click the file on the MAC system to unlock it; if you want to burn the file to DVD, burn the file into a CD with toast: dmg= "disc image
Command line to create a dmg
Get the software version number automatically
APP_NAME= "Soulver"
VERSION=$ (/ usr/libexec/plistbuddy-c Print:CFBundleShortVersionString: "${APP_NAME} .app / Contents/Info.plist")
DMG_BACKGROUND_IMG= "Background.png"
VOL_NAME= "${APP_NAME} ${VERSION}"
DMG_TMP= "${VOL_NAME}-temp.dmg"
DMG_FINAL= "${VOL_NAME} .dmg"
STAGING_DIR= ". / Install"
Create dmg
# Clean up folders
Rm-rf "${STAGING_DIR}"${DMG_TMP}"${DMG_FINAL}"
# create folder, copy, calculate
Mkdir-p "${STAGING_DIR}"
Cp-rpf "${APP_NAME} .app"${STAGING_DIR}"
SIZE= `du-sh "${STAGING_DIR}" | sed's / ([0-9.] *) M (. *) / 1max'`
SIZE= `echo "${SIZE} + 1.0" | bc | awk'{print int ($1mm 0.5)}'`
# Fault tolerant processing
If [$? -ne 0]; then
Echo "Error: Cannot compute size of staging dir"
Exit
Fi
# create a temporary dmg file
Hdiutil create-srcfolder "${STAGING_DIR}"-volname "${VOL_NAME}"-fs HFS+
-fsargs "- c cantin 64m adept 16"-format UDRW-size ${SIZE} M "${DMG_TMP}"
Echo "Created DMG: ${DMG_TMP}"
Set up dmg
DEVICE=$ (hdiutil attach-readwrite-noverify "${DMG_TMP}" |
Egrep'^ / dev/' | sed 1q | awk'{print $1}')
Sleep 2
# add soft links to the Applications directory
Echo "Add link to / Applications"
Pushd / Volumes/ "${VOL_NAME}"
Ln-s / Applications
Popd
# copy background image
Mkdir / Volumes/ "${VOL_NAME}" / .background
Cp "${DMG_BACKGROUND_IMG}" / Volumes/ "${VOL_NAME}" / .background/
# use applescript to set a series of window properties
Echo'
Tell application "Finder"
Tell disk "${VOL_NAME}"
Open
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 {400, 100, 938, 432}
Set viewOptions to the icon view options of container window
Set arrangement of viewOptions to not arranged
Set icon size of viewOptions to 72
Set background picture of viewOptions to file ".background:'${DMG_BACKGROUND_IMG}'"
Set position of item "${APP_NAME} '.app" of container window to {160195}
Set position of item "Applications" of container window to {360,195}
Close
Open
Update without registering applications
Delay 2
End tell
End tell
'| osascript
Sync
# Uninstall
Hdiutil detach "${DEVICE}"
Compressed dmg
Echo "Creating compressed image"
Hdiutil convert "${DMG_TMP}"-format UDZO-imagekey zlib-level=9-o "${DMG_FINAL}"
# Clean up folders
Rm-rf "${DMG_TMP}"
Rm-rf "${STAGING_DIR}"
Echo 'Done.'
Exit
At this point, the study on "how Linux creates dmg files through the command line" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.