mirror of
https://github.com/YunoHost-Apps/restic_ynh.git
synced 2024-09-03 20:16:22 +02:00
fix: linter warnings
display some messages during installation set variables types in manifest give correct license in manifest install dependencies in upgrade script wrong function call in upgrade script
This commit is contained in:
parent
09d7ec5e1d
commit
f02c26a190
3 changed files with 21 additions and 7 deletions
|
@ -8,7 +8,7 @@
|
|||
},
|
||||
"version": "0.9.6~ynh1",
|
||||
"url": "https://restic.net/",
|
||||
"license": "BSD 2-Clause License",
|
||||
"license": "BSD 2-Clause \"Simplified\" License",
|
||||
"maintainer": {
|
||||
"name": "Lionel Coupouchetty-Ramouchetty",
|
||||
"email": "restic-ynh@coupouchetty-ramouchetty.fr",
|
||||
|
@ -23,6 +23,7 @@
|
|||
"install" : [
|
||||
{
|
||||
"name": "server",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "Indicate the server where you want put your backups",
|
||||
"fr": "Indiquez le serveur où vous voulez faire vos sauvegardes"
|
||||
|
@ -35,6 +36,7 @@
|
|||
},
|
||||
{
|
||||
"name": "port",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "sftp port of your server",
|
||||
"fr": "Le port sftp de votre serveur"
|
||||
|
@ -48,6 +50,7 @@
|
|||
},
|
||||
{
|
||||
"name": "backup_path",
|
||||
"type": "path",
|
||||
"ask": {
|
||||
"en": "The directory where you want to backup repositories to be created in",
|
||||
"fr": "Le répertoire dans lequel les dépôts restic seront créés"
|
||||
|
@ -61,6 +64,7 @@
|
|||
},
|
||||
{
|
||||
"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"
|
||||
|
@ -95,6 +99,7 @@
|
|||
},
|
||||
{
|
||||
"name": "apps",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "Which apps would you backup (list separated by comma or 'all') ?",
|
||||
"fr": "Souhaitez-vous effectuer des sauvegardes de vos applications ?"
|
||||
|
@ -116,6 +121,7 @@
|
|||
},
|
||||
{
|
||||
"name": "on_calendar",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "Indicate the backup frequency (see systemd OnCalendar format)",
|
||||
"fr": "Indiquez la fréquence de la sauvegarde (voir le format OnCalendar de systemd)"
|
||||
|
|
|
@ -32,23 +32,28 @@ ynh_save_args server port ssh_user backup_path passphrase on_calendar conf data
|
|||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_print_info --message="Installing dependencies"
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
ynh_print_info --message="Installing restic binary"
|
||||
install_restic
|
||||
|
||||
#=================================================
|
||||
# ACTIVATE BACKUP METHODS
|
||||
#=================================================
|
||||
ynh_print_info --message="Activating backup methods"
|
||||
mkdir -p /etc/yunohost/hooks.d/backup_method
|
||||
mkdir -p /usr/share/yunohost/backup_method
|
||||
|
||||
#=================================================
|
||||
# SETUP THE BACKUP METHOD
|
||||
#=================================================
|
||||
ynh_print_info --message="Setting up backup methods"
|
||||
ynh_configure backup_method "/etc/yunohost/hooks.d/backup_method/05-${app}_app"
|
||||
|
||||
#=================================================
|
||||
# CONFIGURE CRON
|
||||
#=================================================
|
||||
ynh_print_info --message="Configuring cron"
|
||||
ynh_configure backup-with-restic "/usr/local/bin/backup-with-$app"
|
||||
ynh_configure backup-with-restic-answerbot "/usr/local/bin/backup-with-$app-answerbot"
|
||||
chmod u+x "/usr/local/bin/backup-with-$app"
|
||||
|
@ -57,19 +62,18 @@ ynh_add_systemd_config
|
|||
ynh_configure systemd.timer "/etc/systemd/system/$app.timer"
|
||||
systemctl enable $app.timer
|
||||
systemctl start $app.timer
|
||||
#yunohost service add $app.timer
|
||||
#yunohost service enable $app.timer
|
||||
#yunohost service start $app.timer
|
||||
|
||||
#=================================================
|
||||
# GENERATE SSH KEY
|
||||
#=================================================
|
||||
ynh_print_info --message="Generating private key"
|
||||
private_key="/root/.ssh/id_${app}_ed25519"
|
||||
test -f $private_key || ssh-keygen -q -t ed25519 -N "" -f $private_key
|
||||
|
||||
#=================================================
|
||||
# GENERATE SSH CONFIG
|
||||
#=================================================
|
||||
ynh_print_info --message="Generating ssh config for ${server}"
|
||||
grep -q "${server}" /root/.ssh/config 2>/dev/null || cat << EOCONF >> ~/.ssh/config
|
||||
Host ${server}
|
||||
Hostname ${server}
|
||||
|
@ -84,13 +88,14 @@ EOCONF
|
|||
# Display key
|
||||
#=================================================
|
||||
|
||||
echo "You should now allow the following public key for user ${ssh_user} on server ${server}:
|
||||
ynh_print_info --message="You should now allow the following public key for user ${ssh_user} on server ${server}:
|
||||
$(cat ${private_key}.pub)"
|
||||
|
||||
|
||||
#=================================================
|
||||
# SEND A README FOR THE ADMIN
|
||||
#=================================================
|
||||
ynh_print_info --message="Sending post-installation instructions to admin"
|
||||
ynh_print_OFF
|
||||
message="You should now allow the following public key for user ${ssh_user} on server ${server}:
|
||||
$(cat ${private_key}.pub)
|
||||
|
|
|
@ -40,5 +40,8 @@ if grep "restic.timer" /etc/yunohost/services.yml > /dev/null ; then
|
|||
systemctl start $app.timer
|
||||
fi
|
||||
|
||||
# install
|
||||
install_borg_with_pip
|
||||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
install_restic
|
||||
|
|
Loading…
Reference in a new issue