-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·65 lines (45 loc) · 1.07 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·65 lines (45 loc) · 1.07 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
#!/usr/bin/env bash
set -Eeuo pipefail
dest="${1-}"
if [ -z "$dest" ]; then
echo "Destination is not passed"
exit 1
fi
if [ ! -d "$dest" ]; then
echo "Destination is not dir"
exit 1
fi
if ! dest="$(realpath "$dest")"; then
echo "Cannot get realpath for destination"
exit 1
fi
tag="git-crypt-output:cur"
if ! docker build --progress=plain -t "$tag" .; then
echo "Destination is not passed"
exit 1
fi
echo "git-crypt build in image $tag"
id=""
if ! id="$(docker create "$tag" "/no-exec")"; then
echo "Dummy image is not created!"
exit 1
fi
echo "Dummy container id $id"
not_copy=""
full_dest="${dest}/git-crypt"
if ! docker cp "$id:/git-crypt" "$full_dest"; then
not_copy="true"
fi
echo "Remove dummy container $id"
if ! docker rm -v "$id"; then
echo "Dummy container $id not removed"
fi
if ! docker image rm "$tag"; then
echo "Dummy container $id not removed"
fi
if [ -n "$not_copy" ]; then
echo "git-crypt not extracted from image $tag"
exit 1
fi
chmod 755 "$full_dest" || true
echo "Done! git-crypt now in ${full_dest}"