• 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: hdiutil (suppress license agreemet)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: hdiutil (suppress license agreemet)


  • Subject: Re: hdiutil (suppress license agreemet)
  • From: Laine Lee <email@hidden>
  • Date: Sun, 06 Apr 2008 02:22:26 -0500
  • Thread-topic: hdiutil (suppress license agreemet)

Title: Re: hdiutil (suppress license agreemet)
On 1/22/08 3:50 PM, "Andrew Thomson" <email@hidden> wrote:

> While I'm sure I could copy the necessary applications into a newly created
> disk image without an associated license agreement, I'd rather find a way to
> accommodate this type of disk image.

Here's what I use.

--
property temppath : "/private/tmp/"

on open the_items
    my build_archive(the_items)
end open

on build_archive(the_items)
    repeat with the_item in the_items
        set the_item to the_item as alias
        try
            tell application "Finder"
                set sost to ((container of file (the_item as string)) as alias) as string
            end tell
            set sost to POSIX path of sost
        on error therrr
            log therrr
            display dialog therrr
            set sost to "/Volumes/"
        end try
        set this_filepath to (the_item as string)
        
        if last character of this_filepath is ":" then
            tell me to set it_is_a_folder to true
        else
            set it_is_a_folder to false
        end if
        if not it_is_a_folder then
            set thesourcename to (name of (info for the_item))
            set the_source_file to POSIX path of this_filepath
            set pos_filepath to sost
            set thesourcename to replace_chars(thesourcename, " ", "_")
            set dest_file to (quoted form of (temppath & thesourcename))
            set tempname to ((characters 1 thru -5 of thesourcename) & "temp")
            try
                set my_command to "hdiutil convert -format UDRW" & space & (quoted form of the_source_file) & space & "-o" & space & (quoted form of (temppath & tempname))
                do shell script my_command
                set my_2nd_command to "hdiutil convert" & space & (quoted form of (temppath & tempname & ".dmg")) & space & "-format UDZO -imagekey zlib-level=9 -o" & space & (quoted form of (temppath & thesourcename))
                do shell script my_2nd_command
                do shell script "rm" & space & (quoted form of (temppath & tempname & ".dmg"))
            on error onerr
                activate
                display dialog onerr
            end try
            
            if pos_filepath is "/Volumes/" then
                set pos_filepath to (POSIX path of (path to desktop folder))
            end if
            set targdetect to (pos_filepath & thesourcename)
            set name_target to alias (POSIX file targdetect)
            set finishname to "_recomp"
            --use this instead of above to overwrite your original disk image: set finishname to ""            
            set thesourcename to (((characters 1 thru -5 of thesourcename) & finishname) as Unicode text)
            tell me to do shell script "ditto -rsrcFork" & space & dest_file & space & "\"" & (pos_filepath & thesourcename) & ".dmg" & "\""
        end if
        try
            do shell script "rm" & space & dest_file
        end try
    end repeat
end build_archive
--

--
Laine Lee
 _______________________________________________
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: hdiutil (suppress license agreemet)
      • From: Laine Lee <email@hidden>
  • Prev by Date: Re: Showing a Mail mailbox
  • Next by Date: Eject CD
  • Previous by thread: Re: Showing a Mail mailbox
  • Next by thread: Re: hdiutil (suppress license agreemet)
  • Index(es):
    • Date
    • Thread