mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
Simplified with elif/else
This commit is contained in:
parent
29225fc590
commit
e5c7508354
1 changed files with 12 additions and 12 deletions
|
@ -1,9 +1,9 @@
|
||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
# required to start loading IIAB with ansible
|
# required to start loading IIAB with ansible
|
||||||
GOOD_VER="2.4.2"
|
GOOD_VER="2.4.2"
|
||||||
FOUND="false"
|
|
||||||
# FAMILY="undefined" # NOT USED AS OF 2017-12-11
|
|
||||||
VER="undefined"
|
VER="undefined"
|
||||||
|
# FOUND="false". # NOT USED AS OF 2017-12-11
|
||||||
|
# FAMILY="undefined" # NOT USED AS OF 2017-12-11
|
||||||
# below are unused for future use
|
# below are unused for future use
|
||||||
# URL="NA"
|
# URL="NA"
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ if ! [ `which ansible-playbook` ]; then
|
||||||
yum -y install git bzip2 file findutils gzip hg svn sudo tar which unzip xz zip libselinux-python
|
yum -y install git bzip2 file findutils gzip hg svn sudo tar which unzip xz zip libselinux-python
|
||||||
yum -y install python-pip python-setuptools python-wheel patch
|
yum -y install python-pip python-setuptools python-wheel patch
|
||||||
yum -y install http://releases.ansible.com/ansible/rpm/release/epel-7-x86_64/ansible-2.4.2.0-1.el7.ans.noarch.rpm
|
yum -y install http://releases.ansible.com/ansible/rpm/release/epel-7-x86_64/ansible-2.4.2.0-1.el7.ans.noarch.rpm
|
||||||
FOUND="true"
|
# FOUND="true"
|
||||||
# FAMILY="redhat" # NOT USED AS OF 2017-12-11
|
# FAMILY="redhat" # NOT USED AS OF 2017-12-11
|
||||||
# elif [ -f /etc/fedora-release ]; then
|
# elif [ -f /etc/fedora-release ]; then
|
||||||
# VER=`grep VERSION_ID /etc/*elease | cut -d= -f2`
|
# VER=`grep VERSION_ID /etc/*elease | cut -d= -f2`
|
||||||
|
@ -31,7 +31,7 @@ if ! [ `which ansible-playbook` ]; then
|
||||||
yum -y install python-pip python-setuptools python-wheel patch
|
yum -y install python-pip python-setuptools python-wheel patch
|
||||||
pip install --upgrade pip setuptools wheel #EOL just do it
|
pip install --upgrade pip setuptools wheel #EOL just do it
|
||||||
pip install ansible==$GOOD_VER --disable-pip-version-check
|
pip install ansible==$GOOD_VER --disable-pip-version-check
|
||||||
FOUND="true"
|
# FOUND="true"
|
||||||
# FAMILY="olpc" # NOT USED AS OF 2017-12-11
|
# FAMILY="olpc" # NOT USED AS OF 2017-12-11
|
||||||
elif [ -f /etc/debian_version ] || [[ `grep -i raspbian /etc/*elease` ]]; then
|
elif [ -f /etc/debian_version ] || [[ `grep -i raspbian /etc/*elease` ]]; then
|
||||||
if [[ ! `grep -i ansible /etc/apt/sources.list` ]] && [ ! -f /etc/apt/sources.list.d/ansible ]; then
|
if [[ ! `grep -i ansible /etc/apt/sources.list` ]] && [ ! -f /etc/apt/sources.list.d/ansible ]; then
|
||||||
|
@ -40,15 +40,16 @@ if ! [ `which ansible-playbook` ]; then
|
||||||
>> /etc/apt/sources.list.d/ansible.list
|
>> /etc/apt/sources.list.d/ansible.list
|
||||||
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367
|
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367
|
||||||
fi
|
fi
|
||||||
FOUND="true"
|
# FOUND="true"
|
||||||
# FAMILY="debian" # NOT USED AS OF 2017-12-11
|
# FAMILY="debian" # NOT USED AS OF 2017-12-11
|
||||||
elif [[ `grep -i ubuntu /etc/lsb-release` ]] || [[ `grep -i ubuntu /etc/os-release` ]]; then
|
elif [[ `grep -i ubuntu /etc/lsb-release` ]] || [[ `grep -i ubuntu /etc/os-release` ]]; then
|
||||||
apt -y install python-pip python-setuptools python-wheel patch
|
apt -y install python-pip python-setuptools python-wheel patch
|
||||||
apt-add-repository -y ppa:ansible/ansible
|
apt-add-repository -y ppa:ansible/ansible
|
||||||
FOUND="true"
|
# FOUND="true"
|
||||||
# FAMILY="debian" # NOT USED AS OF 2017-12-11
|
# FAMILY="debian" # NOT USED AS OF 2017-12-11
|
||||||
fi
|
# fi
|
||||||
if [ ! $FOUND = "true" ]; then
|
# if [ ! $FOUND = "true" ]; then
|
||||||
|
else
|
||||||
echo "WARN: Could not detect distro or distro unsupported"
|
echo "WARN: Could not detect distro or distro unsupported"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -58,13 +59,12 @@ else
|
||||||
if [ -f /etc/centos-release ] || [ -f /etc/fedora-release ]; then
|
if [ -f /etc/centos-release ] || [ -f /etc/fedora-release ]; then
|
||||||
echo "Please use your system's package manager to update ansible"
|
echo "Please use your system's package manager to update ansible"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
elif [ -f /etc/olpc-release ]; then
|
||||||
if [ -f /etc/olpc-release ]; then
|
|
||||||
echo "Please use pip package manager to update ansible"
|
echo "Please use pip package manager to update ansible"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
#fi
|
||||||
#if [[ `grep -qi ansible /etc/apt/sources.list` ]] || [ -f /etc/apt/sources.list.d/ansible*.list ]; then
|
#if [[ `grep -qi ansible /etc/apt/sources.list` ]] || [ -f /etc/apt/sources.list.d/ansible*.list ]; then
|
||||||
if [[ `grep -i ansible /etc/apt/sources.list` ]] || ls /etc/apt/sources.list.d/ansible*.list >/dev/null 2>&1 ; then
|
elif [[ `grep -i ansible /etc/apt/sources.list` ]] || ls /etc/apt/sources.list.d/ansible*.list >/dev/null 2>&1 ; then
|
||||||
echo "Ansible repo(s) found within /etc/apt/sources.list*"
|
echo "Ansible repo(s) found within /etc/apt/sources.list*"
|
||||||
else
|
else
|
||||||
echo "Upstream ansible source repo not found, please uninstall ansible and re-run this script"
|
echo "Upstream ansible source repo not found, please uninstall ansible and re-run this script"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue