install: Try apt-get update if the Ubuntu universe check fails.

On a system where ‘apt-get update’ has never been run, ‘apt-cache
policy’ may show no repositories at all.  Try to correct this with
‘apt-get update’ before giving up.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2021-12-16 16:01:15 -08:00 committed by Tim Abbott
parent 3138f7a73c
commit 0b454dda12
1 changed files with 6 additions and 2 deletions

View File

@ -232,8 +232,12 @@ EOF
;; ;;
esac esac
if [ "$os_id" = ubuntu ] && ! apt-cache policy \ has_universe() {
| grep -q "^ release v=$os_version_id,o=Ubuntu,a=$os_version_codename,n=$os_version_codename,l=Ubuntu,c=universe"; then apt-cache policy \
| grep -q "^ release v=$os_version_id,o=Ubuntu,a=$os_version_codename,n=$os_version_codename,l=Ubuntu,c=universe"
}
if [ "$os_id" = ubuntu ] && ! has_universe && ! { apt-get update && has_universe; }; then
set +x set +x
cat <<'EOF' cat <<'EOF'