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

Handle loginldap extension using a manifest source

This commit is contained in:
Alexandre Aubin 2023-12-10 10:55:50 +01:00
parent 8d8cb0bdb7
commit c39ab4201f
4 changed files with 22 additions and 37 deletions

View file

@ -64,6 +64,10 @@ ram.runtime = "50M"
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,3 +1 @@
#!/bin/bash
loginldap_version="2021-03-01-2"

View file

@ -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,29 +56,21 @@ 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"
#=================================================

View file

@ -57,28 +57,19 @@ 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
#=================================================