I am not sure to understand why having duplicate :
# If SFTP is enabled but no password provided, generate a random password
if [ $with_sftp -eq 1 ] && [ -z "$password" ]; then
ynh_print_info --message="No password provided for SFTP, generating a random password..."
password=$(ynh_string_random --length=12)
ynh_print_info --message="Generated password: $password - Please save it for SFTP access!"
# Store the generated password for post-install display
ynh_app_setting_set --app=$app --key=generated_password --value="$password"
fi
and
# If no password provided, generate a random password
if [ -z "$password" ]; then
password=$(ynh_string_random --length=12)
ynh_print_info --message="Generated password: $password - Please save it for SFTP access!"
# Store the generated password for post-install display
ynh_app_setting_set --app=$app --key=generated_password --value="$password"
Why key=generated_password and key=password
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
ynh_script_progression --message="Validating installation parameters..." --weight=2
# If SFTP is enabled but no password provided, generate a random password
if [ $with_sftp -eq 1 ] && [ -z "$password" ]; then
ynh_print_info --message="No password provided for SFTP, generating a random password..."
password=$(ynh_string_random --length=12)
ynh_print_info --message="Generated password: $password - Please save it for SFTP access!"
# Store the generated password for post-install display
ynh_app_setting_set --app=$app --key=generated_password --value="$password"
fi
# Ensure mode has a default value
if [ -z "${mode:-}" ]; then
mode="static"
fi
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
and
And why using ynh_replace_string
When you already have ynh_add_config
This useless since these vars are mandatory
# Ensure all required variables are defined for ynh_replace_vars
# These variables are normally set by YunoHost, but we need to ensure they exist
if [ -z "${domain:-}" ]; then
domain=$(ynh_app_setting_get --app=$app --key=domain 2>/dev/null || echo "unknown")
fi
if [ -z "${path:-}" ]; then
path=$(ynh_app_setting_get --app=$app --key=path 2>/dev/null || echo "/")
fi
if [ -z "${app:-}" ]; then
app=$(ynh_app_setting_get --app=$app --key=app 2>/dev/null || echo "my_webapp")
fi
if [ -z "${install_dir:-}" ]; then
install_dir="/var/www/$app"
fi
I didn’t go through other scripts than install.
arnauld:
PHP 7.4
You may ask the dev to upgrade the app to a more recent php version. It’s a bad idea to stick to a a tech that reached EOL ( PHP 7.4 reached EOL and no longer received security updates as of November 28, 2022.)
3 Likes