From ed9ac4338b9c4e7327954e71a9da4855224e4f1a Mon Sep 17 00:00:00 2001 From: parazyd Date: Sat, 15 Apr 2017 17:29:36 +0200 Subject: [PATCH] safety check for unavailable packages when installing $extra_packages --- zlibs/bootstrap | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/zlibs/bootstrap b/zlibs/bootstrap index ff294eb..a2ef358 100644 --- a/zlibs/bootstrap +++ b/zlibs/bootstrap @@ -151,6 +151,19 @@ bootstrap_tar_unpack() { cat </dev/null #!/bin/sh apt-get update + +## check if all our extra_packages exist +allpkgs="\$(apt-cache search '.' | cut -d' ' -f1)" +for i in ${extra_packages} ; do + printf "%s" "\$allpkgs" | grep -q "^\$i$" || missing="\$missing \$i" +done + +[ -n "\$missing" ] && { + printf "\033[1;31m[!!] some extra packages don't exist\033[0m\n" + printf "%s\n" "\$missing" + exit 1 +} + apt-get --yes --force-yes upgrade apt-get --yes --force-yes install ${extra_packages} apt-get --yes --force-yes autoremove