From c15bb2d7990264df9dab93ca5e20d46753c75072 Mon Sep 17 00:00:00 2001 From: keoma Date: Mon, 4 Mar 2019 20:24:09 +0100 Subject: [PATCH 1/4] adding yunohost tags --- README.md | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 18dfd42..f88752d 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,21 @@ -# borg_ynh +# Borg for Yunohost + +[![Latest Version](https://img.shields.io/badge/version-1.0.3-green.svg?style=flat)](https://github.com/YunoHost-Apps/borg_ynh/releases) +[![Status](https://img.shields.io/badge/status-testing-yellow.svg?style=flat)](https://github.com/YunoHost-Apps/borg_ynh/milestones) +[![Integration level](https://dash.yunohost.org/integration/borg.svg)](https://dash.yunohost.org/appci/app/borg) +[![GitHub license](https://img.shields.io/badge/license-GPLv3-blue.svg?style=flat)](https://raw.githubusercontent.com/YunoHost-Apps/borg_ynh/master/LICENSE) +[![GitHub issues](https://img.shields.io/github/issues/YunoHost-Apps/borg_ynh.svg?style=flat)](https://github.com/YunoHost-Apps/borg_ynh/issues) + +[![Install Borg with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=borg) + An experimental borg implementation for yunohost ## Usage + If you want to backup your server A onto the server B. ## Setup borg app on Server A + Firstly set up this app on the server A you want to backup: ``` @@ -20,9 +31,9 @@ Indicate the backup frequency (see systemd OnCalendar format) (default: Daily): You can schedule your backup by choosing an other frequency. Some example: -Monthly : +Monthly : -Weekly : +Weekly : Daily : Daily at midnight From c01074739e090e30fdeee0815aa1084f213278cb Mon Sep 17 00:00:00 2001 From: "ljf (zamentur)" Date: Tue, 21 May 2019 16:36:47 +0200 Subject: [PATCH 2/4] [fix] Use pip instead backport (#32) * [fix] Use pip instead backport * [fix] Don't remove backport in remove script * [fix] Remove backport in restore script * [fix] Replace backports with pip during upgrade * [fix] Update version number * [fix] Remove backports if exists * [enh] Delete dead code * [fix] Remove backports if they exists * [fix] Don't install backports --- manifest.json | 2 +- scripts/_common.sh | 7 +------ scripts/install | 24 +++++++----------------- scripts/remove | 2 +- scripts/restore | 16 +++++++++------- scripts/upgrade | 15 ++++++++++++++- 6 files changed, 33 insertions(+), 33 deletions(-) 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 From 18a1bf83ea3eabaf6c3ce0ffe6c0ebb227615942 Mon Sep 17 00:00:00 2001 From: ljf Date: Tue, 21 May 2019 16:46:48 +0200 Subject: [PATCH 3/4] [fix] Upgrade don't forget to install pip borg package --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index c190242..56513ec 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -43,7 +43,7 @@ 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 From dd9dbfa33f718544ce2fabf69fd0794643b32f63 Mon Sep 17 00:00:00 2001 From: ljf Date: Tue, 21 May 2019 17:00:59 +0200 Subject: [PATCH 4/4] [enh] Pin the borg version to 1.1.10 --- scripts/_common.sh | 12 ++++++++++++ scripts/install | 9 +-------- scripts/restore | 10 +--------- scripts/upgrade | 8 +------- 4 files changed, 15 insertions(+), 24 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 21b70c5..3d5015f 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -8,6 +8,18 @@ PKG_DIR=$(cd ../; pwd) pkg_dependencies="python3-pip python3-dev libacl1-dev libssl-dev liblz4-dev python3-jinja2 python3-setuptools python-virtualenv" +# Install borg with pip if borg is not here +install_borg_with_pip () { + if [ ! -d /opt/borg-env ]; then + virtualenv --python=python3 /opt/borg-env + /opt/borg-env/bin/python /opt/borg-env/bin/pip install borgbackup=1.1.10 + 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 +} + + #================================================= # COMMON HELPERS #================================================= diff --git a/scripts/install b/scripts/install index 14e4fd9..fd68558 100755 --- a/scripts/install +++ b/scripts/install @@ -33,14 +33,7 @@ ynh_save_args server ssh_user passphrase on_calendar conf data apps # INSTALL DEPENDENCIES #================================================= ynh_install_app_dependencies $pkg_dependencies - -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 +install_borg_with_pip #================================================= # ACTIVATE BACKUP METHODS diff --git a/scripts/restore b/scripts/restore index 8ea1080..1a4cb76 100755 --- a/scripts/restore +++ b/scripts/restore @@ -34,15 +34,7 @@ ssh_user=$(ynh_app_setting_get $app ssh_user) # INSTALL DEPENDENCIES #================================================= ynh_install_app_dependencies $pkg_dependencies - -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 - +install_borg_with_pip #================================================= # ACTIVATE BACKUP METHODS diff --git a/scripts/upgrade b/scripts/upgrade index 56513ec..612b8b9 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -44,11 +44,5 @@ fi if is_stretch; then ynh_remove_backports - 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 + install_borg_with_pip fi