wikindx/docker-entrypoint-wikindx
2023-01-10 11:17:12 +01:00

44 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
/usr/bin/mysql_install_db -u mysql
/usr/bin/mysqld_safe --defaults-file=/etc/mysql/mariadb.cnf --basedir=/usr --socket=/var/run/mysqld/mysqld.sock --datadir='/var/lib/mysql' &
if [ ! -d /var/lib/mysql/wikindx6 ] ; then
sleep 1
mysql -u root < create.sql
fi
# for updating from old docker container
if [ -e /home/wikindx/index.php ]; then
echo -n "found application in config directory ..."
mv /home/wikindx/config.php /tmp/
rm /home/wikindx/* -rf
mv /tmp/config.php /home/wikindx/config.php
chown -R www-data.www-data /home/wikindx
echo "removed"
fi
# make sure a configuration file exists
if [ ! -e /home/wikindx/config.php ]; then
echo "no configuration file yet exist ..."
cp /var/www/html/wikindx/config.php.dist /home/wikindx/config.php
chown -R www-data.www-data /home/wikindx
echo "created"
fi
# make sure application is unpacked
if [ ! -e /var/www/html/wikindx/index.php ]; then
cd /var/www/html
tar jxf wikindx.tar.bz2
fi
# make sure configuration file is linked to application directory
if [ ! -e /var/www/html/wikindx/config.php ]; then
echo "No link to configuration found in application directory ..."
ln -s /home/wikindx/config.php /var/www/html/wikindx/config.php
chown -R www-data.www-data /var/www/html/wikindx
echo "created"
fi
docker-php-entrypoint apache2-foreground