cleanExtraSources(){ mkdir -p config/archives/ rm -f config/archives/extra-ppas.list.chroot \ config/archives/extra-ppas.pref.chroot \ config/archives/extra-ppas.key.chroot || true } addPPA(){ gpg_tmpdir="$(mktemp -d)" run_gpg () { gpg --no-default-keyring --no-options --homedir "$gpg_tmpdir" \ --secret-keyring "$gpg_tmpdir/secring.gpg" \ --keyserver hkp://keyserver.ubuntu.com:80/ \ "$@" } for extra_ppa in $@; do extra_ppa_pin='' extra_ppa_origin='' case $extra_ppa in *:*) extra_ppa_pin=${extra_ppa#*:} extra_ppa=${extra_ppa%:*} ;; esac extra_ppa_fingerprint="$(/usr/share/livecd-rootfs/get-ppa-fingerprint "$extra_ppa")" echo "deb http://ppa.launchpad.net/$extra_ppa/ubuntu @DISTRIBUTION@ main" >> config/archives/extra-ppas.list.chroot echo "deb-src http://ppa.launchpad.net/$extra_ppa/ubuntu @DISTRIBUTION@ main" >> config/archives/extra-ppas.list.chroot if [ -n "$extra_ppa_pin" ]; then extra_ppa_origin="LP-PPA-$(echo $extra_ppa | sed -e 's,/ppa$,,' -e 's,/,-,')" echo "Package: *" >> config/archives/extra-ppas.pref.chroot echo "Pin: release o=$extra_ppa_origin" >> config/archives/extra-ppas.pref.chroot echo "Pin-Priority: $extra_ppa_pin" >> config/archives/extra-ppas.pref.chroot echo "" >> config/archives/extra-ppas.pref.chroot fi run_gpg --keyring "$gpg_tmpdir/pubring.gpg" \ --recv "$extra_ppa_fingerprint" run_gpg --keyring "$gpg_tmpdir/pubring.gpg" \ --output "$gpg_tmpdir/export.gpg" \ --export "$extra_ppa_fingerprint" got_fingerprint="$( run_gpg --keyring "$gpg_tmpdir/export.gpg" \ --fingerprint --batch --with-colons | grep '^fpr:' | cut -d: -f10)" if [ "$got_fingerprint" != "$extra_ppa_fingerprint" ]; then echo "Fingerprints do not match. Got:" >&2 echo "$got_fingerprint" | sed 's/^/ /' >&2 echo "Expected:" >&2 echo " $extra_ppa_fingerprint" >&2 exit 1 fi cat "$gpg_tmpdir/export.gpg" >> config/archives/extra-ppas.key.chroot rm -f "$gpg_tmpdir/export.gpg" done rm -rf "$gpg_tmpdir" cp -a config/archives/extra-ppas.list.chroot \ config/archives/extra-ppas.list.binary cp -a config/archives/extra-ppas.key.chroot \ config/archives/extra-ppas.key.binary if [ -f config/archives/extra-ppas.pref.chroot ]; then cp -a config/archives/extra-ppas.pref.chroot \ config/archives/extra-ppas.pref.binary fi } addExtraMirror(){ for extra_mirror in $@; do echo "deb $extra_mirror @DISTRIBUTION@ main restricted universe multiverse" >> config/archives/extra-ppas.list.chroot done } addExtraMirrorUntrusted(){ for extra_mirror in $@; do echo "deb [trusted=yes] $extra_mirror @DISTRIBUTION@ main restricted universe multiverse" >> config/archives/extra-ppas.list.chroot done }