当我在 mac os lion 上使用 installer.app 安装应用程序时授权失败

发布于 2024-12-07 03:12:12 字数 1202 浏览 0 评论 0原文

我的应用程序在复制/删除“/Library/LaunchAgents/”中的 plist 文件以控制选中/取消选中复选框时的自动启动功能时遇到问题。

我制作了一个安装程序,在“安装后操作”中具有“打开文件”操作。安装后,应用程序成功启动,但是当我选中复选框并输入管理员密码为所有用户启用“自动启动”时,自动启动 .plist 文件不会复制到 /Library/LauchAgents/ 。如果我杀死该应用程序然后手动重新打开该应用程序,然后选中自动启动选项,则可以将文件成功复制到该文件夹​​。

这是我用于将文件复制到“/Library/LauchAgents/”的AppleScript。我确信源路径和目标路径是正确的。

do shell script "cp '<sourcepath>' '<destinpath>'" with administrator privilege

以下是我在控制台中收到的错误消息:

9/30/11 11:12:18.217 AM authorizationhost: SFBuiltinEntitled: Installer.app is not entitled for system.install.app-store-software

9/30/11 11:12:18.219 AM com.apple.SecurityServer: Failed to authorize right 'system.install.app-store-software' by client '/System/Library/PrivateFrameworks/PackageKit.framework/Versions/A/Resources/installd' [2042] for authorization created by '/System/Library/CoreServices/Installer.app' [2033]

9/30/11 11:12:18.277 AM installd: PackageKit: 
----- Begin install -----

9/30/11 11:12:19.977 AM MyAppDemo: awakeFromNib()

9/30/11 11:12:20.007 AM installd: Installed "My Application Package" ()

9/30/11 11:12:20.035 AM installd: PackageKit: 
----- End install -----

I have a problem with my app to copy/delete a plist file in "/Library/LaunchAgents/" to control the auto-start function on checking/unchecking a checkbox.

I made an installer which has a "open file" action in "postinstall actions". After install, the app is started successfully, but when I check the checkbox and enter my admin password to enable "auto-start" for all the users, the auto start .plist file is not copied to /Library/LauchAgents/ . If I kill the app then re-open the app manually, and then check the auto start option, the file can be copied to the folder successfully.

Here is the AppleScript i used for coping files to "/Library/LauchAgents/". I'm sure the sourcepath and the destinpath are right.

do shell script "cp '<sourcepath>' '<destinpath>'" with administrator privilege

Here are the error messages i got in Console:

9/30/11 11:12:18.217 AM authorizationhost: SFBuiltinEntitled: Installer.app is not entitled for system.install.app-store-software

9/30/11 11:12:18.219 AM com.apple.SecurityServer: Failed to authorize right 'system.install.app-store-software' by client '/System/Library/PrivateFrameworks/PackageKit.framework/Versions/A/Resources/installd' [2042] for authorization created by '/System/Library/CoreServices/Installer.app' [2033]

9/30/11 11:12:18.277 AM installd: PackageKit: 
----- Begin install -----

9/30/11 11:12:19.977 AM MyAppDemo: awakeFromNib()

9/30/11 11:12:20.007 AM installd: Installed "My Application Package" ()

9/30/11 11:12:20.035 AM installd: PackageKit: 
----- End install -----

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

在梵高的星空下 2024-12-14 03:12:12

正确的代码是:

do shell script "cp '<sourcepath>' '<destinpath>'" with administrator privileges

注意特权的末尾有一个“s”。由于拼写错误,您的脚本在运行时一定会出现错误。

The correct code is:

do shell script "cp '<sourcepath>' '<destinpath>'" with administrator privileges

Notice how privileges has an 's' on the end. Your script must be having errors when it's run because of the misspelling.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文