Fix Pkg to Only Add Weasel if Already Exists (#6977)
* Only add weasel if exists
* Simplify
diff --git a/pkg b/pkg
index e7c2d41..a9efc2b 100755
--- a/pkg
+++ b/pkg
@@ -155,9 +155,10 @@
 	esac
 done
 
+CMD=$("${COMPOSECMD[@]}" -f $COMPOSE_FILE config --services)
 # Weasel must be built first otherwise it will fail from build artifacts/cache in an environment that doesn't have git
 # e.g. the environment produced by `./pkg source`.
-PROJECTS="weasel"$'\n'"$("${COMPOSECMD[@]}" -f $COMPOSE_FILE config --services | sed '/^weasel$/d')"
+PROJECTS=$(grep -E "^weasel$" <<<"$CMD"; grep -Ev "^weasel$"<<<"$CMD")
 HELP_TEXT="$(cat <<HELP_TEXT
 Usage: $SELF [options] [projects]
   -7           Build RPMs targeting CentOS 7