File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,22 @@ cd "${KUBE_ROOT}"
24
24
# Files larger than 1MB need to be allowed explicitly.
25
25
maxsize=$(( 1 * 1024 * 1024 ))
26
26
27
+ run_stat () {
28
+ local file=" $1 "
29
+ case " $( uname -s) " in
30
+ Darwin)
31
+ stat -f %z " $file " | tr -d ' \n'
32
+ ;;
33
+ Linux)
34
+ stat --printf=%s " $file "
35
+ ;;
36
+ * )
37
+ kube::log::error " Unsupported host OS. Must be Linux or Mac OS X."
38
+ exit 1
39
+ ;;
40
+ esac
41
+ }
42
+
27
43
# Sorted list of those exceptions.
28
44
allowlist=(
29
45
staging/src/k8s.io/kubectl/images/kubectl-logo-full.png
@@ -42,7 +58,7 @@ largefiles () {
42
58
case " $tree " in
43
59
w/-text)
44
60
# Only binary files have a size limit.
45
- size=" $( stat --printf=%s " $file " ) "
61
+ size=" $( run_stat " $file " ) "
46
62
if [ " ${size} " -gt " $maxsize " ] &&
47
63
! kube::util::array_contains " $file " " ${allowlist[@]} " ; then
48
64
echo " $file is too large ($size bytes)"
You can’t perform that action at this time.
0 commit comments