2015-09-27 00:52:48 +02:00
|
|
|
set -e
|
|
|
|
|
|
|
|
# Retrieve arguments
|
|
|
|
domain=$1
|
|
|
|
path=$2
|
|
|
|
|
|
|
|
# Check domain/path availability
|
|
|
|
sudo yunohost app checkurl $domain$path -a noalyss
|
|
|
|
if [[ ! $? -eq 0 ]]; then
|
|
|
|
exit 1
|
|
|
|
fi
|
2015-09-27 00:52:56 +02:00
|
|
|
|
2015-09-27 01:21:26 +02:00
|
|
|
path=${path%/}
|
|
|
|
|
2015-09-27 02:28:36 +02:00
|
|
|
sudo apt-get install postgresql php5 php5-pgsql php5-gd php-gettext p7zip-full libgd2-xpm-dev -y
|
2015-09-27 00:53:26 +02:00
|
|
|
|
|
|
|
final_path=/var/www/noalyss
|
|
|
|
sudo mkdir -p $final_path
|
2015-09-27 01:07:02 +02:00
|
|
|
sudo cp -a ../sources/html/ $final_path
|
|
|
|
sudo cp -a ../sources/include/ $final_path
|
2015-09-27 00:57:36 +02:00
|
|
|
|
2015-09-27 01:07:30 +02:00
|
|
|
sudo chown -R www-data: $final_path
|
|
|
|
|
2018-04-13 21:20:12 +02:00
|
|
|
sudo yunohost app setting noalyss version -v "7.0.1.0"
|
2015-09-27 01:07:53 +02:00
|
|
|
|
2015-09-27 01:36:15 +02:00
|
|
|
if [[ "$path" == "" ]]; then
|
2015-09-27 02:54:32 +02:00
|
|
|
sed -i "s@PATHTOCHANGE@/@g" ../conf/nginx.conf
|
2015-09-27 01:36:15 +02:00
|
|
|
else
|
2015-09-27 02:54:32 +02:00
|
|
|
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
|
2015-09-27 01:36:15 +02:00
|
|
|
fi
|
2015-09-27 01:37:10 +02:00
|
|
|
|
2015-09-27 02:57:08 +02:00
|
|
|
sed -i "s@ALIASTOCHANGE@$final_path/html/@g" ../conf/nginx.conf
|
2015-09-27 02:54:32 +02:00
|
|
|
|
2015-09-27 01:46:52 +02:00
|
|
|
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/noalyss.conf
|
|
|
|
|
2015-09-27 01:37:10 +02:00
|
|
|
sed -i "s@NAMETOCHANGE@noalyss@g" ../conf/php-fpm.conf
|
2015-09-27 01:47:03 +02:00
|
|
|
|
2015-09-27 20:23:58 +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')
|
|
|
|
|
2015-09-28 00:19:53 +02:00
|
|
|
sudo su postgres -c "createuser -S -R --createdb noalyss"
|
|
|
|
sudo su postgres -c "psql -c \"ALTER USER noalyss with PASSWORD '$db_pwd';\""
|
2015-09-27 20:23:58 +02:00
|
|
|
|
|
|
|
sed -i "s@DATABASE_PASSWORD@$db_pwd@g" ../conf/noalyss.conf
|
2015-09-28 00:31:48 +02:00
|
|
|
sudo cp ../conf/noalyss.conf $final_path/include/config.inc.php
|
|
|
|
|
2015-09-27 01:47:03 +02:00
|
|
|
finalphpconf=/etc/php5/fpm/pool.d/noalyss.conf
|
|
|
|
|
|
|
|
sudo cp ../conf/php-fpm.conf $finalphpconf
|
|
|
|
sudo chown root: $finalphpconf
|
|
|
|
sudo chmod 644 $finalphpconf
|
2015-09-27 01:47:25 +02:00
|
|
|
|
|
|
|
# Reload Nginx and regenerate SSOwat conf
|
2015-09-27 01:47:38 +02:00
|
|
|
sudo service php5-fpm restart
|
2015-09-27 01:47:25 +02:00
|
|
|
sudo service nginx reload
|
|
|
|
sudo yunohost app ssowatconf
|
2015-09-27 22:57:03 +02:00
|
|
|
|
2015-09-28 01:24:32 +02:00
|
|
|
sudo yunohost app setting noalyss unprotected_uris -v "/"
|
2015-09-28 01:09:37 +02:00
|
|
|
sudo yunohost app ssowatconf
|
2015-09-27 23:29:49 +02:00
|
|
|
curl -kL -H "Host: $domain" -X POST https://127.0.0.1$path/admin/setup.php --data "go=yolo" > /dev/null 2>&1
|
2015-09-28 01:11:39 +02:00
|
|
|
sudo yunohost app setting noalyss unprotected_uris -v ""
|
2015-09-28 01:09:37 +02:00
|
|
|
sudo yunohost app ssowatconf
|
|
|
|
|
2015-09-27 22:57:03 +02:00
|
|
|
# su postgres -c "psql account_repository -c 'delete from ac_users;'"
|