test_apps/config_app_ynh/scripts/config
2021-08-14 12:26:20 +02:00

68 lines
1.7 KiB
Bash

#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
app=$YNH_APP_INSTANCE_NAME
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
#=================================================
# Please don't change that code.
# You can overwrite these functions if you need it
#=================================================
ynh_panel_init
case $1 in
show) ynh_panel_show;;
apply) ynh_panel_validate && ynh_panel_apply;;
esac