mirror of
https://github.com/YunoHost-Apps/restic_ynh.git
synced 2024-09-03 20:16:22 +02:00
Testing enabling all kind of repositories
This commit is contained in:
parent
77b90852d1
commit
fb77ce0f94
6 changed files with 103 additions and 139 deletions
|
@ -1,11 +1,8 @@
|
|||
;; Test complet
|
||||
; Manifest
|
||||
server="dst.domain.tld"
|
||||
ssh_user="sam"
|
||||
repository="sftp://sam@dst.domain.tld:2222/src.domain.tld/"
|
||||
passphrase="APassphrase"
|
||||
conf=1
|
||||
port=2222
|
||||
backup_path=src.domain.tld
|
||||
data=1
|
||||
app="all"
|
||||
allow_extra_space_use=1
|
||||
|
|
|
@ -5,13 +5,8 @@ set -e
|
|||
###
|
||||
# Fetch information from YNH settings
|
||||
###
|
||||
RESTIC_SERVER=$(yunohost app setting {{ app }} server)
|
||||
RESTIC_SERVER_PORT=$(yunohost app setting {{ app }} port)
|
||||
RESTIC_SERVER_USER=$(yunohost app setting {{ app }} ssh_user)
|
||||
RESTIC_PATH=$(yunohost app setting {{ app }} backup_path)
|
||||
|
||||
RESTIC_REPOSITORY_BASE=$(yunohost app setting {{ app }} repository)
|
||||
RESTIC_PASSWORD="$(yunohost app setting {{ app }} passphrase)"
|
||||
RESTIC_REPOSITORY_BASE=sftp://$RESTIC_SERVER_USER@$RESTIC_SERVER:$RESTIC_SERVER_PORT/$RESTIC_PATH/
|
||||
|
||||
RESTIC_COMMAND=/usr/local/bin/{{ app }}
|
||||
LOGFILE=/var/log/restic_backup_{{ app }}.log
|
||||
|
|
|
@ -2,13 +2,8 @@
|
|||
|
||||
set -e
|
||||
|
||||
RESTIC_SERVER=$(yunohost app setting {{ app }} server)
|
||||
RESTIC_SERVER_PORT=$(yunohost app setting {{ app }} port)
|
||||
RESTIC_SERVER_USER=$(yunohost app setting {{ app }} ssh_user)
|
||||
RESTIC_PATH=$(yunohost app setting {{ app }} backup_path)
|
||||
|
||||
RESTIC_REPOSITORY_BASE=$(yunohost app setting {{ app }} repository)
|
||||
RESTIC_PASSWORD="$(yunohost app setting {{ app }} passphrase)"
|
||||
RESTIC_REPOSITORY_BASE=sftp://$RESTIC_SERVER_USER@$RESTIC_SERVER:$RESTIC_SERVER_PORT/$RESTIC_PATH/
|
||||
|
||||
RESTIC_COMMAND=/usr/local/bin/{{ app }}
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "Restic",
|
||||
"id": "restic",
|
||||
"name": "Restic for all",
|
||||
"id": "restic-pbe",
|
||||
"packaging_format": 1,
|
||||
"description": {
|
||||
"en": "Backup your server with restic.",
|
||||
"fr": "Sauvegardez votre serveur avec restic."
|
||||
},
|
||||
"version": "0.12.0~ynh9",
|
||||
"version": "0.13.0~pbe1",
|
||||
"url": "https://restic.net/",
|
||||
"license": "BSD-2-Clause",
|
||||
"maintainer": {
|
||||
|
@ -22,54 +22,17 @@
|
|||
"arguments": {
|
||||
"install" : [
|
||||
{
|
||||
"name": "server",
|
||||
"name": "repository",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "Indicate the server where you want put your backups",
|
||||
"fr": "Indiquez le serveur où vous voulez faire vos sauvegardes"
|
||||
"en": "Indicate the Restic repository where you want to put your backups",
|
||||
"fr": "Indiquez le repository Restic où vous voulez faire vos sauvegardes"
|
||||
},
|
||||
"help":{
|
||||
"en": "IP address or resolvable hostname of your destination server",
|
||||
"fr": "Adresse IP ou nom résolvable de votre serveur de destination"
|
||||
"en": "Un repository Restic peut être un serveur SFTP, une cible rclone, etc",
|
||||
"fr": "Un repository Restic peut être un serveur SFTP, une cible rclone, etc"
|
||||
},
|
||||
"example": "example.com"
|
||||
},
|
||||
{
|
||||
"name": "port",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "sftp port of your server",
|
||||
"fr": "Le port sftp de votre serveur"
|
||||
},
|
||||
"help":{
|
||||
"en": "Listening port of your sftp or ssh server. The default value is 22",
|
||||
"fr": "Le port d'écoute de votre serveur sftp ou ssh. La valeur par défaut est 22"
|
||||
},
|
||||
"example": "22",
|
||||
"default": "22"
|
||||
},
|
||||
{
|
||||
"name": "backup_path",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "The directory where you want your backup repositories to be created in",
|
||||
"fr": "Le répertoire dans lequel les dépôts restic seront créés"
|
||||
},
|
||||
"help":{
|
||||
"en": "A complete or relative path to an existing directory on the remote server writable by the remote backup user. Defaults to the login directory",
|
||||
"fr": "Un chemin complet ou relatif vers un répertoire existant sur le serveur distant et accessible en écriture au compte utilisé pour la sauvegarde. Répertoire d'accueil par défaut"
|
||||
},
|
||||
"example": "./backups",
|
||||
"default": "."
|
||||
},
|
||||
{
|
||||
"name": "ssh_user",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "Indicate the ssh user to use to connect on this server",
|
||||
"fr": "Indiquez l'utilisateur ssh à utiliser pour se connecter au serveur"
|
||||
},
|
||||
"example": "john"
|
||||
"example": "sftp://user@example.com:1234/path/"
|
||||
},
|
||||
{
|
||||
"name": "passphrase",
|
||||
|
@ -79,6 +42,15 @@
|
|||
"fr": "Indiquez une phrase de passe forte que vous garderez précieusement si vous voulez être en mesure d'utiliser vos sauvegardes"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "generate_ssh_key",
|
||||
"type": "boolean",
|
||||
"ask": {
|
||||
"en": "Would you like to generate a SSH key? This is useful if you want to save on a SFTP repository.",
|
||||
"fr": "Souhaitez-vous générer une clé SSH ? C'est utile si vous désirez utiliser SFTP comme méthode de sauvegarde."
|
||||
},
|
||||
"default": true
|
||||
},
|
||||
{
|
||||
"name": "conf",
|
||||
"type": "boolean",
|
||||
|
|
|
@ -23,12 +23,12 @@ export app=$YNH_APP_INSTANCE_NAME
|
|||
export final_path="/opt/yunohost/${app}"
|
||||
|
||||
# Retrieve arguments
|
||||
ynh_export server port ssh_user backup_path passphrase on_calendar check_on_calendar check_read_data_on_calendar conf data apps allow_extra_space_use
|
||||
ynh_export repository passphrase generate_ssh_key on_calendar check_on_calendar check_read_data_on_calendar conf data apps allow_extra_space_use
|
||||
|
||||
#=================================================
|
||||
# STORE SETTINGS FROM MANIFEST
|
||||
#=================================================
|
||||
ynh_save_args server port ssh_user backup_path passphrase on_calendar check_on_calendar check_read_data_on_calendar conf data apps allow_extra_space_use
|
||||
ynh_save_args repository passphrase generate_ssh_key on_calendar check_on_calendar check_read_data_on_calendar conf data apps allow_extra_space_use
|
||||
|
||||
#=================================================
|
||||
# INSTALL RESTIC
|
||||
|
@ -115,6 +115,8 @@ ynh_use_logrotate --logfile=/var/log/restic_backup_${app}.err
|
|||
ynh_use_logrotate --logfile=/var/log/restic_check_${app}.log
|
||||
ynh_use_logrotate --logfile=/var/log/restic_check_${app}.err
|
||||
|
||||
if [ "${generate_ssh_key}" == "true" ]; then
|
||||
|
||||
#=================================================
|
||||
# GENERATE SSH KEY
|
||||
#=================================================
|
||||
|
@ -173,3 +175,4 @@ If you're facing an issue or want to improve this app, please open a new issue i
|
|||
|
||||
ynh_send_readme_to_admin "$message" "root"
|
||||
ynh_print_ON
|
||||
fi
|
||||
|
|
|
@ -15,11 +15,9 @@ source /usr/share/yunohost/helpers
|
|||
|
||||
export app=$YNH_APP_INSTANCE_NAME
|
||||
export final_path="/opt/yunohost/${app}"
|
||||
export server=$(ynh_app_setting_get $app server)
|
||||
export port=$(ynh_app_setting_get $app port)
|
||||
export ssh_user=$(ynh_app_setting_get $app ssh_user)
|
||||
export backup_path=$(ynh_app_setting_get $app backup_path)
|
||||
export repository=$(ynh_app_setting_get $app repository)
|
||||
export passphrase=$(ynh_app_setting_get $app passphrase)
|
||||
export generate_ssh_key=$(ynh_app_setting_get $app generate_ssh_key)
|
||||
export on_calendar=$(ynh_app_setting_get $app on_calendar)
|
||||
export check_on_calendar=$(ynh_app_setting_get $app check_on_calendar)
|
||||
export check_read_data_on_calendar=$(ynh_app_setting_get $app check_read_data_on_calendar)
|
||||
|
@ -158,6 +156,8 @@ ynh_use_logrotate --logfile=/var/log/restic_backup_${app}.err
|
|||
ynh_use_logrotate --logfile=/var/log/restic_check_${app}.log
|
||||
ynh_use_logrotate --logfile=/var/log/restic_check_${app}.err
|
||||
|
||||
if [ "${generate_ssh_key}" == "true" ]; then
|
||||
|
||||
#=================================================
|
||||
# UPGRADE SSH CONFIG
|
||||
#=================================================
|
||||
|
@ -186,3 +186,5 @@ Host ${server}
|
|||
EOCONF
|
||||
fi
|
||||
ynh_script_progression --message="End of upgrade process" --last
|
||||
|
||||
fi
|
||||
|
|
Loading…
Add table
Reference in a new issue