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.

on-target 985B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/bin/sh
  2. . gconfig
  3. TUSER=ubuntu
  4. usage() {
  5. echo "Usage: ${0##*/} [OPTION]... <command>"
  6. echo "Run command on build target."
  7. echo
  8. cat << EOF
  9. --help display this help and exit
  10. --user <username> run as <username> instead of ubuntu
  11. EOF
  12. }
  13. if [ $# != 0 ] ; then
  14. while true ; do
  15. case "$1" in
  16. --help|-h)
  17. usage
  18. exit 0
  19. ;;
  20. --user|-u)
  21. TUSER="$2"
  22. shift 2
  23. ;;
  24. --*)
  25. echo "unrecognized option $1"
  26. exit 1
  27. ;;
  28. *)
  29. break
  30. ;;
  31. esac
  32. done
  33. fi
  34. #if [ $# = 0 ] ; then
  35. # usage
  36. # exit 1
  37. #fi
  38. if [ -z "$USE_LXC" ]; then
  39. ssh -oConnectTimeout=30 -oNoHostAuthenticationForLocalhost=yes -i ${GITIAN_BASE:-.}/var/id_dsa -p $VM_SSH_PORT $TUSER@localhost $*
  40. else
  41. config-lxc
  42. if [ $TUSER = "root" ]; then
  43. sudo lxc-start -n gitian -f var/lxc.config -- sh -c "$*"
  44. else
  45. sudo lxc-start -n gitian -f var/lxc.config -- sudo -i -u $TUSER sh -c "$*"
  46. fi
  47. fi