Re: sudo in Run Script Build Phase
Re: sudo in Run Script Build Phase
- Subject: Re: sudo in Run Script Build Phase
- From: Chris Hanson <email@hidden>
- Date: Sun, 17 Feb 2008 17:14:09 -0800
This kind of thing is exactly what "xcodebuild install" is for. It
will actually create a "distribution root" for you in the directory
specified by the DSTROOT build setting, arranged based on what your
products' Install Path build settings are set to, with appropriate
chown and chmod all pre-configured for you.
You don't need to set up a shell script build phase for this, or to
package your built product. Instead, you should do that as part of
your build script *after* doing the xcodebuild install; you can build
an Installer package or disk image from it afterwards.
Try doing a
% sudo xcodebuild install
and examining the /tmp/projectname.dst to see what it does for your
project.
Note too that if you don't specify a target to xcodebuild, it will
build the first target in the project. If you don't specify a
configuration to xcodebuild, it will build the configuration specified
as the "Default Configuration" in the project's info window's
Configurations tab. (That's what it's for.)
So your script will probably look something like this:
#!/bin/sh
# build project
pushd projectname
xcodebuild install
popd
# generate archive
xar -cvf projectname.xar /tmp/projectname.dst
This will generate an xar (new in 10.5) archive containing the
contents of the DSTROOT after building your project for installation
-- which sets its ownership and permissions, etc. just as you want it
to.
For your nightly/continuous build, you can just set up a launchd job
to run the script - as root, no less - without dealing with sudo or
anything like that, especially in your script.
-- Chris
On Feb 17, 2008, at 4:48 PM, Paul FitzGerald wrote:
In my project I have a Shell Script target that I'm trying to use to
package up the application. In this shell script I'm trying to do
things like...
chown -R root:admin MyApplication.app
chmod -R 775 MyApplication.app
When I build the target these commands seem to be doing nothing. Yet
they are not throwing errors either.
My thinking is that I need to run them with sudo but I get nowhere
there either (I assume since I'm not given a way to authenticate).
To make things a little more interesting, this will eventually be
run as part of an automated build process from a command something
like...
xcodebuild -target "MyApplication Package" -configuration Release
clean
Anyone have an idea why this is not working for me?
Can I expect that sudo might solve the issue (or even running as
root) or is there something else going on?
Maybe I'm just being dumb, but I am stuck and could use a little
help here.
Thanks,
Paul FitzGerald
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden