mirror of
https://github.com/YunoHost-Apps/borg_ynh.git
synced 2024-09-03 18:16:05 +02:00
[fix] Bad yaml returned by config script
This commit is contained in:
parent
d8a95811e2
commit
88c040b101
3 changed files with 48 additions and 15 deletions
|
@ -16,20 +16,20 @@ services = []
|
||||||
[main.general]
|
[main.general]
|
||||||
[main.general.info]
|
[main.general.info]
|
||||||
ask = """\
|
ask = """\
|
||||||
Backup state : {state}
|
Backup state : {{state}}
|
||||||
Last run: {last_run}
|
Last run: {{last_run}}
|
||||||
"""
|
"""
|
||||||
type = "alert"
|
type = "alert"
|
||||||
style = "info"
|
style = "info"
|
||||||
|
|
||||||
[main.settings.repository]
|
[main.general.repository]
|
||||||
ask.en = "Repository"
|
ask.en = "Repository"
|
||||||
type = "string"
|
type = "string"
|
||||||
help = "Specify a local repository like /mount/my_external_harddrive/backups or a remote repository using this format: ssh://USER@DOMAIN.TLD:PORT/~/backup . If you plan to use borgserver_ynh app : 'USER' is *not* meant to be an existing user on the guest server, instead, it will be created *on the host server* during the installation of the Borg Server App. With borgserver_ynh apps you can't specify another repo path than ~/backup."
|
help = "Specify a local repository like /mount/my_external_harddrive/backups or a remote repository using this format: ssh://USER@DOMAIN.TLD:PORT/~/backup . If you plan to use borgserver_ynh app : 'USER' is *not* meant to be an existing user on the guest server, instead, it will be created *on the host server* during the installation of the Borg Server App. With borgserver_ynh apps you can't specify another repo path than ~/backup."
|
||||||
|
|
||||||
[main.settings.ssh_public_key]
|
[main.general.ssh_public_key]
|
||||||
ask.en = "Public key: {ssh_public_key}"
|
ask.en = "Public key: {ssh_public_key}"
|
||||||
type = "display_text"
|
type = "markdown"
|
||||||
bind = "/root/.ssh/id___APP___ed25519.pub"
|
bind = "/root/.ssh/id___APP___ed25519.pub"
|
||||||
|
|
||||||
[main.general.on_calendar]
|
[main.general.on_calendar]
|
||||||
|
@ -58,6 +58,10 @@ services = []
|
||||||
ask.en = "Data"
|
ask.en = "Data"
|
||||||
type = "boolean"
|
type = "boolean"
|
||||||
|
|
||||||
|
[main.content.data_multimedia]
|
||||||
|
ask.en = "Data multimedia"
|
||||||
|
type = "boolean"
|
||||||
|
|
||||||
[main.content.apps]
|
[main.content.apps]
|
||||||
ask.en = "Apps"
|
ask.en = "Apps"
|
||||||
type = "tags"
|
type = "tags"
|
||||||
|
@ -69,8 +73,5 @@ services = []
|
||||||
[advanced.list]
|
[advanced.list]
|
||||||
name = "Last backups list"
|
name = "Last backups list"
|
||||||
[advanced.list.last_backups]
|
[advanced.list.last_backups]
|
||||||
ask.en = """\
|
ask.en = ""
|
||||||
{last_backups}\
|
|
||||||
"""
|
|
||||||
type = "markdown"
|
type = "markdown"
|
||||||
|
|
||||||
|
|
|
@ -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.16~ynh25",
|
"version": "1.1.16~ynh26",
|
||||||
"url": "https://borgbackup.readthedocs.io",
|
"url": "https://borgbackup.readthedocs.io",
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
|
|
|
@ -9,11 +9,16 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
get__info() {
|
get__info() {
|
||||||
if [ "$state" == "failed" ]; then
|
|
||||||
cat << EOF
|
cat << EOF
|
||||||
|
ask:
|
||||||
|
en: "**Backup state**: ${old[state]}
|
||||||
|
|
||||||
|
**Last run**: ${old[last_run]}"
|
||||||
|
EOF
|
||||||
|
if [ "${old[state]}" == "failed" ]; then
|
||||||
style: "danger"
|
style: "danger"
|
||||||
EOF
|
EOF
|
||||||
elif [ "$state" == "successful" ]; then
|
elif [ "${old[state]}" == "successful" ]; then
|
||||||
cat << EOF
|
cat << EOF
|
||||||
style: "success"
|
style: "success"
|
||||||
EOF
|
EOF
|
||||||
|
@ -24,10 +29,24 @@ EOF
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get__ssh_public_key() {
|
||||||
|
cat << EOF
|
||||||
|
ask:
|
||||||
|
en: "**Public key**: \`$(cat /root/.ssh/id_${app}_ed25519.pub || echo '')\`"
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
get__data_multimedia() {
|
||||||
|
if [ -e /home/yunohost.multimedia/.nobackup ]; then
|
||||||
|
echo "value: false"
|
||||||
|
else
|
||||||
|
echo "value: true"
|
||||||
|
fi
|
||||||
|
}
|
||||||
get__last_backups() {
|
get__last_backups() {
|
||||||
cat << EOF
|
cat << EOF
|
||||||
value:
|
ask: |-
|
||||||
$(borg list --short --last 50 $repository)
|
$(BORG_PASSPHRASE="$(yunohost app setting $app passphrase)" BORG_RSH="ssh -i /root/.ssh/id_${app}_ed25519 -oStrictHostKeyChecking=yes " borg list --short --last 50 ${old[repository]} | sed 's/^/ /g' 2> /dev/null)
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,11 +55,24 @@ EOF
|
||||||
#=================================================
|
#=================================================
|
||||||
validate__on_calendar() {
|
validate__on_calendar() {
|
||||||
|
|
||||||
(! systemd-analyze calendar $on_calendar > /dev/null) &&
|
(systemd-analyze calendar $on_calendar > /dev/null) ||
|
||||||
echo 'Please follow systemd OnCalendar format: https://man.archlinux.org/man/systemd.time.7#CALENDAR_EVENTS'
|
echo 'Please follow systemd OnCalendar format: https://man.archlinux.org/man/systemd.time.7#CALENDAR_EVENTS'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC SETTERS FOR TOML SHORT KEYS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
set__data_multimedia() {
|
||||||
|
if [ "$data_multimedia" == "false" ]; then
|
||||||
|
mkdir -p /home/yunohost.multimedia/
|
||||||
|
touch /home/yunohost.multimedia/.nobackup
|
||||||
|
else
|
||||||
|
ynh_secure_remove /home/yunohost.multimedia/.nobackup
|
||||||
|
fi
|
||||||
|
}
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_app_config_run $1
|
ynh_app_config_run $1
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue