From eca913a446147c752bd47d8aef823b17fa5fba57 Mon Sep 17 00:00:00 2001 From: Kayou Date: Mon, 28 Jan 2019 01:52:20 +0100 Subject: [PATCH] Fix install and rework script --- conf/app.src | 3 +-- conf/php-fpm.conf | 2 +- scripts/install | 32 ++++++++++++++++++++++++++------ 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/conf/app.src b/conf/app.src index 7cdfd5e..bab6d17 100644 --- a/conf/app.src +++ b/conf/app.src @@ -2,5 +2,4 @@ SOURCE_URL=http://download.dotclear.org/latest/dotclear-2.14.3.tar.gz SOURCE_SUM=c71fac022028b399ae4560a34da85f38 SOURCE_SUM_PRG=md5sum SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=dotclear-2.14.3.tar.gz \ No newline at end of file +SOURCE_IN_SUBDIR=true \ No newline at end of file diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index 03ce220..bf04ce6 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -30,7 +30,7 @@ group = __USER__ ; specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; Note: This value is mandatory. -listen = /var/run/php5-fpm-__NAMETOCHANGE__.sock +listen = /var/run/php/php7.0-fpm-__NAMETOCHANGE__.sock ; Set listen(2) backlog. A value of '-1' means unlimited. ; Default Value: 128 (-1 on FreeBSD and OpenBSD) diff --git a/scripts/install b/scripts/install index 64bcba2..60a1df3 100755 --- a/scripts/install +++ b/scripts/install @@ -61,9 +61,9 @@ ynh_app_setting_set $app password $password db_name=$(ynh_sanitize_dbid $app) ynh_app_setting_set $app db_name $db_name -ynh_mysql_setup_db $admin $db_name +ynh_mysql_setup_db $app $db_name -db_pwd=$(ynh_app_setting_get $app db_pwd) +db_pwd=$(ynh_app_setting_get $app mysqlpwd) #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -98,8 +98,6 @@ ynh_add_fpm_config php_config=$final_path/inc/config.php -echo $(ls $final_path) - master_key=`dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{24\}\).*/\1/p'` firstname=`sudo yunohost user info $admin | grep firstname: | cut -d' ' -f2 | tr -d '\n'` lastname=`sudo yunohost user info $admin | grep lastname: | cut -d' ' -f2 | tr -d '\n'` @@ -112,8 +110,30 @@ sudo cp $php_config.in $php_config sudo sed -i -e "s;'DC_DBDRIVER', '';'DC_DBDRIVER', 'mysqli';" -e "s;'DC_DBHOST', '';'DC_DBHOST', 'localhost';" -e "s;'DC_DBUSER', '';'DC_DBUSER', '$app';" -e "s;'DC_DBPASSWORD', '';'DC_DBPASSWORD', '$db_pwd';" -e "s;'DC_DBNAME', '';'DC_DBNAME', '$db_name';" -e "s;'DC_MASTER_KEY', '';'DC_MASTER_KEY', '$master_key';" -e "s;'DC_ADMIN_URL', '';'DC_ADMIN_URL', 'https://$domain$path_url/admin/index.php';" -e "s;'DC_ADMIN_MAILFROM', '';'DC_ADMIN_MAILFROM', '$email';" $php_config # Modify Nginx configuration file and copy it to Nginx conf directory -# Setting first user details and filling database calling admin/install/index.php -success=`curl -L --cacert /etc/yunohost/certs/$domain/ca.pem -F "u_email=$email" -F "u_firstname=$firstname" -F "u_name=$lastname" -F "u_login=$admin" -F "u_pwd=$password" -F "u_pwd2=$password" -F "u_date=$timezone" https://$domain$path_url/admin/install/index.php` +#================================================= +# SETUP APPLICATION WITH CURL +#================================================= + +# Set right permissions for curl install +chown -R $app: $final_path + +# Set the app as temporarily public for curl call +ynh_app_setting_set $app skipped_uris "/" + +# Reload SSOwat config +yunohost app ssowatconf + +# Reload Nginx +systemctl reload nginx + +# Installation with curl +ynh_local_curl "/admin/install/index.php" "u_email=$email" "u_firstname=$firstname" "u_name=$lastname" "u_login=$admin" "u_pwd=$password" "u_pwd2=$password" + +# Remove the public access +if [ $is_public -eq 0 ] +then + ynh_app_setting_delete $app skipped_uris +fi #================================================= # SETUP SSOWAT