|
@@ -9,22 +9,22 @@ source /usr/share/yunohost/helpers
|
|
|
|
|
|
# Removing configuration files with naming that occured in versions < 1.2.0 ("vpnadmin" instead off "$app")
|
|
|
if [ -d /var/www/vpnadmin ]; then
|
|
|
- ynh_secure_remove /var/www/vpnadmin
|
|
|
+ ynh_safe_rm /var/www/vpnadmin
|
|
|
fi
|
|
|
|
|
|
# Old stuff
|
|
|
|
|
|
if [ -f /etc/nginx/conf.d/*.d/$app.conf ]; then
|
|
|
- ynh_secure_remove /etc/nginx/conf.d/*.d/$app.conf
|
|
|
- ynh_systemd_action --service_name=nginx --action=reload
|
|
|
+ ynh_safe_rm /etc/nginx/conf.d/*.d/$app.conf
|
|
|
+ ynh_systemctl --service=nginx --action=reload
|
|
|
fi
|
|
|
|
|
|
for php_path in $(ls /etc/php/*/fpm/pool.d/$app.conf 2> /dev/null); do
|
|
|
- ynh_secure_remove $php_path
|
|
|
+ ynh_safe_rm $php_path
|
|
|
done
|
|
|
|
|
|
if [ -d /var/www/$app ]; then
|
|
|
- ynh_secure_remove /var/www/$app
|
|
|
+ ynh_safe_rm /var/www/$app
|
|
|
fi
|
|
|
|
|
|
[ -z "${domain:-}" ] || ynh_app_setting_delete $app domain
|
|
@@ -33,26 +33,27 @@ fi
|
|
|
[ -z "${install_dir:-}" ] || ynh_app_setting_delete $app install_dir
|
|
|
|
|
|
if [ -e "/etc/sudoers.d/${app}_ynh" ]; then
|
|
|
- ynh_secure_remove "/etc/sudoers.d/${app}_ynh"
|
|
|
+ ynh_safe_rm "/etc/sudoers.d/${app}_ynh"
|
|
|
fi
|
|
|
|
|
|
# New stuff
|
|
|
|
|
|
if [ -z "${dns_method:-}" ]; then
|
|
|
- ynh_app_setting_set --app=$app --key=dns_method --value=custom
|
|
|
+ ynh_app_setting_set --key=dns_method --value=custom
|
|
|
fi
|
|
|
+# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=nameservers --value="$(grep -o -P '\s*nameserver\s+\K[abcdefabcdef\d.:]+' /etc/resolv.dnsmasq.conf | sort | uniq | paste -s -d, -)"
|
|
|
if [ -z "${nameservers:-}" ]; then
|
|
|
nameservers="$(grep -o -P '\s*nameserver\s+\K[abcdefabcdef\d.:]+' /etc/resolv.dnsmasq.conf | sort | uniq | paste -s -d, -)"
|
|
|
- ynh_app_setting_set --app=$app --key=nameservers --value="$nameservers"
|
|
|
+ ynh_app_setting_set --key=nameservers --value="$nameservers"
|
|
|
fi
|
|
|
if [ -z "${service_enabled:-}" ]; then
|
|
|
- ynh_app_setting_set --app=$app --key=service_enabled --value=0
|
|
|
+ ynh_app_setting_set --key=service_enabled --value=0
|
|
|
fi
|
|
|
if [ -z "${ip6_addr:-}" ]; then
|
|
|
- ynh_app_setting_set --app=$app --key=ip6_addr --value=""
|
|
|
+ ynh_app_setting_set --key=ip6_addr --value=""
|
|
|
fi
|
|
|
if [ -z "${ip6_net:-}" ]; then
|
|
|
- ynh_app_setting_set --app=$app --key=ip6_net --value=""
|
|
|
+ ynh_app_setting_set --key=ip6_net --value=""
|
|
|
fi
|
|
|
|
|
|
#=================================================
|
|
@@ -60,16 +61,16 @@ fi
|
|
|
#=================================================
|
|
|
|
|
|
if [ -e "/etc/systemd/system/openvpn@.service" ]; then
|
|
|
- ynh_secure_remove "/etc/systemd/system/openvpn@.service"
|
|
|
+ ynh_safe_rm "/etc/systemd/system/openvpn@.service"
|
|
|
fi
|
|
|
|
|
|
#=================================================
|
|
|
# DEPLOY FILES FROM PACKAGE
|
|
|
#=================================================
|
|
|
|
|
|
-ynh_print_info --message="Stopping VPN client to apply config changes..."
|
|
|
+ynh_print_info "Stopping VPN client to apply config changes..."
|
|
|
|
|
|
-ynh_systemd_action --action="stop" --service_name="$service_checker_name.timer"
|
|
|
+ynh_systemctl --action="stop" --service="$service_checker_name.timer"
|
|
|
yunohost service stop $service_name
|
|
|
|
|
|
# Keep a copy of existing config files before overwriting them
|
|
@@ -97,7 +98,7 @@ fi
|
|
|
|
|
|
# Restore previously existing config files
|
|
|
cp -r ${tmp_dir}/client* /etc/openvpn/
|
|
|
-ynh_secure_remove ${tmp_dir}
|
|
|
+ynh_safe_rm ${tmp_dir}
|
|
|
|
|
|
#=================================================
|
|
|
# SERVICE INTEGRATION IN YUNOHOST
|
|
@@ -110,7 +111,7 @@ ynh_print_info "Configuring VPN client services..."
|
|
|
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"
|
|
|
|
|
|
# checker service (this service was previously integrated in yunohost but we do not do this anymore)
|
|
|
-if ynh_exec_warn_less yunohost service status $service_checker_name >/dev/null
|
|
|
+if ynh_hide_warnings yunohost service status $service_checker_name >/dev/null
|
|
|
then
|
|
|
yunohost service remove $service_checker_name
|
|
|
fi
|
|
@@ -122,7 +123,7 @@ ynh_print_info "Restart services..."
|
|
|
|
|
|
# this is meant to propagate the new files and configs
|
|
|
yunohost service start $service_name
|
|
|
-ynh_systemd_action --action="start" --service_name="$service_checker_name.timer"
|
|
|
+ynh_systemctl --action="start" --service="$service_checker_name.timer"
|
|
|
|
|
|
#=================================================
|
|
|
# END OF SCRIPT
|