1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/borgserver_ynh.git synced 2024-09-03 20:36:20 +02:00

[fix] Crash if we are not able to retrieve ssh_user

This commit is contained in:
ljf (zamentur) 2021-04-11 19:15:16 +02:00 committed by GitHub
parent 2898fbe9ab
commit 96383b7787
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -57,6 +57,7 @@ fi
# Fix broken value ssh_user that mistakenly got replaced by the public key in previous versions... # Fix broken value ssh_user that mistakenly got replaced by the public key in previous versions...
if echo "$ssh_user" | grep -q ' '; then if echo "$ssh_user" | grep -q ' '; then
ssh_user=$(grep "$ssh_user" /home/*/.ssh/authorized_keys | grep borg | cut -d/ -f3) ssh_user=$(grep "$ssh_user" /home/*/.ssh/authorized_keys | grep borg | cut -d/ -f3)
[ -n "$ssh_user" ] || ynh_die "Unable to retrieve ssh_user please fix /etc/yunohost/apps/$app/settings.yml manually :( !"
ynh_app_setting_set --app=$app --key=ssh_user --value="$ssh_user" ynh_app_setting_set --app=$app --key=ssh_user --value="$ssh_user"
fi fi