diff --git a/README.md b/README.md index e9ad3d4..12001cd 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ However, with a YesWiki we can build a website with multiple uses: - Cultivate a bit of freedom... -**Shipped version:** 4.4.1~ynh2 +**Shipped version:** 4.4.2~ynh2 **Demo:** https://ferme.yeswiki.net/?CreerSonWiki diff --git a/README_fr.md b/README_fr.md index 3bb304c..fea6798 100644 --- a/README_fr.md +++ b/README_fr.md @@ -26,7 +26,7 @@ Néanmoins, avec un YesWiki on peut fabriquer un site internet aux usages multip - Cultiver un bout de liberté... -**Version incluse :** 4.4.1~ynh2 +**Version incluse :** 4.4.2~ynh2 **Démo :** https://ferme.yeswiki.net/?CreerSonWiki diff --git a/manifest.toml b/manifest.toml index 225d77a..29a4842 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "YesWiki" description.en = "Wiki that is quick and easy to use" description.fr = "Wiki facile et rapide à prendre en main" -version = "4.4.1~ynh2" +version = "4.4.2~ynh2" maintainers = ["Florian Schmitt", "Nils Van Zuijlen", "Plumf"] @@ -60,10 +60,14 @@ ram.runtime = "50M" [resources] [resources.sources.main] - url = "https://github.com/YesWiki/yeswiki/archive/refs/tags/v4.4.1.tar.gz" - sha256 = "1f1a42b8596e4061b7f36c7956afcf097e90e8ea4963226cded587248f78e44f" + url = "https://github.com/YesWiki/yeswiki/archive/refs/tags/v4.4.2.tar.gz" + sha256 = "8c4fe3c0a0f76f47ab5b2c8399b437bd95548d6fa620c90c152a6acd56c25e99" autoupdate.strategy = "latest_github_tag" + [resources.sources.loginldap] + url = "https://repository.yeswiki.net/doryphore/extension-loginldap-1.0.0.zip" + sha256 = "40fe941d1eef191bb62cf454d3ee437d26d1d16181ab30d6a3602930d91a94bb" + [resources.system_user] [resources.install_dir] diff --git a/scripts/_common.sh b/scripts/_common.sh index 6e71054..a9bf588 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,31 +1 @@ #!/bin/bash - -#================================================= -# COMMON VARIABLES -#================================================= - -loginldap_version="2021-03-01-2" - -#================================================= -# PERSONAL HELPERS -#================================================= - -# update directory right -# | arg: app - The application's name ; default : yeswiki -# | arg: install_dir - The path of the application's folder -# yeswiki_update_dir_rights yeswiki /var/www/yeswiki -yeswiki_update_dir_rights() { - local app="${1:-yeswiki}" - local install_dir="${2}" - - chown -R $app:www-data $install_dir - chmod -R u=rwx,g=rx,o-rwx $install_dir -} - -#================================================= -# EXPERIMENTAL HELPERS -#================================================= - -#================================================= -# FUTURE OFFICIAL HELPERS -#================================================= diff --git a/scripts/install b/scripts/install index d037d33..327d570 100755 --- a/scripts/install +++ b/scripts/install @@ -17,8 +17,8 @@ ynh_script_progression --message="Setting up source files..." --weight=5 # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" -chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" +chown -R $app:www-data $install_dir +chmod -R u=rwX,g=rX,o-rwx $install_dir #================================================= # PHP-FPM CONFIGURATION @@ -47,7 +47,7 @@ ynh_exec_warn_less ynh_install_composer --phpversion="$phpversion" --workdir="$i # Installation with curl ynh_script_progression --message="Finalizing installation..." --weight=2 -admin_temp_pass=$(ynh_string_random 6) +admin_temp_pass=$(ynh_string_random 20) ynh_local_curl "/?PagePrincipale&installAction=install" "config[default_language]=$language" "config[wakka_name]=$wiki_name" \ "config[root_page]=PagePrincipale" "config[mysql_host]=localhost" \ @@ -56,37 +56,30 @@ ynh_local_curl "/?PagePrincipale&installAction=install" "config[default_language "admin_email=$admin%40$domain" "submit=Continue" # authorization of html +# (kind of strange, should be doable using the previous curl?) ynh_replace_string --match_string="'allow_raw_html' => false," --replace_string="'allow_raw_html' => true," --target_file="$install_dir/wakka.config.php" -ynh_replace_string --match_string="yeswiki_release' \?=> \?'.*',$" --replace_string="yeswiki_release' => '$(ynh_app_upstream_version)'," --target_file="$install_dir/wakka.config.php" - #================================================= # DOWNLOAD AND CONFIGURE LDAP PLUGIN #================================================= -ynh_script_progression --message="Dowloading and configuring LDAP plugin" --weight=2 +ynh_script_progression --message="Configure LDAP plugin" --weight=2 -# Download from yeswiki repository -wget https://repository.yeswiki.net/doryphore/extension-loginldap-$loginldap_version.zip 2>&1 -wget https://repository.yeswiki.net/doryphore/extension-loginldap-$loginldap_version.zip.md5 2>&1 -md5sum -c extension-loginldap-$loginldap_version.zip.md5 || ynh_die "Checksum for LDAP plugin does not match" - -unzip extension-loginldap-$loginldap_version.zip -d $install_dir/tools - -ynh_app_setting_set --app=$app --key=loginldap_version --value=$loginldap_version +# Download LDAP plugin from yeswiki repository +mkdir -p "$install_dir/tools/loginldap" +ynh_setup_source --dest_dir="$install_dir/tools/loginldap" --source_id="loginldap" # Add config at the end of wakka.config.php ynh_replace_string --match_string=");" --replace_string=" 'ldap_host' => '127.0.0.1',\n);" --target_file="$install_dir/wakka.config.php" - ynh_replace_string --match_string=");" --replace_string=" 'ldap_port' => '389',\n);" --target_file="$install_dir/wakka.config.php" - ynh_replace_string --match_string=");" --replace_string=" 'ldap_base' => 'ou=users,dc=yunohost,dc=org'\n);" --target_file="$install_dir/wakka.config.php" #================================================= # SECURE FILES AND DIRECTORIES #================================================= -# Set permissions to app files -yeswiki_update_dir_rights $app $install_dir +chown -R $app:www-data $install_dir +chmod -R u=rwX,g=rX,o-rwx $install_dir +chmod g-rwx $install_dir/wakka.config.php #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index a8f29f5..2dff91d 100755 --- a/scripts/restore +++ b/scripts/restore @@ -17,11 +17,9 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" -chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" - -# Restore permissions on app files -yeswiki_update_dir_rights $app $install_dir +chown -R $app:www-data $install_dir +chmod -R u=rwX,g=rX,o-rwx $install_dir +chmod g-rwx $install_dir/wakka.config.php #================================================= # RESTORE THE PHP-FPM CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index a6e85f1..9b1ffd6 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -21,13 +21,15 @@ upgrade_type=$(ynh_check_app_version_changed) if [ "$upgrade_type" == "UPGRADE_APP" ] then - ynh_script_progression --message="Upgrading source files..." --weight=5 + ynh_script_progression --message="Upgrading source files..." --weight=5 - # Download, check integrity, uncompress and patch the source from app.src - # TODO : find a way to sync stable extensions list to avoid hardcoded extensions folders to keep - ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep=".env wakka.config.php files custom private themes tools/accountactivationbyemail tools/advancedsearch tools/benevolat tools/ferme tools/fontautoinstall tools/ipblock tools/lms tools/login-sso tools/logincas tools/loginldap tools/maintenance tools/multideletepages tools/nextcloudconnector tools/publication tools/qrcode tools/stats tools/tabdyn tools/twolevels tools/webhooks" + # Download, check integrity, uncompress and patch the source from app.src + # TODO : find a way to sync stable extensions list to avoid hardcoded extensions folders to keep + noncore_extensions="$(echo tools/{accountactivationbyemail,advancedsearch,benevolat,ferme,fontautoinstall,ipblock,lms,login-sso,logincas,loginldap,maintenance,multideletepages,nextcloudconnector,publication,qrcode,stats,tabdyn,twolevels,webhooks,yunohost})" + ferme_instances="$(cd $install_dir; for p in $(ls -- */wakka.config.php 2>/dev/null); do dirname "$p"; done)" + ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep=".env wakka.config.php files custom private themes $noncore_extensions $ferme_instances" - ynh_replace_string --match_string="yeswiki_release' \?=> \?'.*',$" --replace_string="yeswiki_release' => '$(ynh_app_upstream_version)'," --target_file="$install_dir/wakka.config.php" + ynh_replace_string --match_string="yeswiki_release' \?=> \?'.*',$" --replace_string="yeswiki_release' => '$(ynh_app_upstream_version)'," --target_file="$install_dir/wakka.config.php" fi chmod -R o-rwx "$install_dir" @@ -57,36 +59,28 @@ ynh_exec_warn_less ynh_install_composer --phpversion="$phpversion" --workdir="$i # DOWNLOAD AND CONFIGURE LDAP PLUGIN #================================================= -if [[ $(ynh_app_setting_get --app=$app --key=loginldap_version) != $loginldap_version ]] +ynh_script_progression --message="Upgrading LDAP plugin..." --weight=3 + +# Download LDAP plugin from yeswiki repository +ynh_secure_remove "$install_dir/tools/loginldap" +mkdir -p "$install_dir/tools/loginldap" +ynh_setup_source --dest_dir="$install_dir/tools/loginldap" --source_id="loginldap" + +if ! grep -q "ldap_host" "$install_dir/wakka.config.php" then - ynh_script_progression --message="Upgrading LDAP plugin..." --weight=3 - - # Download LDAP plugin from yeswiki repository - wget https://repository.yeswiki.net/doryphore/extension-loginldap-$loginldap_version.zip 2>&1 - wget https://repository.yeswiki.net/doryphore/extension-loginldap-$loginldap_version.zip.md5 2>&1 - md5sum -c extension-loginldap-$loginldap_version.zip.md5 || ynh_die "Checksum for LDAP plugin does not match" - - unzip -o extension-loginldap-$loginldap_version.zip -d $install_dir/tools - - ynh_app_setting_set --app=$app --key=loginldap_version --value=$loginldap_version - - if ! grep -q "ldap_host" "$install_dir/wakka.config.php" - then - # Add LDAP config at the end of wakka.config.php - ynh_replace_string --match_string=");" --replace_string=" 'ldap_host' => '127.0.0.1',\n);" --target_file="$install_dir/wakka.config.php" - - ynh_replace_string --match_string=");" --replace_string=" 'ldap_port' => '389',\n);" --target_file="$install_dir/wakka.config.php" - - ynh_replace_string --match_string=");" --replace_string=" 'ldap_base' => 'ou=users,dc=yunohost,dc=org'\n);" --target_file="$install_dir/wakka.config.php" - fi + # Add LDAP config at the end of wakka.config.php + ynh_replace_string --match_string=");" --replace_string=" 'ldap_host' => '127.0.0.1',\n);" --target_file="$install_dir/wakka.config.php" + ynh_replace_string --match_string=");" --replace_string=" 'ldap_port' => '389',\n);" --target_file="$install_dir/wakka.config.php" + ynh_replace_string --match_string=");" --replace_string=" 'ldap_base' => 'ou=users,dc=yunohost,dc=org'\n);" --target_file="$install_dir/wakka.config.php" fi #================================================= # SECURE FILES AND DIRECTORIES #================================================= -# Set permissions on app files -yeswiki_update_dir_rights $app $install_dir +chown -R $app:www-data $install_dir +chmod -R u=rwX,g=rX,o-rwx $install_dir +chmod g-rwx $install_dir/wakka.config.php #================================================= # END OF SCRIPT