backup 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/bin/bash
  2. source ../settings/scripts/_common.sh
  3. source /usr/share/yunohost/helpers
  4. #=================================================
  5. # BACKUP THE APP MAIN DIR
  6. #=================================================
  7. ynh_print_info "Backing up the main app directory..."
  8. ynh_backup --src_path="/usr/local/bin/$service_name-loadcubefile.sh"
  9. ynh_backup --src_path="/etc/yunohost/hooks.d/90-vpnclient.tpl"
  10. ynh_backup --src_path="/etc/openvpn/client.conf.tpl"
  11. ynh_backup --src_path="/etc/openvpn/client.conf" --not_mandatory
  12. ynh_backup --src_path="/etc/openvpn/client.cube" --not_mandatory
  13. ynh_backup --src_path="/etc/openvpn/client.ovpn" --not_mandatory
  14. for FILE in $(ls /etc/openvpn/scripts/route-up.d/*-vpnclient-* /etc/openvpn/scripts/route-down.d/*-vpnclient-*); do
  15. ynh_backup --src_path="$FILE"
  16. done
  17. ynh_backup --src_path="/etc/openvpn/keys/"
  18. ynh_backup --src_path="/etc/openvpn/scripts/run-parts.sh"
  19. ynh_backup --src_path="/usr/local/bin/$service_name"
  20. ynh_backup --src_path="/usr/local/bin/$service_checker_name.sh"
  21. #=================================================
  22. # BACKUP SYSTEMD
  23. #=================================================
  24. ynh_print_info "Backing up systemd configuration..."
  25. ynh_backup --src_path="/etc/systemd/system/$service_name.service"
  26. ynh_backup --src_path="/etc/systemd/system/$service_checker_name.service"
  27. ynh_backup --src_path="/etc/systemd/system/$service_checker_name.timer"
  28. ynh_backup --src_path="/etc/systemd/system/openvpn@.service.d/override.conf"
  29. #=================================================
  30. # END OF SCRIPT
  31. #=================================================
  32. ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."