1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- #!/bin/bash
- source ../settings/scripts/_common.sh
- source /usr/share/yunohost/helpers
- #=================================================
- # RESTORE THE APP MAIN DIR
- #=================================================
- ynh_print_info "Restoring the app files..."
- ynh_restore_file --origin_path="/usr/local/bin/$service_name-loadcubefile.sh"
- ynh_restore_file --origin_path="/etc/yunohost/hooks.d/90-vpnclient.tpl"
- ynh_restore_file --origin_path="/etc/openvpn/client.conf.tpl"
- ynh_restore_file --origin_path="/etc/openvpn/client.conf" --not_mandatory
- ynh_restore_file --origin_path="/etc/openvpn/client.cube" --not_mandatory
- ynh_restore_file --origin_path="/etc/openvpn/client.ovpn" --not_mandatory
- ynh_restore_file --origin_path="/etc/openvpn/scripts/route-up.d/10-set-firewall"
- ynh_restore_file --origin_path="/etc/openvpn/scripts/route-up.d/20-set-dns"
- ynh_restore_file --origin_path="/etc/openvpn/scripts/route-up.d/30-set-server-ipv6-route"
- ynh_restore_file --origin_path="/etc/openvpn/scripts/route-up.d/40-set-ipv6"
- ynh_restore_file --origin_path="/etc/openvpn/scripts/route-down.d/10-unset-firewall"
- ynh_restore_file --origin_path="/etc/openvpn/scripts/route-down.d/20-unset-dns"
- ynh_restore_file --origin_path="/etc/openvpn/scripts/route-down.d/30-unset-server-ipv6-route"
- ynh_restore_file --origin_path="/etc/openvpn/scripts/route-down.d/40-unset-ipv6"
- ynh_restore_file --origin_path="/etc/openvpn/keys/"
- ynh_restore_file --origin_path="/etc/openvpn/scripts/run-parts.sh"
- ynh_restore_file --origin_path="/usr/local/bin/$service_name"
- ynh_restore_file --origin_path="/usr/local/bin/$service_checker_name.sh"
- #=================================================
- # RESTORE SYSTEMD
- #=================================================
- ynh_print_info "Restoring the systemd configuration..."
- ynh_restore_file --origin_path="/etc/systemd/system/$service_name.service"
- ynh_restore_file --origin_path="/etc/systemd/system/$service_checker_name.service"
- ynh_restore_file --origin_path="/etc/systemd/system/$service_checker_name.timer"
- ynh_restore_file --origin_path="/etc/systemd/system/openvpn@.service.d/override.conf"
- systemctl daemon-reload
- systemctl enable "$service_name.service" --quiet
- systemctl enable "$service_checker_name.service" --quiet
- systemctl enable "openvpn@.service" --quiet
- #=================================================
- # ADVERTISE SERVICE IN ADMIN PANEL
- #=================================================
- yunohost service add $service_name --description "Tunnels the internet traffic through a VPN" --need_lock --test_status="systemctl is-active openvpn@client.service" --log "/var/log/ynh-vpnclient.log"
- #=================================================
- # END OF SCRIPT
- #=================================================
- ynh_print_info "Restoration completed for $app"
|