2011-01-30 21:12:02 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
. gconfig
|
|
|
|
|
|
|
|
TUSER=ubuntu
|
2011-07-17 01:27:23 +00:00
|
|
|
QUIET_FLAG=
|
2011-01-30 21:12:02 +00:00
|
|
|
|
|
|
|
usage() {
|
|
|
|
echo "Usage: ${0##*/} [OPTION]... <command>"
|
|
|
|
echo "Run command on build target."
|
|
|
|
echo
|
|
|
|
cat << EOF
|
|
|
|
--help display this help and exit
|
|
|
|
--user=U run as U instead of ubuntu
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ $# != 0 ] ; then
|
|
|
|
while true ; do
|
|
|
|
case "$1" in
|
|
|
|
--help|-h)
|
|
|
|
usage
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
--user|-u)
|
|
|
|
TUSER="$2"
|
|
|
|
shift 2
|
|
|
|
;;
|
2011-07-17 01:27:23 +00:00
|
|
|
--quiet|-q)
|
|
|
|
QUIET_FLAG="-q"
|
|
|
|
shift 1
|
|
|
|
;;
|
2011-01-30 21:12:02 +00:00
|
|
|
--*)
|
|
|
|
echo "unrecognized option $1"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
break
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $# = 0 ] ; then
|
|
|
|
usage
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2012-04-22 05:44:00 +00:00
|
|
|
if [ -z "$USE_LXC" ]; then
|
2012-04-22 20:31:01 +00:00
|
|
|
scp $QUIET_FLAG -r -oConnectTimeout=5 -oNoHostAuthenticationForLocalhost=yes -i ${GITIAN_BASE:-.}/var/id_dsa -P $VM_SSH_PORT $1 $TUSER@localhost:$2
|
2012-04-22 05:44:00 +00:00
|
|
|
else
|
|
|
|
config-lxc
|
|
|
|
tar -C `dirname "$1"` -cf - `basename "$1"` | sudo lxc-start -n gitian -f var/lxc.config -- sudo -i -u $TUSER tar -C "$2" -xf -
|
|
|
|
fi
|