简体   繁体   English

具有运行脚本构建阶段的xcode模板需要root

[英]xcode template with run script build phase requires root

I'm trying to configure a custom xcode template for building Apache 2.2 modules in xcode. 我正在尝试配置一个自定义xcode模板,以在xcode中构建Apache 2.2模块。 Everything seems to be working okay so far, except the most important bit: the custom build settings. 到目前为止,除了最重要的一点:自定义构建设置之外,其他一切似乎都可以正常工作。

I currently have my template configured so that my target has a run script phase that executes apxs, the Apache module build tool, like so: 我目前已配置了模板,以便我的目标具有运行脚本阶段,该阶段执行apxs(Apache模块构建工具),如下所示:

Shell: /bin/bash 外壳:/ bin / bash

Script: /usr/sbin/apxs -c -i $PROJECT_NAME.c 脚本:/ usr / sbin / apxs -c -i $ PROJECT_NAME.c

The only problem is, the -i flag, which installs the compiled module into the modules directory of Apache, requires root or administrator privileges to access that folder. 唯一的问题是,-i标志将编译后的模块安装到Apache的modules目录中,需要root或管理员特权才能访问该文件夹。 Now I've tried prepending su in front of by script in the hopes that xcode would ask for the password to install the module, but to no avail. 现在,我已经尝试在脚本之前在su前面加上su,以希望xcode要求输入密码来安装该模块,但无济于事。 Does anyone know of a way that I can do this? 有谁知道我可以做到的方式? Have I missed something really obvious, as the only advice I've been ale to google so far suggests logging into my machine as a different user using distributed build options and having the build execute that way, but this seems incredibly complicated for something that simply requires permissions to install the compiled module. 我是否错过了一些显而易见的事情,因为到目前为止,我一直在谷歌上搜索的唯一建议是建议使用分布式构建选项以其他用户身份登录到我的计算机并以这种方式执行构建,但是对于某些事情而言,这似乎非常复杂需要权限才能安装已编译的模块。

Any advice would be appreciated. 任何意见,将不胜感激。

Cheers! 干杯!

sudo visudo 苏多维苏多

omarshariffdontlikeit  ALL=(ALL) NOPASSWD: /usr/bin/the_script.sh

Within your script phase invoke: 在脚本阶段内调用:

sudo /usr/bin/the_script.sh

No password needed. 无需密码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM