PKG安装程序 - 隐藏部分背景图像

时间:2016-10-23 08:27:52

标签: install

我正在尝试在.pkg文件中设置背景。 这是我的distribution.xml模板文件:

<?xml version="1.0" encoding="utf-8"?>
<installer-gui-script minSpecVersion="1">
    <title>{{ title }}</title>
    <welcome file="welcome.txt" mime-type="text/plain" />
    <readme file="readme.txt" mime-type="text/plain" />
    <license file="license.txt" mime-type="text/plain" />
    <conclusion file="conclusion.txt" mime-type="text/plain" />
    <pkg-ref id="{{ identifier }}"/>
    <options customize="never" require-scripts="false"/>
    <background file="{{ background_filename }}" mime-type="image/{{ background_ext }}"/>
    <choices-outline>
        <line choice="default">
            <line choice="{{ identifier }}"/>
        </line>
    </choices-outline>
    <choice id="default"/>
    <choice id="{{ identifier }}" visible="false">
        <pkg-ref id="{{ identifier }}"/>
    </choice>
    <pkg-ref id="{{ identifier }}" version="{{ version }}" onConclusion="none">{{ identifier }}-{{ build_number }}.pkg</pkg-ref>
</installer-gui-script>

它将从Python脚本呈现,并使用productbuild调用:

    background_path = os.path.join(
        config_dir,
        config['darwin']['installer']['background_path']
    )
    background_filename = os.path.basename(background_path)
    distribution_rendered = self.source.render_template(
        self.__osname,
        "productbuild/distribution.jinja2",
        {
            "title": ' '.join(
                (
                    brand_name,
                    binary_name,
                    version
                )
            ),
            "background_filename": background_filename,
            "background_ext": os.path.splitext(background_filename)[1][1:],
            "identifier": identifier,
            "build_number": build_number,
            "version": version
        }
    )
    with open('distribution.xml', 'w') as f:
        f.write(distribution_rendered)

    os.mkdir('resources')
    shutil.copy(background_path, 'resources')
    runcmd(("productbuild --distribution distribution.xml "
            "--resources resources "
            "--package-path {0}.pkg compiled/{0}.pkg").format(filename))

成功创建了.pkg文件,但隐藏了部分背景图片:

enter image description here

如何使其透明,以便我可以看到背景图像的隐藏部分?

enter image description here

0 个答案:

没有答案
相关问题