使用admin previleges从shell脚本中调用的AppleScript [英] Calling applescript from shell script using admin previleges

查看:568
本文介绍了使用admin previleges从shell脚本中调用的AppleScript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行一个安装程序(由ViseX),并通过列表中选择安装程序中的不同项目的shell脚本。
安装程序需要管理员权限才能正常运行,但我不想使用sudo。
目前,因为它不具有管理员权限运行安装应用程序无法正常工作。

我如何打电话与管理员权限的AppleScript或告知里面的AppleScript安装的应用程序作为管理员身份运行?

下面是我在使用AppleScript的:

  osascript<< -END
  告诉应用程序$ 1
    用的8 *3600秒超时
     启用
     选择$ 2
     DoInstall
   最终超时
 告诉结束
结束


解决方案

 做shell脚本[路径/要/ APP] [参数]用户名[管理员名称]密码[密码]以管理员权限

I'm running a shell script that runs an installation program (by ViseX) and selects different items in the installer through a list. The installer needs administrator privileges to run properly, but I don't want to use sudo. Currently the installation application does not work properly because it does not run with admin privileges.

How do I call the applescript with admin privileges or tell the installation app inside the applescript to run as admin?

Here's the applescript I'm using:

osascript <<-END
  tell application "$1"
    with timeout of 8 * 3600 seconds
     activate
     Select "$2"
     DoInstall
   end timeout
 end tell
END

解决方案

do shell script "[path/to/app] [param]" user name "[admin name]" password "[password]" with administrator privileges

这篇关于使用admin previleges从shell脚本中调用的AppleScript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆