在OSX下将许可文件附加到dmg

时间:2012-01-23 11:36:00

标签: macos licensing dmg

家伙!是否有任何命令行可用于将许可证文件附加到dmg?

非常感谢

(我遇到编辑问题,如果你在文中看到“奇怪的东西”,请原谅我)

2 个答案:

答案 0 :(得分:5)

I found a blog entry for you (linked here)这个人写了a python script,你可以从命令行调用,将软件许可协议附加到磁盘映像文件。

适用于10.6&新。

根据他原来的博客文章:

  

此脚本在Python 2.6或2.7上运行。如果是Rez的默认位置   您需要在您的机器上使用不同的FlatCarbon接头   使用命令行选项--rez指定正确的位置   和--flat-carbon。

His script (click this link to see it)可以像以下一样轻松调用:

./licenseDMG.py <dmgFile> <licenseFile>

答案 1 :(得分:0)

我写了这个新答案,因为hdiutil命令不再支持unflattenflatten选项。因此,我设法使用新的udifrez命令执行了相同的操作,以plist格式在xml文件中准备了片段。

两个许可证文件的模板结构就是这个

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>LPic</key>
    <array>
        <dict>
            <key>Attributes</key>
            <string>0x0000</string>
            <key>Data</key>
            <data>
            AAAAAgAAAAAAAAAIAAMAAA==
            </data>
            <key>ID</key>
            <string>5000</string>
            <key>Name</key>
            <string></string>
        </dict>
    </array>
    <key>RTF </key>
    <array>
        <dict>
            <key>Attributes</key>
            <string>0x0000</string>
            <key>Data</key>
            <data>

... here goes the English RTF file codified in base64

            </data>
            <key>ID</key>
            <string>5000</string>
            <key>Name</key>
            <string>English SLA</string>
        </dict>
        <dict>
            <key>Attributes</key>
            <string>0x0000</string>
            <key>Data</key>
            <data>

... here goes the Spanish RTF file codified in base64
                
            </data>
            <key>ID</key>
            <string>5003</string>
            <key>Name</key>
            <string>Spanish SLA</string>
        </dict>
    </array>
    <key>STR#</key>
    <array>
        <dict>
            <key>Attributes</key>
            <string>0x0000</string>
            <key>Data</key>
            <data>
            AAYNRW5nbGlzaCB0ZXN0MQVBZ3JlZQhEaXNhZ3JlZQVQcmludAdT
            YXZlLi4ueklmIHlvdSBhZ3JlZSB3aXRoIHRoZSB0ZXJtcyBvZiB0
            aGlzIGxpY2Vuc2UsIGNsaWNrICJBZ3JlZSIgdG8gYWNjZXNzIHRo
            ZSBzb2Z0d2FyZS4gIElmIHlvdSBkbyBub3QgYWdyZWUsIHByZXNz
            ICJEaXNhZ3JlZS4i
            </data>
            <key>ID</key>
            <string>5000</string>
            <key>Name</key>
            <string>English buttons</string>
        </dict>
        <dict>
            <key>Attributes</key>
            <string>0x0000</string>
            <key>Data</key>
            <data>
            AAYHRW5nbGlzaAVBZ3JlZQhEaXNhZ3JlZQVQcmludAdTYXZlLi4u
            e0lmIHlvdSBhZ3JlZSB3aXRoIHRoZSB0ZXJtcyBvZiB0aGlzIGxp
            Y2Vuc2UsIHByZXNzICJBZ3JlZSIgdG8gaW5zdGFsbCB0aGUgc29m
            dHdhcmUuICBJZiB5b3UgZG8gbm90IGFncmVlLCBwcmVzcyAiRGlz
            YWdyZWUiLg==
            </data>
            <key>ID</key>
            <string>5002</string>
            <key>Name</key>
            <string>English</string>
        </dict>
        <dict>
            <key>Attributes</key>
            <string>0x0000</string>
            <key>Data</key>
            <data>
            AAYHRXNwYZZvbAdBY2VwdGFyCk5vIGFjZXB0YXIISW1wcmltaXIK
            R3VhcmRhci4uLsBTaSBlc3SHIGRlIGFjdWVyZG8gY29uIGxvcyB0
            jnJtaW5vcyBkZSBlc3RhIGxpY2VuY2lhLCBwdWxzZSAiQWNlcHRh
            ciIgcGFyYSBpbnN0YWxhciBlbCBzb2Z0d2FyZS4gRW4gZWwgc3Vw
            dWVzdG8gZGUgcXVlIG5vIGVzdI4gZGUgYWN1ZXJkbyBjb24gbG9z
            IHSOcm1pbm9zIGRlIGVzdGEgbGljZW5jaWEsIHB1bHNlICJObyBh
            Y2VwdGFyLiI=
            </data>
            <key>ID</key>
            <string>5003</string>
            <key>Name</key>
            <string>Spanish</string>
        </dict>
    </array>
    <key>TMPL</key>
    <array>
        <dict>
            <key>Attributes</key>
            <string>0x0000</string>
            <key>Data</key>
            <data>
            E0RlZmF1bHQgTGFuZ3VhZ2UgSUREV1JEBUNvdW50T0NOVAQqKioq
            TFNUQwtzeXMgbGFuZyBJRERXUkQebG9jYWwgcmVzIElEIChvZmZz
            ZXQgZnJvbSA1MDAwRFdSRBAyLWJ5dGUgbGFuZ3VhZ2U/RFdSRAQq
            KioqTFNURQ==
            </data>
            <key>ID</key>
            <string>128</string>
            <key>Name</key>
            <string>LPic</string>
        </dict>
    </array>
    <key>styl</key>
    <array>
        <dict>
            <key>Attributes</key>
            <string>0x0000</string>
            <key>Data</key>
            <data>
            AAMAAAAAAAwACQAUAAAAAAAAAAAAAAAAACcADAAJABQBAAAAAAAA
            AAAAAAAAKgAMAAkAFAAAAAAAAAAAAAA=
            </data>
            <key>ID</key>
            <string>5000</string>
            <key>Name</key>
            <string>English SLA</string>
        </dict>
        <dict>
            <key>Attributes</key>
            <string>0x0000</string>
            <key>Data</key>
            <data>
            AAMAAAAAAAwACQAVAAAAAAAAAAAAAAAAACoADAAJABUBAAAAAAAA
            AAAAAAAALgAMAAkAFQAAAAAAAAAAAAA=
            </data>
            <key>ID</key>
            <string>5003</string>
            <key>Name</key>
            <string>Spanish SLA</string>
        </dict>
    </array>
</dict>
</plist>

我设法在正确的位置对与英语sla和西班牙语sla文件相对应的两个rtf文件进行base64编码。

请注意,如果您使用的是其他语言,则需要仔细更改模板文件中的其他一些内容。但至少,我可以给您一些开始的机会。