Update install.sh

This commit is contained in:
qiaofeng1227 2022-08-16 11:18:40 +08:00 committed by GitHub
parent 5fefc84f5b
commit 4db484236f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -37,9 +37,6 @@ echo $repo_init
echo "Pre-installation is starting, please wait for 1-3 minutes..."
# python2 -m pip == pip2
# python3 -m pip == pip3
# pip is already installed if you are using Python 2 >=2.7.9 or Python 3 >=3.4
# OracleLinux need install oaclelinux-developer-release-e* oracle-nodejs-release-e* oracle-epel-release-e* in Image before this script
if command -v yum > /dev/null; then
@ -48,9 +45,6 @@ if command -v yum > /dev/null; then
sudo yum install -y epel-release 1>/dev/null 2>&1
sudo yum install yum-utils git libselinux-python git python python3 git -y 1>/dev/null 2>&1
sudo yum install python-pip -y 1>/dev/null 2>&1
sudo yum install python2-pip -y 1>/dev/null 2>&1
sudo yum install python3-pip -y 1>/dev/null 2>&1
sudo python3 -m pip install -U --force-reinstall requests docker 1>/dev/null 2>&1
if command -v amazon-linux-extras > /dev/null; then
echo "amazon-linux-extras install ansible2"
@ -64,37 +58,22 @@ fi
if command -v apt > /dev/null; then
sudo apt-get update 1>/dev/null 2>&1
sudo apt-get install git python python3 git -y 1>/dev/null 2>&1
sudo apt-get install python-pip -y 1>/dev/null 2>&1
sudo apt-get install python2-pip -y 1>/dev/null 2>&1
sudo apt-get install python3-pip -y 1>/dev/null 2>&1
if [[ $(cat /etc/os-release |grep VERSION_CODENAME |cut -d= -f2) == xenial ]];then
curl -fsSL -o- https://bootstrap.pypa.io/pip/3.5/get-pip.py | python3.5
fi
sudo python3 -m pip install -U --force-reinstall requests docker 1>/dev/null 2>&1
sudo apt-get update 1>/dev/null 2>&1
sudo apt install software-properties-common -y 1>/dev/null 2>&1
if [[ $(cat /etc/os-release |grep VERSION_CODENAME |cut -d= -f2) == focal ]];then
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o /tmp/get-pip.py 1>/dev/null 2>&1
python2 /tmp/get-pip.py 1>/dev/null 2>&1
echo "have ansible pkg"
elif [[ $(cat /etc/os-release |grep VERSION_CODENAME |cut -d= -f2) == bionic ]];then
sudo apt-add-repository --yes --update ppa:ansible/ansible
fi
sudo apt install ansible sshpass -y
fi
sudo python3 -m pip install --upgrade pip
sudo python2 -m pip -V
sudo python3 -m pip -V
sudo echo "Pre-installation has beend completed"
if [[ $repo_name != "" ]]
then
sudo rm -rf /tmp/ansible-$repo_name
cd /tmp
sudo git clone https://github.com/Websoft9/ansible-$repo_name.git
cd /tmp/ansible-$repo_name
ansible-galaxy install -r requirements.yml -f
sudo touch /tmp/ansible-$repo_name/hosts
sudo echo "localhost" > /tmp/ansible-$repo_name/hosts
ansible-playbook -i hosts $repo_name.yml -c local -e init=$repo_init
rm -rf stackhub
sudo git clone --depth=1 https://github.com/Websoft9/stackhub.git
cd stackhub/apps
sudo echo "localhost" > hosts
ansible-playbook -i hosts $repo_name.yml -c local -e init=$repo_init -e appname=$repo_name
echo "System must restart after 2s, then installation completed"; sleep 2 ; sudo reboot
fi