Skip to content

Instantly share code, notes, and snippets.

@mschwartz
Last active July 19, 2016 20:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save mschwartz/9365e9d56bb6166b83ea to your computer and use it in GitHub Desktop.
Save mschwartz/9365e9d56bb6166b83ea to your computer and use it in GitHub Desktop.
"Run Script" for React Native automatic IP configuration
INFOPLIST="${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"
echo "writing to $INFOPLIST"
PLISTCMD="Add :SERVER_IP string $(ifconfig | grep inet\ | tail -1 | cut -d " " -f 2)"
echo -n "$INFOPLIST" | xargs -0 /usr/libexec/PlistBuddy -c "$PLISTCMD" || true
PLISTCMD="Set :SERVER_IP $(ifconfig | grep inet\ | tail -1 | cut -d " " -f 2)"
echo -n "$INFOPLIST" | xargs -0 /usr/libexec/PlistBuddy -c "$PLISTCMD" || true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment