Custom Anbox installation files & patches, including patched Android OS image file.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
830 B

  1. #!/bin/sh
  2. DNS_LOCAL="192.168.250.1.53"
  3. if [ "$(id -u)" -ne 0 ]; then
  4. echo "ERROR: You need to run this script as root!"
  5. exit 1
  6. fi
  7. CONTAINER_PATH="$SNAP_COMMON/containers"
  8. CONTAINER_NAME=default
  9. if [ -z "$SNAP" ] ; then
  10. CONTAINER_PATH=/var/lib/anbox/containers
  11. fi
  12. state=$(lxc-info -P "$CONTAINER_PATH" -n "$CONTAINER_NAME" -s | cut -d':' -f 2 | tr -d '[:space:]')
  13. if [ "$state" != "RUNNING" ] ; then
  14. echo "ERROR: Cannot attach to container as it is not running"
  15. exit 1
  16. fi
  17. exec lxc-attach \
  18. -P "$CONTAINER_PATH" \
  19. -n "$CONTAINER_NAME" \
  20. --clear-env -- \
  21. /system/bin/sh -c \
  22. "/system/bin/iptables -t nat -A OUTPUT -o eth0 -p tcp -m tcp --dport 53 -j DNAT --to-destination ${DNS_LOCAL}
  23. /system/bin/iptables -t nat -A OUTPUT -o eth0 -p udp -m udp --dport 53 -j DNAT --to-destination ${DNS_LOCAL}"