safety check for unavailable packages when installing $extra_packages

This commit is contained in:
parazyd 2017-04-15 17:29:36 +02:00
parent 063f900791
commit ed9ac4338b
No known key found for this signature in database
GPG Key ID: F0CB28FCF78637DE
1 changed files with 13 additions and 0 deletions

View File

@ -151,6 +151,19 @@ bootstrap_tar_unpack() {
cat <<EOF | sudo tee ${strapdir}/postunpack >/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