-
Notifications
You must be signed in to change notification settings - Fork 852
Expand file tree
/
Copy pathdiff.sh
More file actions
executable file
·57 lines (45 loc) · 1.26 KB
/
diff.sh
File metadata and controls
executable file
·57 lines (45 loc) · 1.26 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
#!/bin/bash
if [ -z "$1" ]; then
echo "usage: $0 <stable|test>" >&2
exit 2
fi
CHANNEL="$1"
# Determine subdomain based on channel
case "$CHANNEL" in
test)
SUBDOMAIN="test"
;;
stable)
SUBDOMAIN="get"
;;
*)
echo "Error: Invalid CHANNEL: $CHANNEL" >&2
exit 1
;;
esac
set -euo pipefail
DIFF_FOUND=0
if [[ ! -f "build/$CHANNEL/install.sh" ]]; then
echo "Error: build/$CHANNEL/install.sh not found" >&2
exit 1
fi
if [[ "$CHANNEL" == "stable" ]] && [[ ! -f "build/$CHANNEL/rootless-install.sh" ]]; then
echo "Error: build/$CHANNEL/rootless-install.sh not found" >&2
exit 1
fi
TMP_DIR=$(mktemp -d)
# Download and compare install.sh
curl -sfSL "https://$SUBDOMAIN.docker.com" -o "$TMP_DIR/install.sh"
echo "# Diff $CHANNEL install.sh"
if ! diff -u "$TMP_DIR/install.sh" "build/$CHANNEL/install.sh"; then
DIFF_FOUND=1
fi
# For stable channel, also compare rootless-install.sh
if [[ "$CHANNEL" == "stable" ]]; then
curl -sfSL "https://$SUBDOMAIN.docker.com/rootless" -o "$TMP_DIR/rootless-install.sh"
echo "# Diff $CHANNEL rootless-install.sh"
if ! diff -u "$TMP_DIR/rootless-install.sh" "build/$CHANNEL/rootless-install.sh"; then
DIFF_FOUND=1
fi
fi
exit $DIFF_FOUND