mirror of
https://github.com/YunoHost-Apps/borg_ynh.git
synced 2024-09-03 18:16:05 +02:00
upgrade to v1.1.13
This commit is contained in:
parent
f9658cdb1e
commit
47bb88d51e
2 changed files with 4 additions and 90 deletions
|
@ -6,7 +6,7 @@
|
||||||
"en": "Backup your server on a host server using Borg.",
|
"en": "Backup your server on a host server using Borg.",
|
||||||
"fr": "Sauvegardez votre serveur sur un serveur distant avec Borg."
|
"fr": "Sauvegardez votre serveur sur un serveur distant avec Borg."
|
||||||
},
|
},
|
||||||
"version": "1.1.10~ynh5",
|
"version": "1.1.13~ynh1",
|
||||||
"url": "https://borgbackup.readthedocs.io",
|
"url": "https://borgbackup.readthedocs.io",
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
"url": "https://reflexlibre.net"
|
"url": "https://reflexlibre.net"
|
||||||
},
|
},
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 2.7.14"
|
"yunohost": ">= 3.5.0"
|
||||||
},
|
},
|
||||||
"multi_instance": true,
|
"multi_instance": true,
|
||||||
"services": [],
|
"services": [],
|
||||||
|
|
|
@ -12,14 +12,13 @@ pkg_dependencies="python3-pip python3-dev libacl1-dev libssl-dev liblz4-dev pyth
|
||||||
install_borg_with_pip () {
|
install_borg_with_pip () {
|
||||||
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==1.1.10
|
/opt/borg-env/bin/python /opt/borg-env/bin/pip install borgbackup==1.1.13
|
||||||
echo "#!/bin/bash
|
echo "#!/bin/bash
|
||||||
/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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# COMMON HELPERS
|
# COMMON HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -48,22 +47,7 @@ ynh_save_args () {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# Render templates with Jinja2
|
|
||||||
#
|
|
||||||
# Attention : Variables should be exported before calling this helper to be
|
|
||||||
# accessible inside templates.
|
|
||||||
#
|
|
||||||
# usage: ynh_render_template some_template output_path
|
|
||||||
# | arg: some_template - Template file to be rendered
|
|
||||||
# | arg: output_path - The path where the output will be redirected to
|
|
||||||
ynh_render_template() {
|
|
||||||
local template_path=$1
|
|
||||||
local output_path=$2
|
|
||||||
# Taken from https://stackoverflow.com/a/35009576
|
|
||||||
python3 -c 'import os, sys, jinja2; sys.stdout.write(
|
|
||||||
jinja2.Template(sys.stdin.read()
|
|
||||||
).render(os.environ));' < $template_path > $output_path
|
|
||||||
}
|
|
||||||
|
|
||||||
ynh_configure () {
|
ynh_configure () {
|
||||||
ynh_backup_if_checksum_is_different $2
|
ynh_backup_if_checksum_is_different $2
|
||||||
|
@ -71,22 +55,7 @@ ynh_configure () {
|
||||||
ynh_store_file_checksum $2
|
ynh_store_file_checksum $2
|
||||||
}
|
}
|
||||||
|
|
||||||
# Remove any logs for all the following commands.
|
|
||||||
#
|
|
||||||
# usage: ynh_print_OFF
|
|
||||||
# WARNING: You should be careful with this helper, and never forgot to use ynh_print_ON as soon as possible to restore the logging.
|
|
||||||
ynh_print_OFF () {
|
|
||||||
set +x
|
|
||||||
}
|
|
||||||
|
|
||||||
# Restore the logging after ynh_print_OFF
|
|
||||||
#
|
|
||||||
# usage: ynh_print_ON
|
|
||||||
ynh_print_ON () {
|
|
||||||
set -x
|
|
||||||
# Print an echo only for the log, to be able to know that ynh_print_ON has been called.
|
|
||||||
echo ynh_print_ON > /dev/null
|
|
||||||
}
|
|
||||||
|
|
||||||
# Send an email to inform the administrator
|
# Send an email to inform the administrator
|
||||||
#
|
#
|
||||||
|
@ -145,63 +114,8 @@ $(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')"
|
||||||
echo "$mail_message" | $mail_bin -a "Content-Type: text/plain; charset=UTF-8" -s "$mail_subject" "$recipients"
|
echo "$mail_message" | $mail_bin -a "Content-Type: text/plain; charset=UTF-8" -s "$mail_subject" "$recipients"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Read the value of a key in a ynh manifest file
|
|
||||||
#
|
|
||||||
# usage: ynh_read_manifest manifest key
|
|
||||||
# | arg: manifest - Path of the manifest to read
|
|
||||||
# | arg: key - Name of the key to find
|
|
||||||
ynh_read_manifest () {
|
|
||||||
manifest="$1"
|
|
||||||
key="$2"
|
|
||||||
python3 -c "import sys, json;print(json.load(open('$manifest', encoding='utf-8'))['$key'])"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Checks the app version to upgrade with the existing app version and returns:
|
|
||||||
# - UPGRADE_APP if the upstream app version has changed
|
|
||||||
# - UPGRADE_PACKAGE if only the YunoHost package has changed
|
|
||||||
#
|
|
||||||
## It stops the current script without error if the package is up-to-date
|
|
||||||
#
|
|
||||||
# This helper should be used to avoid an upgrade of an app, or the upstream part
|
|
||||||
# of it, when it's not needed
|
|
||||||
#
|
|
||||||
# To force an upgrade, even if the package is up to date,
|
|
||||||
# you have to set the variable YNH_FORCE_UPGRADE before.
|
|
||||||
# example: sudo YNH_FORCE_UPGRADE=1 yunohost app upgrade MyApp
|
|
||||||
|
|
||||||
# usage: ynh_check_app_version_changed
|
|
||||||
ynh_check_app_version_changed () {
|
|
||||||
local force_upgrade=${YNH_FORCE_UPGRADE:-0}
|
|
||||||
local package_check=${PACKAGE_CHECK_EXEC:-0}
|
|
||||||
|
|
||||||
# By default, upstream app version has changed
|
|
||||||
local return_value="UPGRADE_APP"
|
|
||||||
|
|
||||||
local current_version=$(ynh_read_manifest "/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" "version" || echo 1.0)
|
|
||||||
local current_upstream_version="${current_version/~ynh*/}"
|
|
||||||
local update_version=$(ynh_read_manifest "../manifest.json" "version" || echo 1.0)
|
|
||||||
local update_upstream_version="${update_version/~ynh*/}"
|
|
||||||
|
|
||||||
if [ "$current_version" == "$update_version" ] ; then
|
|
||||||
# Complete versions are the same
|
|
||||||
if [ "$force_upgrade" != "0" ]
|
|
||||||
then
|
|
||||||
echo "Upgrade forced by YNH_FORCE_UPGRADE." >&2
|
|
||||||
unset YNH_FORCE_UPGRADE
|
|
||||||
elif [ "$package_check" != "0" ]
|
|
||||||
then
|
|
||||||
echo "Upgrade forced for package check." >&2
|
|
||||||
else
|
|
||||||
ynh_die "Up-to-date, nothing to do" 0
|
|
||||||
fi
|
|
||||||
elif [ "$current_upstream_version" == "$update_upstream_version" ] ; then
|
|
||||||
# Upstream versions are the same, only YunoHost package versions differ
|
|
||||||
return_value="UPGRADE_PACKAGE"
|
|
||||||
fi
|
|
||||||
echo $return_value
|
|
||||||
}
|
|
||||||
|
|
||||||
ynh_debian_release () {
|
ynh_debian_release () {
|
||||||
lsb_release --codename --short
|
lsb_release --codename --short
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue