-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjoin.bash
More file actions
executable file
·47 lines (41 loc) · 964 Bytes
/
Copy pathjoin.bash
File metadata and controls
executable file
·47 lines (41 loc) · 964 Bytes
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
#!/usr/bin/env bash
set -euo pipefail
IMAGE_REPOSITORY="${JACKAL_AUTONOMY_REPOSITORY:-kumarrobotics/jackal_autonomy}"
IMAGE="${JACKAL_AUTONOMY_IMAGE:-${IMAGE_REPOSITORY}:${JACKAL_AUTONOMY_TAG:-latest}}"
usage() {
echo "Usage: $0 [-t|--tag TAG]"
}
while [ "$#" -gt 0 ]; do
case "$1" in
-t|--tag)
if [ "$#" -lt 2 ] || [ -z "$2" ]; then
echo "ERROR: $1 requires a tag."
usage
exit 2
fi
IMAGE="${IMAGE_REPOSITORY}:$2"
shift 2
;;
-h|--help)
usage
exit 0
;;
*)
echo "ERROR: Unknown argument: $1"
usage
exit 2
;;
esac
done
container_id="$(docker ps --quiet --filter "ancestor=$IMAGE" | head -n 1)"
if [ -z "$container_id" ]; then
echo "ERROR: No running container found for image: $IMAGE"
exit 1
fi
docker exec \
--privileged \
-e "DISPLAY=${DISPLAY:-}" \
-e "LINES=$(tput lines 2>/dev/null || echo 24)" \
-it \
"$container_id" \
bash