🍽 Fork YunoHost — snapshot mangé par la machine à tsoins
Some checks failed
Check for new n releases / updater (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled

Upstream: https://github.com/YunoHost/yunohost @ 3a5f8bac8301c450897b96cbd43a4c7d3ba750fb
But (José) : transformer tout le code en bions + ploxions du xerboxion.
La carte de digestion vit au labo : /yunohost-digest.json
This commit is contained in:
machine-a-tsoins
2026-07-03 17:20:06 +00:00
commit edb4c397df
395 changed files with 105504 additions and 0 deletions

View File

@@ -0,0 +1,74 @@
#!/usr/bin/env bash
ynhtest_simple_template_app_config() {
mkdir -p "/etc/yunohost/apps/${app:?}/"
echo "id: $app" > "/etc/yunohost/apps/$app/settings.yml"
template="$(mktemp -d -p "$VAR_WWW")/template.txt"
cat << EOF > "$template"
app=__APP__
foo=__FOO__
passwd=__WITH_SPECIAL_CHARS__
EOF
foo="bar"
with_special_chars="hello&world"
install_dir="$VAR_WWW"
ynh_config_add --template="$template" --destination="$VAR_WWW/config.txt"
test "$(cat "$VAR_WWW/config.txt")" == "$(echo -ne 'app=ynhtest\nfoo=bar\npasswd=hello&world')"
# shellcheck disable=SC2012
test "$(ls -l "$VAR_WWW/config.txt" | cut -d' ' -f1-4)" == "-rw------- 1 ynhtest ynhtest"
}
ynhtest_simple_template_system_config() {
mkdir -p "/etc/yunohost/apps/$app/"
echo "id: $app" > "/etc/yunohost/apps/$app/settings.yml"
rm -f /etc/cron.d/ynhtest_config
template="$(mktemp -d -p "$VAR_WWW")/template.txt"
cat << EOF > "$template"
app=__APP__
foo=__FOO__
EOF
foo="bar"
ynh_config_add --template="$template" --destination="/etc/cron.d/ynhtest_config"
test "$(cat /etc/cron.d/ynhtest_config)" == "$(echo -ne 'app=ynhtest\nfoo=bar')"
# shellcheck disable=SC2012
test "$(ls -l /etc/cron.d/ynhtest_config | cut -d' ' -f1-4)" == "-r-------- 1 root root"
rm -f /etc/cron.d/ynhtest_config
}
ynhtest_jinja_template_app_config() {
mkdir -p "/etc/yunohost/apps/$app/"
echo "id: $app" > "/etc/yunohost/apps/$app/settings.yml"
my_json='{"hello": "toto"}'
template="$(mktemp -d -p "$VAR_WWW")/template.txt"
cat << EOF > "$template"
app={{ app }}
{% if foo == "bar" %}foo=true{% endif %}
{% set mydict = my_json | from_json -%}
text_from_json={{ mydict.hello }}
EOF
# shellcheck disable=SC2034
foo="bar"
# shellcheck disable=SC2034
install_dir="$VAR_WWW"
ynh_config_add --template="$template" --destination="$VAR_WWW/config.txt" --jinja
test "$(cat "$VAR_WWW/config.txt")" == "$(echo -ne 'app=ynhtest\nfoo=true\ntext_from_json=toto')"
# shellcheck disable=SC2012
test "$(ls -l "$VAR_WWW/config.txt" | cut -d' ' -f1-4)" == "-rw------- 1 ynhtest ynhtest"
}