test_apps/config_app_ynh/scripts/config

56 lines
1.5 KiB
Bash

#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source /usr/share/yunohost/helpers
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
final_path=$(ynh_app_setting_get $app final_path)
#=================================================
# SPECIFIC GETTERS FOR TOML SHORT KEY
#=================================================
get__arg8() {
echo ""
}
#=================================================
# SPECIFIC VALIDATORS FOR TOML SHORT KEYS
#=================================================
validate__arg8() {
[[ "${#arg8}" -lt 8 ]] &&
echo 'Too short password'
}
#=================================================
# SPECIFIC SETTERS FOR TOML SHORT KEYS
#=================================================
set__arg8() {
if [ -z "${arg8}" ]
then
python -c "import crypt; print(crypt.crypt(\"${arg8}\", \"\$6\$saltsalt\$\"))" > $final_path/password
fi
}
#=================================================
# OVERWRITING APPLY STEP
#=================================================
ynh_panel_apply() {
_ynh_panel_apply
systemctl restart nginx
}
#=================================================
# GENERIC FINALIZATION
#=================================================
ynh_panel_run $1