mirror of
https://github.com/YunoHost-Apps/borgserver_ynh.git
synced 2024-09-03 20:36:20 +02:00
v2
This commit is contained in:
parent
ad2e5bae89
commit
cad879fb56
7 changed files with 45 additions and 90 deletions
|
@ -5,7 +5,7 @@ name = "Borg Server"
|
||||||
description.en = "Offer backup storage to a friend"
|
description.en = "Offer backup storage to a friend"
|
||||||
description.fr = "Offrez un espace de stockage à un⋅e ami⋅e"
|
description.fr = "Offrez un espace de stockage à un⋅e ami⋅e"
|
||||||
|
|
||||||
version = "1.1.16~ynh9"
|
version = "1.2.6~ynh1"
|
||||||
|
|
||||||
maintainers = ["ljf"]
|
maintainers = ["ljf"]
|
||||||
|
|
||||||
|
@ -14,18 +14,16 @@ license = "BSD-3-Clause"
|
||||||
website = "https://www.borgbackup.org/"
|
website = "https://www.borgbackup.org/"
|
||||||
admindoc = "https://borgbackup.readthedocs.io/en/stable/"
|
admindoc = "https://borgbackup.readthedocs.io/en/stable/"
|
||||||
code = "https://github.com/borgbackup/borg"
|
code = "https://github.com/borgbackup/borg"
|
||||||
cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number)
|
|
||||||
fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin.
|
|
||||||
|
|
||||||
[integration]
|
[integration]
|
||||||
yunohost = ">= 4.2.3"
|
yunohost = ">= 11.2"
|
||||||
architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"]
|
architectures = "all"
|
||||||
multi_instance = true
|
multi_instance = true
|
||||||
ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials.
|
ldap = "not_relevant"
|
||||||
sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal.
|
sso = "not_relevant"
|
||||||
disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ...
|
disk = "50M"
|
||||||
ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
|
ram.build = "50M"
|
||||||
ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
|
ram.runtime = "50M"
|
||||||
|
|
||||||
[install]
|
[install]
|
||||||
[install.ssh_user]
|
[install.ssh_user]
|
||||||
|
@ -62,6 +60,10 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen
|
||||||
[resources]
|
[resources]
|
||||||
[resources.system_user]
|
[resources.system_user]
|
||||||
|
|
||||||
[resources.install_dir]
|
#[resources.install_dir]
|
||||||
|
|
||||||
[resources.permissions]
|
[resources.permissions]
|
||||||
|
|
||||||
|
[resources.apt]
|
||||||
|
packages = "python3-pip, python3-dev, libacl1-dev, libssl-dev, liblz4-dev, python3-jinja2, python3-setuptools, python3-venv, virtualenv, libfuse-dev, pkg-config"
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,7 @@
|
||||||
#=================================================
|
#=================================================
|
||||||
# App package root directory should be the parent folder
|
# App package root directory should be the parent folder
|
||||||
PKG_DIR=$(cd ../; pwd)
|
PKG_DIR=$(cd ../; pwd)
|
||||||
BORG_VERSION=1.1.16
|
BORG_VERSION=1.2.6
|
||||||
|
|
||||||
#REMOVEME? pkg_dependencies="python3-pip python3-dev libacl1-dev libssl-dev liblz4-dev python3-jinja2 python3-setuptools python3-venv virtualenv libfuse-dev pkg-config"
|
|
||||||
|
|
||||||
# Install borg with pip if borg is not here
|
# Install borg with pip if borg is not here
|
||||||
install_borg_with_pip () {
|
install_borg_with_pip () {
|
||||||
|
|
|
@ -9,19 +9,10 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# MANAGE SCRIPT FAILURE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
#REMOVEME? ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
#REMOVEME? export app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
ynh_export ssh_user public_key quota alert_delay alert_mails
|
ynh_export ssh_user public_key quota alert_delay alert_mails
|
||||||
|
|
||||||
|
@ -44,9 +35,8 @@ ynh_save_args ssh_user public_key quota alert_delay alert_mails
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
#REMOVEME? ynh_script_progression --message="Installing dependencies..."
|
ynh_script_progression --message="Installing dependencies..."
|
||||||
|
|
||||||
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
|
|
||||||
install_borg_with_pip
|
install_borg_with_pip
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -54,7 +44,7 @@ install_borg_with_pip
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Creating SSH user used by Borg..."
|
ynh_script_progression --message="Creating SSH user used by Borg..."
|
||||||
|
|
||||||
#REMOVEME? ynh_system_user_create --username=$ssh_user --home_dir=/home/$ssh_user --use_shell --groups ssh.app
|
ynh_system_user_create --username=$ssh_user --home_dir=/home/$ssh_user --use_shell --groups ssh.app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# AUTORIZE SSH FOR THIS USER
|
# AUTORIZE SSH FOR THIS USER
|
||||||
|
@ -83,6 +73,7 @@ touch $home/.nobackup
|
||||||
# SETUP CRON
|
# SETUP CRON
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring cron to monitor backup..."
|
ynh_script_progression --message="Configuring cron to monitor backup..."
|
||||||
|
|
||||||
ynh_add_config --template="monitor-backup" --destination="/etc/cron.d/$app"
|
ynh_add_config --template="monitor-backup" --destination="/etc/cron.d/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -9,19 +9,10 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
|
||||||
#REMOVEME? ssh_user=$(ynh_app_setting_get $app ssh_user)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEPENDENCIES
|
# REMOVE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
#REMOVEME? ynh_script_progression --message="Removing dependencies..."
|
ynh_script_progression --message="Removing dependencies..."
|
||||||
|
|
||||||
#REMOVEME? ynh_remove_app_dependencies
|
|
||||||
|
|
||||||
# Remove borg if we are removing the last borg app on the system
|
# Remove borg if we are removing the last borg app on the system
|
||||||
if [ "$(yunohost app list | grep "id: borg" | wc -l)" == "1" ] ; then
|
if [ "$(yunohost app list | grep "id: borg" | wc -l)" == "1" ] ; then
|
||||||
|
@ -34,11 +25,13 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# We keep files cause we don't know what the user want to do about
|
# We keep files cause we don't know what the user want to do about
|
||||||
# backups stored in the home directory
|
# backups stored in the home directory
|
||||||
#REMOVEME? ynh_system_user_delete --username=$ssh_user
|
|
||||||
|
ynh_system_user_delete --username=$ssh_user
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE CRON FILES
|
# REMOVE CRON FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_secure_remove "/etc/cron.d/$app"
|
ynh_secure_remove "/etc/cron.d/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -9,29 +9,11 @@
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# MANAGE SCRIPT FAILURE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
#REMOVEME? ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
#REMOVEME? export ssh_user=$(ynh_app_setting_get $app ssh_user)
|
|
||||||
#REMOVEME? export public_key=$(ynh_app_setting_get $app public_key)
|
|
||||||
#REMOVEME? export quota=$(ynh_app_setting_get $app quota)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..."
|
#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..."
|
||||||
|
|
||||||
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
|
|
||||||
install_borg_with_pip
|
install_borg_with_pip
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -39,7 +21,7 @@ install_borg_with_pip
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Creating SSH user used by Borg..."
|
ynh_script_progression --message="Creating SSH user used by Borg..."
|
||||||
|
|
||||||
#REMOVEME? ynh_system_user_create --username=$ssh_user --home_dir=/home/$ssh_user --use_shell --groups ssh.app
|
ynh_system_user_create --username=$ssh_user --home_dir=/home/$ssh_user --use_shell --groups ssh.app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# AUTORIZE SSH FOR THIS USER
|
# AUTORIZE SSH FOR THIS USER
|
||||||
|
|
|
@ -9,38 +9,12 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
|
||||||
#REMOVEME? ssh_user=$(ynh_app_setting_get --app=$app --key=ssh_user)
|
|
||||||
#REMOVEME? public_key=$(ynh_app_setting_get --app=$app --key=public_key)
|
|
||||||
#REMOVEME? alert_delay=$(ynh_app_setting_get --app=$app --key=alert_delay)
|
|
||||||
#REMOVEME? alert_mails=$(ynh_app_setting_get --app=$app --key=alert_mails)
|
|
||||||
#REMOVEME? quota=$(ynh_app_setting_get --app=$app --key=quota)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF AN UPGRADE IS NEEDED
|
# CHECK IF AN UPGRADE IS NEEDED
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_check_app_version_changed
|
ynh_check_app_version_changed
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# We don't backup before upgrade cause we don't want accidental
|
|
||||||
# remove of repo if upgrade failed
|
|
||||||
|
|
||||||
#REMOVEME? #ynh_backup_before_upgrade
|
|
||||||
#REMOVEME? #ynh_clean_setup () {
|
|
||||||
# # restore it if the upgrade fails
|
|
||||||
#REMOVEME? # ynh_restore_upgradebackup
|
|
||||||
#}
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
#REMOVEME? ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -83,14 +57,7 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Creating SSH user used by Borg..."
|
ynh_script_progression --message="Creating SSH user used by Borg..."
|
||||||
|
|
||||||
#REMOVEME? ynh_system_user_create --username=$ssh_user --home_dir=/home/$ssh_user --use_shell --groups ssh.app
|
ynh_system_user_create --username=$ssh_user --home_dir=/home/$ssh_user --use_shell --groups ssh.app
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# UPGRADE DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
#REMOVEME? ynh_script_progression --message="Upgrading dependencies..."
|
|
||||||
|
|
||||||
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC UPGRADE
|
# SPECIFIC UPGRADE
|
||||||
|
@ -126,6 +93,7 @@ touch /home/$ssh_user/.nobackup
|
||||||
# SETUP CRON
|
# SETUP CRON
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring cron to monitor backup..."
|
ynh_script_progression --message="Configuring cron to monitor backup..."
|
||||||
|
|
||||||
ynh_add_config --template="monitor-backup" --destination="/etc/cron.d/$app"
|
ynh_add_config --template="monitor-backup" --destination="/etc/cron.d/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
21
tests.toml
Normal file
21
tests.toml
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
test_format = 1.0
|
||||||
|
|
||||||
|
[default]
|
||||||
|
|
||||||
|
# ------------
|
||||||
|
# Tests to run
|
||||||
|
# ------------
|
||||||
|
|
||||||
|
exclude = ["install.root", "install.subdir", "change_url"] # The test IDs to be used in only/exclude statements are: install.root, install.subdir, install.nourl, install.multi, backup_restore, upgrade, upgrade.someCommitId change_url
|
||||||
|
# NB: you should NOT need this except if you really have a good reason...
|
||||||
|
|
||||||
|
|
||||||
|
# ------------
|
||||||
|
# Tests to run
|
||||||
|
# ------------
|
||||||
|
|
||||||
|
args.ssh_user="sam"
|
||||||
|
args.public_key="ssh-ed25519 AAAACCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC"
|
||||||
|
args.alert_delay=1
|
||||||
|
args.alert_mails="sam@domain.tld"
|
||||||
|
args.quota="1G"
|
Loading…
Add table
Reference in a new issue