add_ppa(): Ability to add URL formated sources.list entries with optional key ID appended

This commit is contained in:
Adam Gandelman 2012-01-12 03:39:01 -08:00
parent e10649b105
commit eab5e751fa
2 changed files with 20 additions and 2 deletions

View File

@ -106,10 +106,28 @@ function add_ppa {
add-apt-repository "$PPA_URL" || exit 1
return
fi
if [[ "${PPA:0:4}" == "ppa:" ]] ; then
if [[ "${PPA:0:4}" == "ppa:" ]] ; then
juju-log "glance: Configuring installation from custom PPA ($PPA)"
add-apt-repository -y "$PPA" || exit 1
return
fi
if [[ "${PPA:0:3}" == "deb" ]] ; then
juju-log "glance: Configuring installation from custom PPA URL ($PPA)"
if echo "$PPA" | grep -q "|" ; then
# gpg key id tagged to end of url folloed by a |
url=$(echo $PPA | cut -d'|' -f1)
key=$(echo $PPA | cut -d'|' -f2)
if [[ -n "$key" ]] ; then
juju-log "Importing repository key: $key"
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys "$key" || \
juju-log "WARN: Could not import key from keyserver: $key"
else
juju-log "No repository key specified"
url="$PPA"
fi
add-apt-repository -y "$url"
fi
return
fi
juju-log "glance: No PPA specified. Falling back to installation from Ubuntu archive."
}

View File

@ -1 +1 @@
47
53