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
509f97fa48
commit
ad2e5bae89
7 changed files with 106 additions and 39 deletions
67
manifest.toml
Normal file
67
manifest.toml
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
packaging_format = 2
|
||||||
|
|
||||||
|
id = "borgserver"
|
||||||
|
name = "Borg Server"
|
||||||
|
description.en = "Offer backup storage to a friend"
|
||||||
|
description.fr = "Offrez un espace de stockage à un⋅e ami⋅e"
|
||||||
|
|
||||||
|
version = "1.1.16~ynh9"
|
||||||
|
|
||||||
|
maintainers = ["ljf"]
|
||||||
|
|
||||||
|
[upstream]
|
||||||
|
license = "BSD-3-Clause"
|
||||||
|
website = "https://www.borgbackup.org/"
|
||||||
|
admindoc = "https://borgbackup.readthedocs.io/en/stable/"
|
||||||
|
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]
|
||||||
|
yunohost = ">= 4.2.3"
|
||||||
|
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"]
|
||||||
|
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.
|
||||||
|
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.
|
||||||
|
disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ...
|
||||||
|
ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
|
||||||
|
ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
|
||||||
|
|
||||||
|
[install]
|
||||||
|
[install.ssh_user]
|
||||||
|
ask.en = "Indicate the SSH user to create"
|
||||||
|
ask.fr = "Indiquez l'utilisateur SSH à créer"
|
||||||
|
type = "string"
|
||||||
|
example = "john"
|
||||||
|
|
||||||
|
[install.public_key]
|
||||||
|
ask.en = "Indicate the public key given by borg_ynh app"
|
||||||
|
ask.fr = "Indiquez la clé publique donnée par l'app borg_ynh"
|
||||||
|
type = "string"
|
||||||
|
|
||||||
|
[install.alert_delay]
|
||||||
|
ask.en = "After which delay in days should we alert if there are no changes on repo ?"
|
||||||
|
ask.fr = "Après quel délais en jours devons-nous lancer une alerte si il n'y a pas de changement dans le repo ?"
|
||||||
|
type = "string"
|
||||||
|
default = "1"
|
||||||
|
|
||||||
|
[install.alert_mails]
|
||||||
|
ask.en = "Emails to whom send alerts ?"
|
||||||
|
ask.fr = "Emails des personnes à qui envoyer les alertes ?"
|
||||||
|
type = "string"
|
||||||
|
default = "root"
|
||||||
|
example = "camille@example.com,eden@example.com"
|
||||||
|
|
||||||
|
[install.quota]
|
||||||
|
ask.en = "Indicate the storage quota"
|
||||||
|
ask.fr = "Indiquez le quota de stockage"
|
||||||
|
type = "string"
|
||||||
|
optionnal = true
|
||||||
|
example = "30G"
|
||||||
|
|
||||||
|
[resources]
|
||||||
|
[resources.system_user]
|
||||||
|
|
||||||
|
[resources.install_dir]
|
||||||
|
|
||||||
|
[resources.permissions]
|
|
@ -7,7 +7,7 @@
|
||||||
PKG_DIR=$(cd ../; pwd)
|
PKG_DIR=$(cd ../; pwd)
|
||||||
BORG_VERSION=1.1.16
|
BORG_VERSION=1.1.16
|
||||||
|
|
||||||
pkg_dependencies="python3-pip python3-dev libacl1-dev libssl-dev liblz4-dev python3-jinja2 python3-setuptools python3-venv virtualenv libfuse-dev pkg-config"
|
#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 () {
|
||||||
|
@ -35,10 +35,10 @@ ynh_export () {
|
||||||
for var in $@;
|
for var in $@;
|
||||||
do
|
do
|
||||||
ynh_arg=$(echo "$var" | awk '{print toupper($0)}')
|
ynh_arg=$(echo "$var" | awk '{print toupper($0)}')
|
||||||
if [ "$var" == "path_url" ]; then
|
if [ "$var" == "path" ]; then
|
||||||
ynh_arg="PATH"
|
ynh_arg="PATH"
|
||||||
fi
|
fi
|
||||||
ynh_arg="YNH_APP_ARG_$ynh_arg"
|
#REMOVEME? ynh_arg="YNH_APP_ARG_$ynh_arg"
|
||||||
export $var="${!ynh_arg}"
|
export $var="${!ynh_arg}"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ ynh_save_args () {
|
||||||
for var in $@;
|
for var in $@;
|
||||||
do
|
do
|
||||||
local setting_var="$var"
|
local setting_var="$var"
|
||||||
if [ "$var" == "path_url" ]; then
|
if [ "$var" == "path" ]; then
|
||||||
setting_var="path"
|
setting_var="path"
|
||||||
fi
|
fi
|
||||||
ynh_app_setting_set $app $setting_var "${!var}"
|
ynh_app_setting_set $app $setting_var "${!var}"
|
||||||
|
|
|
@ -13,15 +13,15 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
#REMOVEME? ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Loading installation settings..."
|
#REMOVEME? ynh_print_info --message="Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
||||||
export ssh_user="$(ynh_app_setting_get $app ssh_user)"
|
#REMOVEME? export ssh_user="$(ynh_app_setting_get $app ssh_user)"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||||
|
|
|
@ -14,13 +14,13 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
#REMOVEME? ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
export app=$YNH_APP_INSTANCE_NAME
|
#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 +44,9 @@ ynh_save_args ssh_user public_key quota alert_delay alert_mails
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installing dependencies..."
|
#REMOVEME? ynh_script_progression --message="Installing dependencies..."
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
|
||||||
install_borg_with_pip
|
install_borg_with_pip
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -54,7 +54,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..."
|
||||||
|
|
||||||
ynh_system_user_create --username=$ssh_user --home_dir=/home/$ssh_user --use_shell --groups ssh.app
|
#REMOVEME? 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
|
||||||
|
|
|
@ -13,15 +13,15 @@ source /usr/share/yunohost/helpers
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
||||||
ssh_user=$(ynh_app_setting_get $app ssh_user)
|
#REMOVEME? ssh_user=$(ynh_app_setting_get $app ssh_user)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEPENDENCIES
|
# REMOVE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing dependencies..."
|
#REMOVEME? ynh_script_progression --message="Removing dependencies..."
|
||||||
|
|
||||||
ynh_remove_app_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,7 +34,7 @@ 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
|
||||||
ynh_system_user_delete --username=$ssh_user
|
#REMOVEME? ynh_system_user_delete --username=$ssh_user
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE CRON FILES
|
# REMOVE CRON FILES
|
||||||
|
|
|
@ -14,24 +14,24 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
#REMOVEME? ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
export ssh_user=$(ynh_app_setting_get $app ssh_user)
|
#REMOVEME? export ssh_user=$(ynh_app_setting_get $app ssh_user)
|
||||||
export public_key=$(ynh_app_setting_get $app public_key)
|
#REMOVEME? export public_key=$(ynh_app_setting_get $app public_key)
|
||||||
export quota=$(ynh_app_setting_get $app quota)
|
#REMOVEME? export quota=$(ynh_app_setting_get $app quota)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reinstalling dependencies..."
|
#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..."
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
|
||||||
install_borg_with_pip
|
install_borg_with_pip
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -39,7 +39,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..."
|
||||||
|
|
||||||
ynh_system_user_create --username=$ssh_user --home_dir=/home/$ssh_user --use_shell --groups ssh.app
|
#REMOVEME? 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
|
||||||
|
|
|
@ -13,12 +13,12 @@ source /usr/share/yunohost/helpers
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
||||||
ssh_user=$(ynh_app_setting_get --app=$app --key=ssh_user)
|
#REMOVEME? ssh_user=$(ynh_app_setting_get --app=$app --key=ssh_user)
|
||||||
public_key=$(ynh_app_setting_get --app=$app --key=public_key)
|
#REMOVEME? public_key=$(ynh_app_setting_get --app=$app --key=public_key)
|
||||||
alert_delay=$(ynh_app_setting_get --app=$app --key=alert_delay)
|
#REMOVEME? alert_delay=$(ynh_app_setting_get --app=$app --key=alert_delay)
|
||||||
alert_mails=$(ynh_app_setting_get --app=$app --key=alert_mails)
|
#REMOVEME? alert_mails=$(ynh_app_setting_get --app=$app --key=alert_mails)
|
||||||
quota=$(ynh_app_setting_get --app=$app --key=quota)
|
#REMOVEME? quota=$(ynh_app_setting_get --app=$app --key=quota)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF AN UPGRADE IS NEEDED
|
# CHECK IF AN UPGRADE IS NEEDED
|
||||||
|
@ -33,13 +33,13 @@ ynh_check_app_version_changed
|
||||||
# We don't backup before upgrade cause we don't want accidental
|
# We don't backup before upgrade cause we don't want accidental
|
||||||
# remove of repo if upgrade failed
|
# remove of repo if upgrade failed
|
||||||
|
|
||||||
#ynh_backup_before_upgrade
|
#REMOVEME? #ynh_backup_before_upgrade
|
||||||
#ynh_clean_setup () {
|
#REMOVEME? #ynh_clean_setup () {
|
||||||
# # restore it if the upgrade fails
|
# # restore it if the upgrade fails
|
||||||
# ynh_restore_upgradebackup
|
#REMOVEME? # ynh_restore_upgradebackup
|
||||||
#}
|
#}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
#REMOVEME? ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
|
@ -83,14 +83,14 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Creating SSH user used by Borg..."
|
ynh_script_progression --message="Creating SSH user used by Borg..."
|
||||||
|
|
||||||
ynh_system_user_create --username=$ssh_user --home_dir=/home/$ssh_user --use_shell --groups ssh.app
|
#REMOVEME? ynh_system_user_create --username=$ssh_user --home_dir=/home/$ssh_user --use_shell --groups ssh.app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPGRADE DEPENDENCIES
|
# UPGRADE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading dependencies..."
|
#REMOVEME? ynh_script_progression --message="Upgrading dependencies..."
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC UPGRADE
|
# SPECIFIC UPGRADE
|
||||||
|
|
Loading…
Reference in a new issue