使用OS X产品版本的卸载程序

Jes*_*num 5 macos productbuild pkgbuild

我的产品安装程序使用pkgbuild和productbuild可以很好地工作。但是,现在我试图弄清楚如何使我的安装程序也可以充当卸载程序。通过修改我的distribution.xml文件,我可以为用户显示卸载选择,如下所示:

<choices-outline>
    <line choice="install"/>
    <line choice="uninstall"/>
</choices-outline>
<choice id="install" visible="true" title="Install" description="Installation description goes here">
    <pkg-ref id="com.prosc.RemoteExecution.install.pkg">#installer.pkg</pkg-ref>
</choice>
<choice id="uninstall" visible="true" title="Uninstall" description="Uninstaller description goes here" start_selected="false">
    <pkg-ref id="com.prosc.RemoteExecution.uninstall.pkg">#installer.pkg</pkg-ref>
</choice>
Run Code Online (Sandbox Code Playgroud)

但是,当他们选择卸载时,我需要安装后脚本以某种方式知道他们选择了哪种选择。我看不到安装后脚本知道的任何方式-环境变量中没有任何内容可以表明这一点,也没有包含在传递给我的脚本的参数中。

在我看来,我可以编写一个单独的卸载程序包,并使用其自己的单独的后安装脚本,然后将该程序包作为整个产品的一个组件包含在内,但这似乎需要大量额外的安装工作。

如果基于用户做出的安装选择存在细微的行为差异怎么办?我是否需要为每个选择单独制作包装组件?

有没有不需要额外组件包的好的解决方案,还是我应该单独制作单独的组件包以进行安装/卸载?