From 121fb506eb0e2ea5a4f05fd61c67a4930c15406e Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 20 Aug 2023 14:03:12 +0200 Subject: [PATCH 1/3] Remove dependency on direct database calls during install - Use console autoinstall command instead which creates the local.config.php file and initializes the database - Use console addon enable to activate the ldapauth addon --- scripts/install | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/scripts/install b/scripts/install index 39c1463..07c6af2 100644 --- a/scripts/install +++ b/scripts/install @@ -119,12 +119,7 @@ ynh_add_nginx_config #================================================= # ADD A CONFIGURATION #================================================= -ynh_script_progression --message="Adding a configuration file..." --weight=1 - -ynh_add_config --template="../conf/local-sample.config.php" --destination="$final_path/config/local.config.php" - -# init db -ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < "$final_path/database.sql" +ynh_script_progression --message="Adding the LDAP Auth addon configuration file..." --weight=1 # LDAP addon config ynh_add_config --template="../conf/addon.config.php" --destination="$final_path/config/addon.config.php" @@ -145,7 +140,7 @@ chmod -R 775 "$final_path/view/smarty3" #================================================= # SETUP A CRON #================================================= -ynh_script_progression --message="Setuping a cron job..." --weight=1 +ynh_script_progression --message="Setting up the cron job..." --weight=1 ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" chown root: "/etc/cron.d/$app" @@ -154,14 +149,20 @@ chmod 644 "/etc/cron.d/$app" #================================================= # INSTALL FRIENDICA #================================================= +ynh_script_progression --message="Install Friendica..." --weight=1 -# Run composer pushd "$final_path" - ynh_exec_as "$app" php$phpversion bin/composer.phar install --no-dev --quiet - ynh_exec_as "$app" bin/console config system addon ldapauth -popd + # Import Composer dependencies + ynh_exec_as "$app" php$phpversion bin/composer.phar install --no-dev --quiet -ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" <<< "INSERT INTO addon (id, name, version, installed, hidden, timestamp, plugin_admin) VALUES (NULL, 'ldapauth', '', '1', '0', UNIX_TIMESTAMP(), '0');" + # Install application + ynh_exec_as "$app" php$phpversion bin/console.php autoinstall\ + --dbhost "$db_host" --dbdata "$db_name" --dbuser "$db_user" --dbpass "$db_pwd"\ + --admin "$email" --tz "$timezone" --lang "$language" --url "https://$domain$path_url" + + # Enable LDAP Auth addon + ynh_exec_as "$app" php$phpversion bin/console.php addon enable ldapauth +popd #================================================= # RELOAD NGINX From 1f1278cc2857e63b9318cefa23127d183e926120 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 20 Aug 2023 14:35:00 +0200 Subject: [PATCH 2/3] Replace unbound variable $db_host by expected value in install script Co-authored-by: eric_G <46165813+ericgaspar@users.noreply.github.com> --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 07c6af2..0afa4cd 100644 --- a/scripts/install +++ b/scripts/install @@ -157,7 +157,7 @@ pushd "$final_path" # Install application ynh_exec_as "$app" php$phpversion bin/console.php autoinstall\ - --dbhost "$db_host" --dbdata "$db_name" --dbuser "$db_user" --dbpass "$db_pwd"\ + --dbhost "localhost" --dbdata "$db_name" --dbuser "$db_user" --dbpass "$db_pwd"\ --admin "$email" --tz "$timezone" --lang "$language" --url "https://$domain$path_url" # Enable LDAP Auth addon From f360d9ae3bc43d21c190c6f544f9d0d250e4e97c Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 20 Aug 2023 15:07:34 +0200 Subject: [PATCH 3/3] add gmp module --- scripts/_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 93e094b..5128051 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -12,7 +12,7 @@ addons_version_commit="f922d69310f5229d2e9404f396d66453b2d19d90" # dependencies used by the app YNH_PHP_VERSION="7.4" -pkg_dependencies="php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-imagick php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-gd" +pkg_dependencies="php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-imagick php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-gmp" #================================================= # EXPERIMENTAL HELPERS