From 790f5b41ee0192cdd4fd3f1095c365097966ef60 Mon Sep 17 00:00:00 2001 From: Bruno Tavares Date: Sun, 27 Sep 2015 13:20:33 -0300 Subject: [PATCH] Improves the logic around ppa addition kickstart will check if the ppa has already been added and only update the package cache the first time it is added. Further updates must be handled by hand. It also installs the required packages to manage the ppa over command line if it is not present yet. --- kickstart/recipes/kickstart/apt.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/kickstart/recipes/kickstart/apt.sh b/kickstart/recipes/kickstart/apt.sh index 747c2e4..0bb793b 100644 --- a/kickstart/recipes/kickstart/apt.sh +++ b/kickstart/recipes/kickstart/apt.sh @@ -1,6 +1,13 @@ kickstart.apt.ppa() { - kickstart.mute add-apt-repository -y "$1" - kickstart.package.update + if ! cat /etc/apt/sources.list.d/* | kickstart.stream.contains "${1#ppa:}"; then + if ! kickstart.command_exists add-apt-repository; then + kickstart.info "Required add-apt-repository command not found. Installing package." + kickstart.package.install python-software-properties || kickstart.package.install software-properties-common + fi + + kickstart.mute add-apt-repository -y "$1" + kickstart.package.update + fi } kickstart.apt.add_key_from_url() {