1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/lionwiki-t2t_ynh.git synced 2024-09-03 19:36:27 +02:00

Try to retrieve the password from the configuration file

This commit is contained in:
Salamandar 2024-01-17 15:37:37 +01:00
parent 6cdd885397
commit f57aa710a0

View file

@ -9,6 +9,21 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# Password was not backed up prior to packaging v2
if [[ -z "${password:-}" ]]; then
password=$(grep -oP '^\$PASSWORD = sha1\(\"\K.*(?=\"\);$)' "$install_dir/config.php")
if [[ -z "$password" ]]; then
command="yunohost app setting $app password -v 'YOUR PASSWORD'"
ynh_die --message="Could not retrieve install password from config. Please run '$command' then retry the upgrade."
fi
ynh_app_setting_set --app="$app" --key=password --value="$password"
fi
#================================================= #=================================================
# INITIALIZE AND STORE SETTINGS # INITIALIZE AND STORE SETTINGS
#================================================= #=================================================