1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/borg_ynh.git synced 2024-09-03 18:16:05 +02:00

[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
This commit is contained in:
ljf (zamentur) 2019-05-21 16:36:47 +02:00
parent c15bb2d799
commit c01074739e
6 changed files with 33 additions and 33 deletions

View file

@ -6,7 +6,7 @@
"en": "Backup your server with borg.", "en": "Backup your server with borg.",
"fr": "Sauvegarder votre serveur avec borg." "fr": "Sauvegarder votre serveur avec borg."
}, },
"version": "1.0.3", "version": "1.1.10~ynh1",
"url": "https://borgbackup.readthedocs.io", "url": "https://borgbackup.readthedocs.io",
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"maintainer": { "maintainer": {

View file

@ -190,13 +190,8 @@ ynh_check_app_version_changed () {
echo $return_value 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 () { 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 () { ynh_debian_release () {

View file

@ -30,19 +30,10 @@ ynh_export server ssh_user passphrase on_calendar conf data apps
ynh_save_args server ssh_user passphrase on_calendar conf data apps ynh_save_args server ssh_user passphrase on_calendar conf data apps
#================================================= #=================================================
# CONFIGURE BACKPORTS # INSTALL DEPENDENCIES
#=================================================
# We need borg 1.1+ available only in backports
if is_stretch; then
ynh_install_backports
fi
#=================================================
# STORE SETTINGS FROM MANIFEST
#================================================= #=================================================
ynh_install_app_dependencies $pkg_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 if [ ! -d /opt/borg-env ]; then
virtualenv --python=python3 /opt/borg-env virtualenv --python=python3 /opt/borg-env
/opt/borg-env/bin/python /opt/borg-env/bin/pip install borgbackup /opt/borg-env/bin/python /opt/borg-env/bin/pip install borgbackup
@ -50,7 +41,6 @@ else
/opt/borg-env/bin/python /opt/borg-env/bin/borg \"\$@\"" > /usr/local/bin/borg /opt/borg-env/bin/python /opt/borg-env/bin/borg \"\$@\"" > /usr/local/bin/borg
chmod u+x /usr/local/bin/borg chmod u+x /usr/local/bin/borg
fi fi
fi
#================================================= #=================================================
# ACTIVATE BACKUP METHODS # ACTIVATE BACKUP METHODS

View file

@ -21,7 +21,7 @@ app=$YNH_APP_INSTANCE_NAME
ynh_remove_app_dependencies ynh_remove_app_dependencies
#================================================= #=================================================
# REMOVE BACKPORTS # REMOVE BACKPORTS IF EXISTS
#================================================= #=================================================
ynh_remove_backports ynh_remove_backports

View file

@ -30,17 +30,19 @@ app=$YNH_APP_INSTANCE_NAME
server=$(ynh_app_setting_get $app server) server=$(ynh_app_setting_get $app server)
ssh_user=$(ynh_app_setting_get $app ssh_user) 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 # INSTALL DEPENDENCIES
#================================================= #=================================================
ynh_install_app_dependencies $pkg_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 # ACTIVATE BACKUP METHODS

View file

@ -39,3 +39,16 @@ if grep "borg.timer" /etc/yunohost/services.yml > /dev/null ; then
systemctl enable $app.timer systemctl enable $app.timer
systemctl start $app.timer systemctl start $app.timer
fi 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