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. 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:
Shell: /bin/bash
Script: /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. 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. 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 com开发者_JS百科plicated 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.
精彩评论