From 09d5463b90de5b40bcf06c494e0dc52bfd7afdf8 Mon Sep 17 00:00:00 2001 From: ljf Date: Mon, 29 Mar 2021 09:56:12 +0200 Subject: [PATCH] [fix] Install process was broken --- manifest.json | 4 ++-- scripts/_common.sh | 49 ++++++++++++---------------------------------- scripts/install | 2 +- scripts/upgrade | 8 +++----- 4 files changed, 18 insertions(+), 45 deletions(-) diff --git a/manifest.json b/manifest.json index 1f075b3..8268e59 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Backup your server on a host server using Borg.", "fr": "Sauvegardez votre serveur sur un serveur distant avec Borg." }, - "version": "1.1.15~ynh2", + "version": "1.1.16~ynh1", "url": "https://borgbackup.readthedocs.io", "license": "BSD-3-Clause", "maintainer": { @@ -29,7 +29,7 @@ "fr": "Dans quel repo borg souhaitez-vous sauvegarder vos fichiers ?" }, "help":{ - "en": "Specify a remote repository using this format: ssh://USER@DOMAIN.TLD:PORT/~/backup . "USER" is *not* meant to be an existing user on the guest server. Instead, it will be created *on the host server* during the installation of the Borg Server App. It's also possible to use a local repository using a syntax such as /mount/my_external_harddrive/backups" + "en": "Specify a remote repository using this format: ssh://USER@DOMAIN.TLD:PORT/~/backup . \"USER\" is *not* meant to be an existing user on the guest server. Instead, it will be created *on the host server* during the installation of the Borg Server App. It's also possible to use a local repository using a syntax such as /mount/my_external_harddrive/backups" }, "example": "ssh://john@serverb.tld:22/~/backup" }, diff --git a/scripts/_common.sh b/scripts/_common.sh index ed15366..aee0e65 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,7 @@ #================================================= # App package root directory should be the parent folder PKG_DIR=$(cd ../; pwd) -BORG_VERSION=1.1.15 +BORG_VERSION=1.1.16 pkg_dependencies="python3-pip python3-dev libacl1-dev libssl-dev liblz4-dev python3-jinja2 python3-setuptools python-virtualenv virtualenv libfuse-dev pkg-config" @@ -16,12 +16,11 @@ install_borg_with_pip () { fi if [ ! -d /opt/borg-env ]; then python3 -m venv /opt/borg-env + /opt/borg-env/bin/python /opt/borg-env/bin/pip install wheel /opt/borg-env/bin/python /opt/borg-env/bin/pip install borgbackup[fuse]==$BORG_VERSION echo "#!/bin/bash /opt/borg-env/bin/python /opt/borg-env/bin/borg \"\$@\"" > /usr/local/bin/borg - if is_buster; then - touch /opt/borg-env/buster - fi + touch "/opt/borg-env/$(ynh_get_debian_release)" fi # We need this to be executable by other borg apps chmod a+x /usr/local/bin/borg @@ -55,7 +54,16 @@ ynh_save_args () { done } +# Need also the helper https://github.com/YunoHost-Apps/Experimental_helpers/blob/master/ynh_handle_getopts_args/ynh_handle_getopts_args +# Send an email to inform the administrator +# +# usage: ynh_send_readme_to_admin app_message [recipients] +# | arg: -m --app_message= - The message to send to the administrator. +# | arg: -r, --recipients= - The recipients of this email. Use spaces to separate multiples recipients. - default: root +# example: "root admin@domain" +# If you give the name of a YunoHost user, ynh_send_readme_to_admin will find its email adress for you +# example: "root admin@domain user1 user2" # Send an email to inform the administrator # @@ -113,36 +121,3 @@ $(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')" # Send the email to the recipients echo "$mail_message" | $mail_bin -a "Content-Type: text/plain; charset=UTF-8" -s "$mail_subject" "$recipients" } - - - -ynh_debian_release () { - lsb_release --codename --short -} - -is_buster () { - if [ "$(ynh_debian_release)" == "buster" ] - then - return 0 - else - return 1 - fi -} - -is_stretch () { - if [ "$(ynh_debian_release)" == "stretch" ] - then - return 0 - else - return 1 - fi -} - -is_jessie () { - if [ "$(ynh_debian_release)" == "jessie" ] - then - return 0 - else - return 1 - fi -} diff --git a/scripts/install b/scripts/install index 1ef275f..89090b8 100755 --- a/scripts/install +++ b/scripts/install @@ -96,7 +96,7 @@ yunohost app install https://github.com/YunoHost-Apps/borgserver_ynh -a \"ssh_us If you facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/borg_ynh" - ynh_send_readme_to_admin "$message" "root" + ynh_send_readme_to_admin "$message" ynh_print_ON fi diff --git a/scripts/upgrade b/scripts/upgrade index 9ebde06..5a4ae19 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -69,11 +69,9 @@ fi # Replace backports with pip [ ! -e " /etc/apt/sources.list.d/$app-stretch-backports.list" ] || rm -f /etc/apt/sources.list.d/$app-stretch-backports.list -# Reinstall borg if stretch -> buster migration -if is_buster; then - if [ ! -f /opt/borg-env/buster ] ; then - ynh_secure_remove /opt/borg-env - fi +# Reinstall borg if debian change of major version +if [ ! -f "/opt/borg-env/$(ynh_get_debian_release)" ] ; then + ynh_secure_remove /opt/borg-env fi #=================================================