Browse Source

Update "naughty-from.sh" to have a better message for fully-unsupported FROMs

Tianon Gravi 6 years ago
parent
commit
50d566f2e8
1 changed files with 16 additions and 2 deletions
  1. 16 2
      naughty-from.sh

+ 16 - 2
naughty-from.sh

@@ -71,10 +71,14 @@ declare -A naughtyFromsArches=(
 	#[img:tag=from:tag]='arch arch ...'
 )
 naughtyFroms=()
+declare -A allNaughty=(
+	#[img:tag]=1
+)
 
 tags="$(bashbrew list --uniq "$@" | sort -u)"
 for img in $tags; do
 	arches="$(_arches "$img")"
+	hasNice= # do we have _any_ arches that aren't naughty? (so we can make the message better if not)
 	for BASHBREW_ARCH in $arches; do
 		export BASHBREW_ARCH
 
@@ -105,15 +109,25 @@ for img in $tags; do
 					naughtyFromsArches["$img=$from"]+=', '
 				fi
 				naughtyFromsArches["$img=$from"]+="$BASHBREW_ARCH"
+			else
+				hasNice=1
 			fi
 		done
 	done
+
+	if [ -z "$hasNice" ]; then
+		allNaughty["$img"]=1
+	fi
 done
 
 for naughtyFrom in "${naughtyFroms[@]:-}"; do
 	[ -n "$naughtyFrom" ] || continue # https://mywiki.wooledge.org/BashFAQ/112#BashFAQ.2F112.line-8 (empty array + "set -u" + bash 4.3 == sad day)
 	img="${naughtyFrom%%=*}"
 	from="${naughtyFrom#$img=}"
-	arches="${naughtyFromsArches[$naughtyFrom]}"
-	echo " - $img (FROM $from) [$arches]"
+	if [ -n "${allNaughty["$img"]:-}" ]; then
+		echo " - $img (FROM $from) -- completely unsupported base!"
+	else
+		arches="${naughtyFromsArches[$naughtyFrom]}"
+		echo " - $img (FROM $from) [$arches]"
+	fi
 done