将参数或环境传递给 Mac 安装程序脚本

发布于 2024-12-23 07:10:52 字数 342 浏览 2 评论 0原文

我尝试使用 packagemaker 编写安装程序,该程序在安装过程中运行 shell 脚本。 我想在静默模式安装期间将一些参数传递给 shell 脚本。类似于

$installer -pkg MyInstaller.pkg -my_argument1 -my_argument2

我能想到的两个选项是,

  1. 设置环境变量并从脚本中读取这些变量。但这似乎不起作用。
  2. 将此数据写入某个文件并在安装过程中从中读取。但这是一种非常丑陋的方法,而且对于我的安装人员的用户来说并不方便。

有没有更好的方法来使用命令行参数或环境来做到这一点?

I tried to write installer with packagemaker which runs a shell script during installation.
I want to pass some arguments to the shell script during silent mode installation. Something similar to

$installer -pkg MyInstaller.pkg -my_argument1 -my_argument2

The two options I can think of are,

  1. Set the environment variables and read those from script. But this does not seem to work.
  2. Write this data to some file and read from it during installation. But it's very ugly way to do this and it is not convenient for my installer's user.

Is there a better way to do it with command line arguments or environments?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文