[SDC-29] rebase continue work to align source
[sdc.git] / test-apis-ci / src / test / resources / CI / tests / getServiceArtifactListTest / resource1 / scripts / install_mysql.sh
1 #!/bin/bash
2
3 echo "Debian based MYSQL install 5..."
4 LOCK="/tmp/lockaptget"
5
6 while true; do
7   if mkdir "${LOCK}" &>/dev/null; then
8     echo "MySQL take the lock"
9     break;
10   fi
11   echo "Waiting the end of one of our recipes..."
12   sleep 0.5
13 done
14
15 while sudo fuser /var/lib/dpkg/lock >/dev/null 2>&1 ; do
16   echo "Waiting for other software managers to finish..."
17   sleep 0.5
18 done
19 sudo rm -f /var/lib/dpkg/lock
20
21 sudo apt-get update || (sleep 15; sudo apt-get update || exit ${1})
22 sudo DEBIAN_FRONTEND=noninteractive apt-get -y install mysql-server-5.5 pwgen || exit ${1}
23 rm -rf "${LOCK}"
24
25 sudo /etc/init.d/mysql stop
26 sudo rm -rf /var/lib/apt/lists/*
27 sudo rm -rf /var/lib/mysql/*
28 echo "MySQL Installation complete."