From 17cae12af84649b2aa78ff3fa7b784e5a1fc9e2e Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Wed, 25 Sep 2013 17:38:27 +0100 Subject: [PATCH] Add support to enable the universe repository. --- bootstrap-salt.sh | 45 +++++++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 263a2ec..f128c7d 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1116,6 +1116,26 @@ movefile() { # # Ubuntu Install Functions # +__enable_universe_repository() { + if [ "x$(grep -R universe /etc/apt/sources.list /etc/apt/sources.list.d/ | grep -v '#')" != "x" ]; then + # The universe repository is already enabled + return 0 + fi + + echodebug "Enabling the universe repository" + + # Ubuntu versions higher than 12.04 do not live in the old repositories + if [ $DISTRO_MAJOR_VERSION -gt 12 ] || ([ $DISTRO_MAJOR_VERSION -eq 12 ] && [ $DISTRO_MINOR_VERSION -gt 04 ]); then + add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) universe" || return 1 + elif [ $DISTRO_MAJOR_VERSION -lt 11 ] && [ $DISTRO_MINOR_VERSION -lt 10 ]; then + add-apt-repository "deb http://old-releases.ubuntu.com/ubuntu $(lsb_release -sc) universe" || return 1 + fi + + add-apt-repository -y "deb http://old-releases.ubuntu.com/ubuntu $(lsb_release -sc) universe" || return 1 + + return 0 +} + install_ubuntu_deps() { apt-get update if [ $DISTRO_MAJOR_VERSION -eq 12 ] && [ $DISTRO_MINOR_VERSION -gt 04 ] || [ $DISTRO_MAJOR_VERSION -gt 12 ]; then @@ -1123,21 +1143,13 @@ install_ubuntu_deps() { __apt_get_install_noinput software-properties-common || return 1 else __apt_get_install_noinput python-software-properties || return 1 - fi - - if [ "x$(grep -R universe /etc/apt/sources.list /etc/apt/sources.list.d/ | grep -v '#')" != "x" ]; then - __IS_UNIVERSE_ENABLED=$BS_TRUE - else - __IS_UNIVERSE_ENABLED=$BS_FALSE - fi + __enable_universe_repository || return 1 if [ $DISTRO_MAJOR_VERSION -lt 11 ] && [ $DISTRO_MINOR_VERSION -lt 10 ]; then add-apt-repository ppa:saltstack/salt || return 1 - add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) universe" || return 1 else add-apt-repository -y ppa:saltstack/salt || return 1 - add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) universe" || return 1 fi apt-get update @@ -1172,21 +1184,6 @@ install_ubuntu_daily_deps() { return 0 } -install_ubuntu_11_10_deps() { - apt-get update - __apt_get_install_noinput python-software-properties || return 1 - add-apt-repository -y 'deb http://us.archive.ubuntu.com/ubuntu/ oneiric universe' || return 1 - add-apt-repository -y ppa:saltstack/salt || return 1 - - apt-get update - - if [ $_UPGRADE_SYS -eq $BS_TRUE ]; then - __apt_get_upgrade_noinput || return 1 - fi - - return 0 -} - install_ubuntu_git_deps() { install_ubuntu_deps || return 1 __apt_get_install_noinput git-core python-yaml python-m2crypto python-crypto \