0

I'm developing for jailbroken devices, and have gotten Xcode building and debugging workin on device with a self signed certificate and some edits to Xcode.

But the app I'm developing requires being able to call setuid(0), thus it needs to have chmod +s in order to run properly. Apart from this iOS apps that needs to run as root need a bash script to invoke it like such:

#!/bin/bash
dir=$(dirname "$0")
exec "${dir}"/App\ Binary_ "$@"

So, I need this build script to run on building my app:

cd ${BUILT_PRODUCTS_DIR}/My\ App.app/
mv App_Binary App_Binary_
cp /Users/john/Shellscript Binary_App
chmod +s Binary_App_
chmod +x Binary_App

I've tried adding this as a normal build script, and as a part of the scheme as both a Build post-action or a Run Pre-action. Neither which has worked. For example a post-action script on build returns that code signing failed, since it tries to codesign App Binary that is now the shell script. If I do it as a pre-action script on Run it displays "Xcode cannot run using the selected device.Choose a destination with a supported architecture in order to run on this device."

What should I do?

John Anthony
  • 405
  • 1
  • 5
  • 17

1 Answers1

1

I use a post-action script to build my jailbreak apps. Although they don't need an additional chmod or bash script to run, you could use a script like mine to install your app (as a system app, not a normal App Store app) using ssh, then perform the chmod command and swapping the binary with a bash script on device via the post-action script.

You could try something along these lines (I tried to use the details from your script, but there may be one or two mistakes):

# copy binary
scp -P $PORT -r $BUILT_PRODUCTS_DIR/${WRAPPER_NAME} root@$IPOD://private/var/stash/Applications/${WRAPPER_NAME}/App_Binary_
# copy script
scp -P $PORT /Users/john/Shellscript root@$IPOD://private/var/stash/Applications/${WRAPPER_NAME}/Binary_App
# set special permissions
ssh -p $PORT root@$IPOD "chmod +s /private/var/stash/Applications/${WRAPPER_NAME}/Binary_App_"
ssh -p $PORT root@$IPOD "chmod +x /private/var/stash/Applications/${WRAPPER_NAME}/Binary_App"

Set IPOD and PORT as appropriate. ${WRAPPER_NAME} is the name of the app as saved on disk, with the .app extension.

Actually, this could be done if you need your app to be installed as a normal App Store app as well, you'd just need to find out where it's been installed to and adjust the paths as appropriate.

You'll obviously need to have SSH installed and activated on your device (available on Cydia).

Community
  • 1
  • 1
newenglander
  • 2,019
  • 24
  • 55