From ad1a11782f4c4a7c408b54be492f432da620b335 Mon Sep 17 00:00:00 2001 From: Gabriel Cossette Date: Thu, 1 Jul 2021 23:09:09 +0000 Subject: [PATCH] update --- manifest.json | 8 ++++++++ scripts/install | 27 ++++++++++++++++++++++----- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/manifest.json b/manifest.json index 2d0cd63..596085d 100644 --- a/manifest.json +++ b/manifest.json @@ -88,6 +88,14 @@ "en": "A public WordPress will be publicly visible for everyone. If you're looking for a public blog, you should choose to install a public WordPress.", "fr": "Un WordPress public sera visible publiquement pour tous. Si vous recherchez un blog public, vous devriez choisir d'installer un WordPress public." } + }, + { + "name": "repo", + "type": "string", + "ask": { + "en": "If Git repo, enter here", + "fr": "Si dépôt Git, entrez ici" + } } ] } diff --git a/scripts/install b/scripts/install index 46dfeb6..c40d70e 100644 --- a/scripts/install +++ b/scripts/install @@ -26,6 +26,7 @@ admin_wordpress=$YNH_APP_ARG_ADMIN language=$YNH_APP_ARG_LANGUAGE multisite=$YNH_APP_ARG_MULTISITE is_public=$YNH_APP_ARG_IS_PUBLIC +repo=$YNH_APP_ARG_REPO app=$YNH_APP_INSTANCE_NAME @@ -54,6 +55,7 @@ ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=admin --value=$admin_wordpress ynh_app_setting_set --app=$app --key=language --value=$language ynh_app_setting_set --app=$app --key=multisite --value=$multisite +ynh_app_setting_set --app=$app --key=repo --value=$repo ynh_app_setting_set --app=$app --key=overwrite_nginx --value=1 ynh_app_setting_set --app=$app --key=overwrite_phpfpm --value=1 @@ -70,14 +72,28 @@ db_name=$(ynh_sanitize_dbid --db_name=$app) ynh_app_setting_set --app=$app --key=db_name --value=$db_name ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name +#================================================= +# CLONE REPO IF REQUIRED +#================================================= + +if [ -n $repo ] +then + GIT_SSH_COMMAND='ssh -i /etc/yunohost/sshkey -o IdentitiesOnly=yes' git clone $repo $final_path + git config --file $final_path/.git/config core.sshCommand "ssh -i /etc/yunohost/sshkey" +fi + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Setting up source files..." --weight=4 -ynh_app_setting_set --app=$app --key=final_path --value=$final_path -# Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir="$final_path" +if [ ! -d /var/www/$app/wp-admin ]; +then + ynh_script_progression --message="Setting up source files..." --weight=4 + + ynh_app_setting_set --app=$app --key=final_path --value=$final_path + # Download, check integrity, uncompress and patch the source from app.src + ynh_setup_source --dest_dir="$final_path" +fi #================================================= # NGINX CONFIGURATION @@ -133,6 +149,7 @@ done #================================================= # SETTING UP WITH CURL #================================================= + ynh_script_progression --message="Installing wordpress with cURL..." --weight=10 # Set right permissions for cURL install @@ -168,7 +185,7 @@ done #================================================= ynh_script_progression --message="Installing WordPress plugins..." --weight=20 -ynh_exec_warn_less wget --no-verbose https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar --output-document/usr/local/bin/wp +ynh_exec_warn_less wget --no-verbose https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar --output-document=/usr/local/bin/wp chmod +x /usr/local/bin/wp wpcli_alias="php$phpversion /usr/local/bin/wp --allow-root --path=$final_path"