Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] SSH key not registered correctly #24

Merged
merged 1 commit into from
Feb 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"en": "Offer backup storage to a friend.",
"fr": "Offrez un espace de stockage à un⋅e ami⋅e."
},
"version": "1.1.10~ynh3",
"version": "1.1.10~ynh4",
"url": "https://borgbackup.readthedocs.io",
"license": "BSD-3-Clause",
"maintainer": {
Expand Down
4 changes: 2 additions & 2 deletions scripts/_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ ynh_export () {
local ynh_arg=""
for var in $@;
do
ynh_arg=$(echo $var | awk '{print toupper($0)}')
ynh_arg=$(echo "$var" | awk '{print toupper($0)}')
if [ "$var" == "path_url" ]; then
ynh_arg="PATH"
fi
Expand All @@ -43,7 +43,7 @@ ynh_save_args () {
if [ "$var" == "path_url" ]; then
setting_var="path"
fi
ynh_app_setting_set $app $setting_var ${!var}
ynh_app_setting_set $app $setting_var "${!var}"
done
}

Expand Down
22 changes: 18 additions & 4 deletions scripts/upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ source /usr/share/yunohost/helpers
#=================================================

app=$YNH_APP_INSTANCE_NAME
ssh_user=$(ynh_app_setting_get --app=$app --key=ssh_user)

#=================================================
# CHECK IF AN UPGRADE IS NEEDED
Expand All @@ -33,8 +34,21 @@ ynh_clean_setup () {
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors

# Replace backports with pip
rm -f /etc/apt/sources.list.d/$app-stretch-backports.list

install_borg_with_pip
ynh_secure_remove /etc/yunohost/hooks.d/backup/17-data_home
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."

if [ -f "/etc/apt/sources.list.d/$app-stretch-backports.list" ]; then
rm -f /etc/apt/sources.list.d/$app-stretch-backports.list
install_borg_with_pip
fi

if [ -f "/etc/yunohost/hooks.d/backup/17-data_home" ]; then
ynh_secure_remove /etc/yunohost/hooks.d/backup/17-data_home
fi

if echo "$ssh_user" | grep -v ' '; then
ynh_app_setting_set --app=$app --key=ssh_user --value="$(grep -Po 'no-user-rc \K.*$' /home/$ssh_user/.ssh/authorized_keys)"
fi