1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/yeswiki_ynh.git synced 2024-09-03 18:05:56 +02:00

Merge pull request #72 from YunoHost-Apps/testing

Testing
This commit is contained in:
Florian 2023-12-10 17:12:45 +01:00 committed by GitHub
commit 83f0df36fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 45 additions and 86 deletions

View file

@ -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

View file

@ -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

View file

@ -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]

View file

@ -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
#=================================================

View file

@ -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

View file

@ -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

View file

@ -25,7 +25,9 @@ then
# 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"
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"
fi
@ -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 ]]
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
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
# 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
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