当我在 mac os lion 上使用 installer.app 安装应用程序时授权失败
我的应用程序在复制/删除“/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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正确的代码是:
注意特权的末尾有一个“s”。由于拼写错误,您的脚本在运行时一定会出现错误。
The correct code is:
Notice how privileges has an 's' on the end. Your script must be having errors when it's run because of the misspelling.