mirror of
https://github.com/YunoHost-Apps/dolibarr_ynh.git
synced 2024-09-03 18:35:53 +02:00
49 lines
1.2 KiB
Text
49 lines
1.2 KiB
Text
set -e
|
|
|
|
# Retrieve arguments
|
|
domain=$1
|
|
path=$2
|
|
|
|
# Check domain/path availability
|
|
sudo yunohost app checkurl $domain$path -a dolibarr
|
|
if [[ ! $? -eq 0 ]]; then
|
|
exit 1
|
|
fi
|
|
|
|
path=${path%/}
|
|
|
|
sudo yunohost app setting dolibarr version -v "3.8.0"
|
|
|
|
final_path=/var/www/dolibarr
|
|
sudo mkdir -p $final_path
|
|
sudo cp -a ../sources/dolibarr/* $final_path
|
|
|
|
sudo touch $final_path/htdocs/conf/conf.php
|
|
sudo chown -R www-data: $final_path
|
|
|
|
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
|
|
|
|
sed -i "s@NAMETOCHANGE@dolibarr@g" ../conf/php-fpm.conf
|
|
|
|
finalphpconf=/etc/php5/fpm/pool.d/dolibarr.conf
|
|
|
|
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
|
|
|
|
sudo cp ../conf/php-fpm.conf $finalphpconf
|
|
sudo chown root: $finalphpconf
|
|
sudo chmod 644 $finalphpconf
|
|
|
|
# Reload Nginx and regenerate SSOwat conf
|
|
sudo service php5-fpm restart
|
|
sudo service nginx reload
|
|
sudo yunohost app ssowatconf
|