2015-09-28 22:13:34 +02:00
set -e
# Retrieve arguments
domain=$1
path=$2
# Check domain/path availability
2015-09-28 23:17:30 +02:00
sudo yunohost app checkurl $domain$path -a dolibarr
2015-09-28 22:13:34 +02:00
if [[ ! $? -eq 0 ]]; then
exit 1
fi
path=${path%/}
sudo yunohost app setting dolibarr version -v "3.8.0"
2015-09-28 23:02:46 +02:00
2015-09-28 23:17:30 +02:00
final_path=/var/www/dolibarr
2015-09-28 23:02:46 +02:00
sudo mkdir -p $final_path
sudo cp -a ../sources/dolibarr/* $final_path
2015-09-29 00:15:49 +02:00
sudo touch $final_path/htdocs/conf/conf.php
2015-09-28 23:02:46 +02:00
sudo chown -R www-data: $final_path
2015-09-28 23:07:52 +02:00
if [[ "$path" == "" ]]; then
sed -i "s@PATHTOCHANGE@/@g" ../conf/nginx.conf
else
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
fi
sed -i "s@ALIASTOCHANGE@$final_path/htdocs/@g" ../conf/nginx.conf
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/dolibarr.conf
2015-09-29 00:24:25 +02:00
sed -i "s@NAMETOCHANGE@dolibarr@g" ../conf/php-fpm.conf
2015-09-28 23:17:30 +02:00
2015-09-29 00:20:37 +02:00
finalphpconf=/etc/php5/fpm/pool.d/dolibarr.conf
2015-09-28 23:17:30 +02:00
2015-09-29 01:39:54 +02:00
db_pwd=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{24\}\).*/\1/p')
sudo yunohost app initdb dolibarr -p $db_pwd
2015-09-28 23:17:30 +02:00
sudo cp ../conf/php-fpm.conf $finalphpconf
sudo chown root: $finalphpconf
sudo chmod 644 $finalphpconf
2015-09-28 23:10:22 +02:00
# Reload Nginx and regenerate SSOwat conf
sudo service php5-fpm restart
sudo service nginx reload
sudo yunohost app ssowatconf
2015-09-29 16:20:08 +02:00
sudo yunohost app setting noalyss unprotected_uris -v "/"
sudo yunohost app ssowatconf
curl -kL -H "Host: $domain" -X POST https://127.0.0.1$path/install/setp1.php --data "testpost=ok&action=set&main_dir=%2Fvar%2Fwww%2Fdolibarr%2Fhtdocs&main_data_dir=%2Fvar%2Fwww%2Fdolibarr%2Fdocuments&main_url=https://$domain$path&db_name=dolibarr&db_type=mysqli&db_host=localhost&db_port=&db_prefix=llx_&db_user=dolibarr&db_pass=$db_pwd&selectlang=fr_FR" > /dev/null 2>&1
curl -kL -H "Host: $domain" -X POST https://127.0.0.1$path/install/setp2.php --data "testpost=ok&action=set&dolibarr_main_db_character_set=latin1&dolibarr_main_db_collation=latin1_swedish_ci&selectlang=fr_FR" > /dev/null 2>&1
curl -kL -H "Host: $domain" -X POST https://127.0.0.1$path/install/setp4.php --data "testpost=ok&action=set&selectlang=fr_FR" > /dev/null 2>&1
curl -kL -H "Host: $domain" -X POST https://127.0.0.1$path/install/setp5.php --data "testpost=ok&action=set&login=admin&pass=neutrinet&pass_verif=neutrinet&selectlang=fr_FR" > /dev/null 2>&1
sudo yunohost app setting noalyss unprotected_uris -v ""
sudo yunohost app ssowatconf
# TODO
# Attention, pour des raisons de sécurité, afin de bloquer une nouvelle utilisation des outils d'installation/migration, une fois l'installation terminée, il est conseillé de placer dans le répertoire document de Dolibarr un fichier nommé install.lock en lecture seule.