123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- #!/bin/bash
- source /usr/share/yunohost/helpers
- source _common.sh
- ynh_abort_if_errors
- domain=$YNH_APP_ARG_DOMAIN
- path_url=$(ynh_normalize_url_path "$YNH_APP_ARG_PATH")
- app=$YNH_APP_INSTANCE_NAME
- final_path="/var/www/$app"
- service_name="ynh-vpnclient"
- service_checker_name=$service_name"-checker"
- ynh_print_info "Validating installation parameters..."
- test ! -e "$final_path" || ynh_die "Path is already in use: ${final_path}."
- ynh_webpath_register "$app" "$domain" "$path_url"
- ynh_print_info "Storing installation settings..."
- ynh_app_setting_set "$app" domain "$domain"
- ynh_app_setting_set "$app" final_path "$final_path"
- ynh_app_setting_set "$app" service_name "$service_name"
- ynh_print_info "Installing dependencies..."
- ynh_install_app_dependencies "$pkg_dependencies"
- ynh_print_info "Deploy files from package..."
- vpnclient_deploy_files_and_services "${domain}" "${app}"
- ynh_print_info "Reloading services..."
- systemctl disable openvpn
- systemctl stop openvpn
- systemctl restart php7.0-fpm
- systemctl reload nginx
- yunohost service add $service_name --description "Tunnels the internet traffic through a VPN" --need_lock
- yunohost service enable $service_name
- yunohost service add $service_checker_name --description "Makes sure that the VPN service is running" --need_lock
- yunohost service start $service_checker_name
- yunohost service enable $service_checker_name
- systemctl start $service_checker_name.timer
- systemctl enable $service_checker_name.timer
- ynh_print_info "Installation of $app completed"
|