diff --git a/install.sh b/install.sh index c05f5ce..588ce92 100755 --- a/install.sh +++ b/install.sh @@ -30,6 +30,14 @@ if [ -d "/etc/apache2/" ] || [ -d "/etc/php/" ] || [ -d "/etc/varnish/" ]; then sleep 5 fi +# check for dpkg lock +if lsof /var/lib/dpkg/lock-frontend ; then + echo "Could not get lock /var/lib/dpkg/lock-frontend" + echo "See output above for info on what is holding the lock." + echo "Wait for the command above to complete, then re-run this script." + exit 1 +fi + apt-get update # create local systemd dir @@ -56,6 +64,14 @@ if [ ! -d "/etc/mysql/" ]; then mysql -e "CREATE USER 'nagios'@'localhost' IDENTIFIED WITH mysql_native_password AS '';" mysqladmin flush-privileges +elif ! systemctl is-active --quiet mysql ; then + + echo "MySQL config dir exists, but MySQL/MariaDB server is not running." + echo "Check your server config and either make sure MySQL is running" + echo "or purge MySQL/MariaDB and all related packages (e.g. mysql-common)" + echo "from the server and then re-run this installer." + exit 1 + fi # Apache w/ PHP