@@ -3,17 +3,14 @@ set -euo pipefail
33
44# Exit codes:
55# 0 - success
6- # 2 - usage / bad args
76# 3 - missing dependency (jq)
87# 4 - manifest.json not found
98# 5 - manifest.json exists but is not a regular file
109# 6 - manifest.json is not valid JSON
1110# 7 - missing required JSON keys
11+ # 8 - missing files in the supportpkg
12+ # 9 - missing files in the manifest
1213
13- usage () {
14- echo " Usage: $0 <directory-containing-manifest.json>" >&2
15- exit 2
16- }
1714if [[ ${# } -ne 1 ]]; then
1815 usage
1916fi
@@ -75,5 +72,23 @@ if [[ ${#missing[@]} -ne 0 ]]; then
7572 exit 7
7673fi
7774
78- echo " OK: $manifest is valid and contains all required keys"
75+ # Check that there is a 1:1 correspondence between manifest and tarball content
76+
77+ find " ${dir} " -type f -mindepth 1 | cut -c " $(( ${# dir} + 1 )) " - > find-output.txt
78+ jq -r ' .commands[].output' " ${dir} " /manifest.json > manifest-output.txt
79+ printf " /manifest.json\n/supportpkg.log" >> manifest-output.txt
80+ if grep -vxFf find-output.txt manifest-output.txt > /dev/null; then
81+ echo " ERROR: Manifest contains files not present in the supportpkg:"
82+ grep -vxFf find-output.txt manifest-output.txt
83+ exit 8
84+ fi
85+ if grep -vxFf manifest-output.txt find-output.txt > /dev/null; then
86+ echo " ERROR: Supportpkg contains files not present in the manifest:"
87+ grep -vxFf manifest-output.txt find-output.txt
88+ exit 9
89+ fi
90+
91+ # All good if we reached this point
92+
93+ echo " OK: $manifest is valid and consistent with the supportpkg contents"
7994exit 0
0 commit comments