diff --git a/manifest.json b/manifest.json index 00dda48..139592d 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Backup your server with borg.", "fr": "Sauvegarder votre serveur avec borg." }, - "version": "1.0.3", + "version": "1.1.10~ynh1", "url": "https://borgbackup.readthedocs.io", "license": "BSD-3-Clause", "maintainer": { diff --git a/scripts/_common.sh b/scripts/_common.sh index 5a0a27d..21b70c5 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -190,13 +190,8 @@ ynh_check_app_version_changed () { echo $return_value } - -ynh_install_backports () { - echo "deb http://httpredir.debian.org/debian stretch-backports main" > /etc/apt/sources.list.d/$app-stretch-backports.list -} - ynh_remove_backports () { - rm /etc/apt/sources.list.d/$app-stretch-backports.list + rm -f /etc/apt/sources.list.d/$app-stretch-backports.list } ynh_debian_release () { diff --git a/scripts/install b/scripts/install index d009fab..14e4fd9 100755 --- a/scripts/install +++ b/scripts/install @@ -30,26 +30,16 @@ ynh_export server ssh_user passphrase on_calendar conf data apps ynh_save_args server ssh_user passphrase on_calendar conf data apps #================================================= -# CONFIGURE BACKPORTS -#================================================= -# We need borg 1.1+ available only in backports -if is_stretch; then - ynh_install_backports -fi -#================================================= -# STORE SETTINGS FROM MANIFEST +# INSTALL DEPENDENCIES #================================================= ynh_install_app_dependencies $pkg_dependencies -if is_stretch; then - ynh_package_install -t stretch-backports borgbackup -else - if [ ! -d /opt/borg-env ]; then - virtualenv --python=python3 /opt/borg-env - /opt/borg-env/bin/python /opt/borg-env/bin/pip install borgbackup - echo "#!/bin/bash - /opt/borg-env/bin/python /opt/borg-env/bin/borg \"\$@\"" > /usr/local/bin/borg + +if [ ! -d /opt/borg-env ]; then + virtualenv --python=python3 /opt/borg-env + /opt/borg-env/bin/python /opt/borg-env/bin/pip install borgbackup + echo "#!/bin/bash +/opt/borg-env/bin/python /opt/borg-env/bin/borg \"\$@\"" > /usr/local/bin/borg chmod u+x /usr/local/bin/borg - fi fi #================================================= diff --git a/scripts/remove b/scripts/remove index d001268..4f138e3 100755 --- a/scripts/remove +++ b/scripts/remove @@ -21,7 +21,7 @@ app=$YNH_APP_INSTANCE_NAME ynh_remove_app_dependencies #================================================= -# REMOVE BACKPORTS +# REMOVE BACKPORTS IF EXISTS #================================================= ynh_remove_backports diff --git a/scripts/restore b/scripts/restore index 314bce0..8ea1080 100755 --- a/scripts/restore +++ b/scripts/restore @@ -30,17 +30,19 @@ app=$YNH_APP_INSTANCE_NAME server=$(ynh_app_setting_get $app server) ssh_user=$(ynh_app_setting_get $app ssh_user) -#================================================= -# CONFIGURE BACKPORTS -#================================================= -# We need borg 1.1+ available only in backports -ynh_install_backports - #================================================= # INSTALL DEPENDENCIES #================================================= ynh_install_app_dependencies $pkg_dependencies -ynh_package_install -t stretch-backports borgbackup + +if [ ! -d /opt/borg-env ]; then + virtualenv --python=python3 /opt/borg-env + /opt/borg-env/bin/python /opt/borg-env/bin/pip install borgbackup + echo "#!/bin/bash +/opt/borg-env/bin/python /opt/borg-env/bin/borg \"\$@\"" > /usr/local/bin/borg + chmod u+x /usr/local/bin/borg +fi + #================================================= # ACTIVATE BACKUP METHODS diff --git a/scripts/upgrade b/scripts/upgrade index 2a1e5fa..c190242 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -38,4 +38,17 @@ if grep "borg.timer" /etc/yunohost/services.yml > /dev/null ; then yunohost service remove $app.timer systemctl enable $app.timer systemctl start $app.timer -fi \ No newline at end of file +fi + +# Replace backports with pip +if is_stretch; then + ynh_remove_backports +else + if [ ! -d /opt/borg-env ]; then + virtualenv --python=python3 /opt/borg-env + /opt/borg-env/bin/python /opt/borg-env/bin/pip install borgbackup + echo "#!/bin/bash +/opt/borg-env/bin/python /opt/borg-env/bin/borg \"\$@\"" > /usr/local/bin/borg + chmod u+x /usr/local/bin/borg + fi +fi