Build fails when switching user account during a build step using sudo!?
Hi,
as part of my Linux build I have 'GNU Make' build step, that creates ipk packages. As files inside an ipk should be owned by a system user what I do inside the makefile is something like this:
- build the files for the target platform
- 'chown' them to root -> This results in the build to fail with no error message.
- pack them into the ipk
- 'chown' them back to the build runners user account
Even though I agree with everyone saying that is not nice I found no other way to do it. As 'chown' requires root rights this is what I do:
if [ -f ~/root_passwd ]; \
then \
cat $$HOME/root_passwd | sudo -S -p "%p login: " chown -R root:root $(IPKG_FOLDER); \
else \
sudo -p "%p login: " chown -R root:root $(IPKG_FOLDER); \
fi; \
So If there is a file 'root_passwd' on the build machine its content will be used a the password fed to 'sudo'.
All this work locally (even the ipks created by the TeamCity are fine), I verified that the return code of all that is 0 but in my log file in TeamCity I get an error marked at the login prompt message(thus '"%p login: "' in my case) with no further explanation.
Does TeamCity gets confused because of the user switch? Any other ideas?
I am running TeamCity 6.5.2.
Thanks,
Stefan
Please sign in to leave a comment.