• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Auto mount .dmg in High Sierra? Possible??
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Auto mount .dmg in High Sierra? Possible??


  • Subject: Re: Auto mount .dmg in High Sierra? Possible??
  • From: Brian Christmas <email@hidden>
  • Date: Sun, 25 Mar 2018 10:53:23 +1100

G’day Paul

Finally had time to address this. See script below.

Using ‘hdiutil detach’ definitely causes this error below. ‘detach’ is listed
as internet-enable.


diskutil: did not recognize verb "detach"; type "diskutil" for a list


So, the question is, how do I release the disk image, please anyone??

Regards

Santa

Fom man pages….

Converting:
           hdiutil convert master.dmg -format UDTO -o master
                 converts master.dmg to a CD-R export image named master.cdr
           hdiutil convert /dev/disk1 -format UDRW -o devimage
                 converts the disk /dev/disk1 to a read/write device image
                 file.  authopen(1) will be used if read access to /dev/rdisk1
                 is not available.  Note use of the block-special device.
           hdiutil convert image.dmg -o image.sparsebundle
                 converts image.dmg to format UDSB by automatically detecting
                 the file extension .sparsebundle.
           hdiutil convert files.sparsebundle -format UDZO \
               -imagekey zlib-level=5 -o files
                 converts files.sparsebundle to files.dmg: a read-only, com-
                 pressed disk image using zlib level 5 instead of the default.
           hdiutil convert stuff.dmg -format UDZO -encryption -o stuff-enc
                 create a copy of stuff.dmg named stuff-enc.dmg which is
                 encrypted with AES-128.

tell application "System Events" to set myFile to choose file of type {"dmg"}
with prompt "Please select a disk image to set the 'auto open' on :"
set myPath to quoted form of POSIX path of myFile
tell application "Finder" to set myName to (name of myFile) as text
set myNameTwo to quoted form of ((characters 1 thru ((offset of "." in myName)
- 1) of myName) as text)
set shellScript to "hdiutil attach -verify -autofsck -mount required " & myPath
set tempAction to do shell script shellScript

-->  "hdiutil attach -noverify -noautofsck -mount required
'/Users/OzSanta/Documents/My XCode Projects/AA Sierra Public/Web Site stuff/Art
Archiver.dmg'"

tell application "System Events" to display dialog myName & return & return &
myNameTwo & return & return & tempAction giving up after 3
set endTextPath to replace_chars(tempAction, "/")
set the_ID to (do shell script "df -hlg | grep -m 1" & space & quoted form of
endTextPath & space & "| grep -o 'disk[0-9][a-z][0-9]*'")
do shell script "diskutil detach " & the_ID
tell application "System Events" to set myFolder to choose folder with prompt
"If desired, please select a new folder in which to save a compressed version
of the disk image, or Cancel :"
set folderPath to quoted form of POSIX path of ((myFolder as text) & myName)
set shellScriptThree to "hdiutil convert " & myPath & " -ov -format UDZO -o " &
folderPath
tell application "System Events" to display dialog shellScriptThree giving up
after 20

-->hdiutil convert '/Users/OzSanta/Documents/My XCode Projects/AA Sierra
Public/Web Site stuff/Art Archiver.dmg' -format UDZO -o
'/Users/OzSanta/Documents/My XCode Projects/AA Sierra Public/Web Site
stuff/Release dmg'\''s/Art Archiver.dmg'

do shell script shellScriptThree

-->hdiutil: convert failed - Resource temporarily unavailable WHAT DOES THIS
MEAN???

shellScript & return & return & shellScriptThree

on replace_chars(this_text, search_String)
        set KeepDelimiters to AppleScript's text item delimiters
        set AppleScript's text item delimiters to the search_String
        set the item_path to last text item of this_text
        set AppleScript's text item delimiters to KeepDelimiters
        return item_path
end replace_chars

(*
 convert image -format format -o outfile
                convert image to type format and write the result to outfile.

                As with create, the correct filename extension will be added
                only if it isn't part of the provided name.  Format is one of:
UDRW - UDIF read/write image
UDRO - UDIF read-only image
UDCO - UDIF ADC-compressed image
UDZO - UDIF zlib-compressed image
ULFO - UDIF lzfse-compressed image (OS X 10.11+ only)
UDBZ - UDIF bzip2-compressed image (Mac OS X 10.4+ only)
UDTO - DVD/CD-R master for export
UDSP - SPARSE (grows with content)
UDSB - SPARSEBUNDLE (grows with content; bundle-backed)
UFBI - UDIF entire image with MD5 checksum
        UDRo - UDIF read-only (obsolete format)
        UDCo - UDIF compressed (obsolete format)
        RdWr - NDIF read/write image (deprecated)
        Rdxx - NDIF read-only image (Disk Copy 6.3.3 format;
                      deprecated)
        ROCo - NDIF compressed image (deprecated)
        Rken - NDIF compressed (obsolete format)
        DC42 - Disk Copy 4.2 image (obsolete format)

*)

> On 25 Mar 2018, at 5:00 am, Paul Scott <email@hidden> wrote:
>
> Please don’t use unmount. If you use “hdiutil detach” as I previously
> indicated, it will work.
>
> Unmount will only unmount the volume, it will not release the disk image.
> Detach will both unmount the volume and release the disk image.
>
> Paul
>
>> On Mar 23, 2018, at 10:13 PM, Brian Christmas <email@hidden
>> <mailto:email@hidden>> wrote:
>>
>> Thanks Laine, and Ed, and Paul.
>>
>> Here’s the modified code, but its still generating an error, even tho
>> Laine’s routine, with my all purpose modification, unmounts the disk. Paul,
>> using the original variable pointing to the disk generates an error. Perhaps
>> once the attachment is made, it’s a though the old disk is now not seen.
>>
>>
>> do shell script shellScriptThree
>>
>> -->hdiutil: convert failed - Resource temporarily unavailable. WHAT DOES
>> THIS MEAN???
>>
>>
>> This has become a matter of "I’m determined to get it running", more than
>> the sheer convenience.
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Auto mount .dmg in High Sierra? Possible??
      • From: Paul Scott <email@hidden>
References: 
 >Auto mount .dmg in High Sierra? Possible?? (From: Brian Christmas <email@hidden>)
 >Re: Auto mount .dmg in High Sierra? Possible?? (From: Paul Scott <email@hidden>)
 >Re: Auto mount .dmg in High Sierra? Possible?? (From: Brian Christmas <email@hidden>)
 >Re: Auto mount .dmg in High Sierra? Possible?? (From: Paul Scott <email@hidden>)
 >Re: Auto mount .dmg in High Sierra? Possible?? (From: "Stockly, Ed" <email@hidden>)
 >Re: Auto mount .dmg in High Sierra? Possible?? (From: Brian Christmas <email@hidden>)
 >Re: Auto mount .dmg in High Sierra? Possible?? (From: Paul Scott <email@hidden>)
 >Re: Auto mount .dmg in High Sierra? Possible?? (From: Brian Christmas <email@hidden>)
 >Re: Auto mount .dmg in High Sierra? Possible?? (From: Paul Scott <email@hidden>)
 >Re: Auto mount .dmg in High Sierra? Possible?? (From: Brian Christmas <email@hidden>)
 >Re: Auto mount .dmg in High Sierra? Possible?? (From: Brian Christmas <email@hidden>)
 >Re: Auto mount .dmg in High Sierra? Possible?? (From: Brian Christmas <email@hidden>)
 >Re: Auto mount .dmg in High Sierra? Possible?? (From: Paul Scott <email@hidden>)
 >Re: Auto mount .dmg in High Sierra? Possible?? (From: Paul Scott <email@hidden>)
 >Re: Auto mount .dmg in High Sierra? Possible?? (From: Brian Christmas <email@hidden>)
 >Re: Auto mount .dmg in High Sierra? Possible?? (From: Paul Scott <email@hidden>)
 >Re: Auto mount .dmg in High Sierra? Possible?? (From: Brian Christmas <email@hidden>)
 >Re: Auto mount .dmg in High Sierra? Possible?? (From: Paul Scott <email@hidden>)

  • Prev by Date: Re: Auto mount .dmg in High Sierra? Possible??
  • Next by Date: Re: Auto mount .dmg in High Sierra? Possible??
  • Previous by thread: Re: Auto mount .dmg in High Sierra? Possible??
  • Next by thread: Re: Auto mount .dmg in High Sierra? Possible??
  • Index(es):
    • Date
    • Thread