From 8a017cee1e7a934aa00b6a8e0abde881da53f3fa Mon Sep 17 00:00:00 2001 From: A Holt Date: Fri, 7 Sep 2018 01:54:26 -0400 Subject: [PATCH] output far more understandable (if upgrading Ansible) --- scripts/ansible | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/scripts/ansible b/scripts/ansible index f8f1b0370..c12580715 100755 --- a/scripts/ansible +++ b/scripts/ansible @@ -15,8 +15,6 @@ echo -e 'ALTERNATIVES: Run scripts/ansible-2.6.x or scripts/ansible-2.5.x-deprec GOOD_VER="2.6.4" # Ansible version for OLPC XO laptops (pip install). # On other OS's we attempt to install/upgrade THE latest from PPA, which might provide an even more recent version of Ansible. CURR_VER="undefined" -# below are unused for future use -# URL="NA" export DEBIAN_FRONTEND=noninteractive @@ -71,13 +69,19 @@ else elif [ -f /etc/olpc-release ]; then echo "Please use pip package manager to update Ansible." exit 0 - #fi - #if [[ `grep -qi ansible /etc/apt/sources.list` ]] || [ -f /etc/apt/sources.list.d/ansible*.list ]; then - elif (grep -qi ansible /etc/apt/sources.list) || (ls /etc/apt/sources.list.d/*ansible*.list >/dev/null 2>&1) ; then + #elif [[ `grep -qi ansible /etc/apt/sources.list` ]] || [ -f /etc/apt/sources.list.d/ansible*.list ]; then + #elif (grep -qi ansible /etc/apt/sources.list) || (ls /etc/apt/sources.list.d/*ansible*.list >/dev/null 2>&1) ; then + #elif grep -r ansible /etc/apt; then + elif grep -qx "deb http://ppa.launchpad.net/ansible/ansible/ubuntu xenial main" /etc/apt/sources.list /etc/apt/sources.list.d/*.list; then #echo "Ansible repo(s) found within /etc/apt/sources.list*" - echo -e 'CONSIDER MANUAL INTERVENTION:\nANSIBLE REPO(S) FOUND WITHIN /etc/apt/sources.list AND/OR /etc/apt/sources.list.d/*ansible*.list -- MUST CONTAIN LINE "deb http://ppa.launchpad.net/ansible/ansible/ubuntu xenial main" IF YOU WANT THE LATEST ANSIBLE -- AND REMOVE ALL SIMILAR LINES TO ENSURE ANSIBLE UPDATES CLEANLY -- then re-run this script.\n' + #echo -e '\nCONSIDER MANUAL INTERVENTION:\nANSIBLE REPO(S) FOUND WITHIN /etc/apt/sources.list AND/OR /etc/apt/sources.list.d/*ansible*.list -- SHOULD CONTAIN LINE "deb http://ppa.launchpad.net/ansible/ansible/ubuntu xenial main" IF YOU WANT THE LATEST ANSIBLE -- AND REMOVE ALL SIMILAR LINES TO ENSURE ANSIBLE UPDATES CLEANLY -- then re-run this script.\n' + echo -e '\nThe latest Ansible will be installed using line "deb http://ppa.launchpad.net/ansible/ansible/ubuntu xenial main" correctly found in /etc/apt/sources.list and/or /etc/apt/sources.list.d/*.list' + echo -e '\nIF OTHER ANSIBLE REPOS ARE ALSO FOUND BELOW, PLEASE MANUALLY REMOVE THEM TO ENSURE ANSIBLE UPDATES CLEANLY -- then re-run this script to be sure:\n' + grep ansible /etc/apt/sources.list /etc/apt/sources.list.d/*.list + echo else - echo -e 'Upstream ansible source repo not found:\nPLEASE UNINSTALL ANSIBLE (run "apt purge ansible" or "pip uninstall ansible", depending how Ansible was originally installed) THEN RE-RUN THIS SCRIPT.' + echo -e '\nAnsible repo "deb http://ppa.launchpad.net/ansible/ansible/ubuntu xenial main" not found in /etc/apt/sources.list or /etc/apt/sources.list.d/*.list:' + echo -e '\nPLEASE UNINSTALL ANSIBLE (run "apt purge ansible" or "pip uninstall ansible", depending how Ansible was originally installed) THEN RE-RUN THIS SCRIPT.' exit 1 fi fi