Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ It shall NOT be edited by hand.
Regularly create deduplicated, encrypted backups sent to another server using Borg

[![馃寪 Official app website](https://img.shields.io/badge/Official_app_website-darkgreen?style=for-the-badge)](https://www.borgbackup.org)
[![Version: 1.4.5~ynh3](https://img.shields.io/badge/Version-1.4.5~ynh3-rgb(18,138,11)?style=for-the-badge)](https://ci-apps.yunohost.org/ci/apps/borg/)
[![Version: 1.4.5~ynh4](https://img.shields.io/badge/Version-1.4.5~ynh4-rgb(18,138,11)?style=for-the-badge)](https://ci-apps.yunohost.org/ci/apps/borg/)

<div align="center">
<a href="https://apps.yunohost.org/app/borg"><img height="100px" src="https://github.com/YunoHost/yunohost-artwork/raw/refs/heads/main/badges/neopossum-badges/badge_more_info_on_the_appstore.svg"/></a>
Expand Down
15 changes: 15 additions & 0 deletions config_panel.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,21 @@ name.fr = "Configuration de Borg"
type = "string"
readonly = true

[main.general.change_passphrase]
ask.en = "Change the backup passphrase"
ask.fr = "Modifier le phrase de passe des sauvegardes"
type = "boolean"
bind = "null"

[main.general.new_passphrase]
ask.en = "Fill your new passphrase (NEEDS TO BE STRONG)"
ask.fr = "Renseignez votre nouvelle phrase de passe (DOIT 脢TRE ROBUSTE)"
type = "password"
bind = "null"
help.en = "Keep it safe! There will be **no way** to restore your backup if you lose it. Do not communicate it to the remote host server holder, or anyone else."
help.fr = "Gardez-la pr茅cieusement ! Il sera **impossible** de restaurer vos sauvegardes sans celle-ci. Elle est destin茅e 脿 rester **secr猫te** : ne la donnez **pas** 脿 la personne qui g猫re le serveur distant - o霉 脿 n'importe qui d'autre !"
visible = "change_passphrase"

[main.general.remote_path]
ask.en = "Remote borg command (remote-path)"
type = "string"
Expand Down
6 changes: 3 additions & 3 deletions manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name = "Borg Backup"
description.en = "Regularly create deduplicated, encrypted backups sent to another server using Borg"
description.fr = "Cr茅ez r茅guli猫rement des sauvegardes d茅dupliqu茅es et chiff茅es envoy茅es sur un autre serveur 脿 l'aide de Borg"

version = "1.4.5~ynh3"
version = "1.4.5~ynh4"

maintainers = ["ljf", "fflorent"]

Expand Down Expand Up @@ -41,8 +41,8 @@ ram.runtime = "50M"
example = "ssh://john@serverb.tld:22/~/backup"

[install.passphrase]
ask.en = "Provide a strong passphrase to encrypt your backups. No blank space"
ask.fr = "Indiquez une phrase de passe forte pour chiffrer vos sauvegardes. Sans espaces"
ask.en = "Provide a strong passphrase to encrypt your backups"
ask.fr = "Indiquez une phrase de passe robuste pour chiffrer vos sauvegardes"
help.en = "Keep it safe! There will be **no way** to restore your backup if you lose it. Do not communicate it to the remote host server holder, or anyone else."
help.fr = "Gardez-la pr茅cieusement ! Il sera **impossible** de restaurer vos sauvegardes sans celle-ci. Elle est destin茅e 脿 rester **secr猫te** : ne la donnez **pas** 脿 la personne qui g猫re le serveur distant - o霉 脿 n'importe qui d'autre !"
type = "password"
Expand Down
19 changes: 16 additions & 3 deletions scripts/config
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ get__data_multimedia() {
get__last_backups() {

local backup_list
# Source the env file inside the command substitution ("$(...)")
# so the variables don't pollute the rest of the function and of the script.
# Indeed the command substitution spawns a subshell which is convenient here.
backup_list=$(ynh_exec_as_app "$borg_with_env_vars" list --short --last 50 "${repository}" 2> /dev/null)

if [ -z "$backup_list" ]; then
Expand Down Expand Up @@ -123,5 +120,21 @@ set__remote_path() {
ynh_config_add --template="env.jinja" --destination="$install_dir/.env" --jinja
}

set__new_passphrase() {
if [ -n "${new_passphrase}" ]; then
(
set -eEux -o pipefail
set -a
source "${install_dir}/.env"
BORG_NEW_PASSPHRASE="${new_passphrase}" "${install_dir}/venv/bin/borg" key change-passphrase
)
ynh_app_setting_set --key=passphrase --value="${new_passphrase}"
# store the new value into the `passphrase` variable so the template for `.env`
# takes the changes into account
passphrase="${new_passphrase}"
ynh_config_add --template="env.jinja" --destination="${install_dir}/.env" --jinja
fi
}

#=================================================
ynh_app_config_run $1