-
Notifications
You must be signed in to change notification settings - Fork 237
Expand file tree
/
Copy pathon-target
More file actions
executable file
·68 lines (62 loc) · 1.43 KB
/
on-target
File metadata and controls
executable file
·68 lines (62 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/sh
. gconfig
TUSER=${DISTRO:-ubuntu}
usage() {
echo "Usage: ${0##*/} [OPTION]... <command>"
echo "Run command on build target."
echo
cat << EOF
--help display this help and exit
--user|-u <username> run as <username> instead of ubuntu
--env|-e "NAME=VALUE ..." modify the environment
EOF
}
if [ $# != 0 ] ; then
while true ; do
case "$1" in
--help|-h)
usage
exit 0
;;
--user|-u)
TUSER="$2"
shift 2
;;
--env|-e)
ENV="$2"
shift 2
;;
--workdir|-w)
if [ -n "$USE_DOCKER" ]; then
if docker exec -u root -w /root gitian-target true > /dev/null 2>&1; then
# newer docker version is strict about non-default-user working dir
TWORKDIR="-w $2"
fi
shift 2
else
echo "unrecognized option $1"
exit 1
fi
;;
--*)
echo "unrecognized option $1"
exit 1
;;
*)
break
;;
esac
done
fi
#if [ $# = 0 ] ; then
# usage
# exit 1
#fi
if [ -n "$USE_DOCKER" ]; then
docker exec -u $TUSER $TWORKDIR -i gitian-target $*
elif [ -z "$USE_LXC" ]; then
ssh -oConnectTimeout=30 -oNoHostAuthenticationForLocalhost=yes -i ${GITIAN_BASE:-.}/var/id_rsa -p $VM_SSH_PORT $TUSER@localhost $*
else
config-lxc
sudo $LXC_EXECUTE -n gitian -f var/lxc.config -- sudo -u $TUSER $ENV -i -- $*
fi