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.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/bin/sh
  2. . gconfig
  3. TUSER=${DISTRO:-ubuntu}
  4. QUIET_FLAG="-vP"
  5. usage() {
  6. echo "Usage: ${0##*/} [OPTION]... <command>"
  7. echo "Run command on build target."
  8. echo
  9. cat << EOF
  10. --help display this help and exit
  11. --user=U run as U instead of ubuntu
  12. EOF
  13. }
  14. if [ $# != 0 ] ; then
  15. while true ; do
  16. case "$1" in
  17. --help|-h)
  18. usage
  19. exit 0
  20. ;;
  21. --user|-u)
  22. TUSER="$2"
  23. shift 2
  24. ;;
  25. --quiet|-q)
  26. QUIET_FLAG="-q"
  27. shift 1
  28. ;;
  29. --*)
  30. echo "unrecognized option $1"
  31. exit 1
  32. ;;
  33. *)
  34. break
  35. ;;
  36. esac
  37. done
  38. fi
  39. if [ $# = 0 ] ; then
  40. usage
  41. exit 1
  42. fi
  43. if [ -n "$USE_DOCKER" ]; then
  44. # Use tar, so that files are created with the correct owner on the host
  45. docker exec -u $TUSER gitian-target tar -C `dirname "$1"` -cf - `basename "$1"` | tar -C "$2" -xf -
  46. elif [ -z "$USE_LXC" ]; then
  47. src="${1%/}" # remove trailing / which triggers special rsync behaviour
  48. rsync --checksum -a $QUIET_FLAG -e "ssh -oConnectTimeout=30 -oNoHostAuthenticationForLocalhost=yes -i ${GITIAN_BASE:-.}/var/id_rsa -p $VM_SSH_PORT" "$TUSER@localhost:${src}" "$2"
  49. else
  50. config-lxc
  51. sudo $LXC_EXECUTE -n gitian -f var/lxc.config -- sudo -i -u $TUSER tar -C `dirname "$1"` -cf - `basename "$1"` | tar -C "$2" -xf -
  52. fi