updating script to new standards
This commit is contained in:
@@ -1,34 +1,40 @@
|
|||||||
# VPN Client app for YunoHost
|
# VPN Client app for YunoHost
|
||||||
# Copyright (C) 2015 Julien Vaubourg <julien@vaubourg.com>
|
# Copyright (C) 2015 Julien Vaubourg <julien@vaubourg.com>
|
||||||
# Contribute at https://github.com/labriqueinternet/vpnclient_ynh
|
# Contribute at https://github.com/labriqueinternet/vpnclient_ynh
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU Affero General Public License as published by
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU Affero General Public License for more details.
|
# GNU Affero General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
location <TPL:NGINX_LOCATION> {
|
location __PATH__ {
|
||||||
alias <TPL:NGINX_REALPATH>;
|
|
||||||
|
|
||||||
|
# Path to source
|
||||||
|
alias __FINALPATH__/ ;
|
||||||
|
|
||||||
|
# Force usage of https
|
||||||
if ($scheme = http) {
|
if ($scheme = http) {
|
||||||
rewrite ^ https://$server_name$request_uri? permanent;
|
rewrite ^ https://$server_name$request_uri? permanent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Common parameter to increase upload size limit in conjunction with dedicated php-fpm file
|
||||||
client_max_body_size 10G;
|
client_max_body_size 10G;
|
||||||
|
|
||||||
index index.php;
|
index index.php;
|
||||||
|
|
||||||
try_files $uri $uri/ index.php;
|
try_files $uri $uri/ index.php;
|
||||||
|
|
||||||
location ~ [^/]\.php(/|$) {
|
location ~ [^/]\.php(/|$) {
|
||||||
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||||
fastcgi_pass unix:/var/run/php5-fpm-<TPL:PHP_NAME>.sock;
|
fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock;
|
||||||
fastcgi_index index.php;
|
fastcgi_index index.php;
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
fastcgi_read_timeout 600;
|
fastcgi_read_timeout 600;
|
||||||
@@ -37,5 +43,6 @@ location <TPL:NGINX_LOCATION> {
|
|||||||
fastcgi_param SCRIPT_FILENAME $request_filename;
|
fastcgi_param SCRIPT_FILENAME $request_filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Include SSOWAT user panel.
|
||||||
include conf.d/yunohost_panel.conf.inc;
|
include conf.d/yunohost_panel.conf.inc;
|
||||||
}
|
}
|
@@ -1,24 +1,24 @@
|
|||||||
; VPN Client app for YunoHost
|
; VPN Client app for YunoHost
|
||||||
; Copyright (C) 2015 Julien Vaubourg <julien@vaubourg.com>
|
; Copyright (C) 2015 Julien Vaubourg <julien@vaubourg.com>
|
||||||
; Contribute at https://github.com/labriqueinternet/vpnclient_ynh
|
; Contribute at https://github.com/labriqueinternet/vpnclient_ynh
|
||||||
;
|
;
|
||||||
; This program is free software: you can redistribute it and/or modify
|
; This program is free software: you can redistribute it and/or modify
|
||||||
; it under the terms of the GNU Affero General Public License as published by
|
; it under the terms of the GNU Affero General Public License as published by
|
||||||
; the Free Software Foundation, either version 3 of the License, or
|
; the Free Software Foundation, either version 3 of the License, or
|
||||||
; (at your option) any later version.
|
; (at your option) any later version.
|
||||||
;
|
;
|
||||||
; This program is distributed in the hope that it will be useful,
|
; This program is distributed in the hope that it will be useful,
|
||||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
; GNU Affero General Public License for more details.
|
; GNU Affero General Public License for more details.
|
||||||
;
|
;
|
||||||
; You should have received a copy of the GNU Affero General Public License
|
; You should have received a copy of the GNU Affero General Public License
|
||||||
; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
; Start a new pool named '<TPL:PHP_NAME>'.
|
; Start a new pool named 'www'.
|
||||||
; the variable $pool can we used in any directive and will be replaced by the
|
; the variable $pool can we used in any directive and will be replaced by the
|
||||||
; pool name ('www' here)
|
; pool name ('www' here)
|
||||||
[<TPL:PHP_NAME>]
|
[__NAMETOCHANGE__]
|
||||||
|
|
||||||
; The address on which to accept FastCGI requests.
|
; The address on which to accept FastCGI requests.
|
||||||
; Valid syntaxes are:
|
; Valid syntaxes are:
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
; specific port;
|
; specific port;
|
||||||
; '/path/to/unix/socket' - to listen on a unix socket.
|
; '/path/to/unix/socket' - to listen on a unix socket.
|
||||||
; Note: This value is mandatory.
|
; Note: This value is mandatory.
|
||||||
listen = /var/run/php5-fpm-<TPL:PHP_NAME>.sock
|
listen = /var/run/php/php7.0-fpm-__NAMETOCHANGE__.sock
|
||||||
|
|
||||||
; Set permissions for unix socket, if one is used. In Linux, read/write
|
; Set permissions for unix socket, if one is used. In Linux, read/write
|
||||||
; permissions must be set in order to allow connections from a web server. Many
|
; permissions must be set in order to allow connections from a web server. Many
|
||||||
@@ -42,8 +42,8 @@ listen.mode = 0600
|
|||||||
; Unix user/group of processes
|
; Unix user/group of processes
|
||||||
; Note: The user is mandatory. If the group is not set, the default user's group
|
; Note: The user is mandatory. If the group is not set, the default user's group
|
||||||
; will be used.
|
; will be used.
|
||||||
user = <TPL:PHP_USER>
|
user = __USER__
|
||||||
group = <TPL:PHP_GROUP>
|
group = __USER__
|
||||||
|
|
||||||
; Choose how the process manager will control the number of child processes.
|
; Choose how the process manager will control the number of child processes.
|
||||||
; Possible Values:
|
; Possible Values:
|
||||||
@@ -157,7 +157,7 @@ request_slowlog_timeout = 0
|
|||||||
; The log file for slow requests
|
; The log file for slow requests
|
||||||
; Default Value: not set
|
; Default Value: not set
|
||||||
; Note: slowlog is mandatory if request_slowlog_timeout is set
|
; Note: slowlog is mandatory if request_slowlog_timeout is set
|
||||||
slowlog = /var/log/nginx/<TPL:PHP_NAME>.slow.log
|
slowlog = /var/log/nginx/[__NAMETOCHANGE__].slow.log
|
||||||
|
|
||||||
; Set open file descriptor rlimit.
|
; Set open file descriptor rlimit.
|
||||||
; Default Value: system defined value
|
; Default Value: system defined value
|
||||||
@@ -171,7 +171,7 @@ rlimit_core = 0
|
|||||||
; Chdir to this directory at the start.
|
; Chdir to this directory at the start.
|
||||||
; Note: relative path can be used.
|
; Note: relative path can be used.
|
||||||
; Default Value: current directory or / when chroot
|
; Default Value: current directory or / when chroot
|
||||||
chdir = <TPL:NGINX_REALPATH>
|
chdir = __FINALPATH__
|
||||||
|
|
||||||
; Redirect worker stdout and stderr into main error log. If not set, stdout and
|
; Redirect worker stdout and stderr into main error log. If not set, stdout and
|
||||||
; stderr will be redirected to /dev/null according to FastCGI specs.
|
; stderr will be redirected to /dev/null according to FastCGI specs.
|
@@ -238,10 +238,10 @@ ynh_setting_set() {
|
|||||||
|
|
||||||
if [ "$1" != restart ]; then
|
if [ "$1" != restart ]; then
|
||||||
|
|
||||||
# Restart php5-fpm at the first start (it needs to be restarted after the slapd start)
|
# Restart php-fpm at the first start (it needs to be restarted after the slapd start)
|
||||||
if [ ! -e /tmp/.ynh-vpnclient-boot ]; then
|
if [ ! -e /tmp/.ynh-vpnclient-boot ]; then
|
||||||
touch /tmp/.ynh-vpnclient-boot
|
touch /tmp/.ynh-vpnclient-boot
|
||||||
systemctl restart php5-fpm
|
systemctl restart php7.0-fpm
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check configuration consistency
|
# Check configuration consistency
|
||||||
|
@@ -3,23 +3,8 @@
|
|||||||
# Common variables and helpers
|
# Common variables and helpers
|
||||||
#
|
#
|
||||||
|
|
||||||
pkg_dependencies="php5-fpm sipcalc dnsutils openvpn curl fake-hwclock"
|
pkg_dependencies="php7.0-fpm sipcalc dnsutils openvpn curl fake-hwclock"
|
||||||
|
|
||||||
log() {
|
|
||||||
echo "${1}"
|
|
||||||
}
|
|
||||||
|
|
||||||
info() {
|
|
||||||
log "[INFO] ${1}"
|
|
||||||
}
|
|
||||||
|
|
||||||
warn() {
|
|
||||||
log "[WARN] ${1}"
|
|
||||||
}
|
|
||||||
|
|
||||||
err() {
|
|
||||||
log "[ERR] ${1}"
|
|
||||||
}
|
|
||||||
to_logs() {
|
to_logs() {
|
||||||
|
|
||||||
# When yunohost --verbose or bash -x
|
# When yunohost --verbose or bash -x
|
||||||
@@ -52,7 +37,7 @@ ynh_abort_if_up_to_date () {
|
|||||||
version=$(read_json "/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" 'version' 2> /dev/null || echo '20160501-7')
|
version=$(read_json "/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" 'version' 2> /dev/null || echo '20160501-7')
|
||||||
last_version=$(read_manifest 'version')
|
last_version=$(read_manifest 'version')
|
||||||
if [ "${version}" = "${last_version}" ]; then
|
if [ "${version}" = "${last_version}" ]; then
|
||||||
info "Up-to-date, nothing to do"
|
ynh_print_info "Up-to-date, nothing to do"
|
||||||
ynh_die "" 0
|
ynh_die "" 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -63,9 +48,9 @@ ynh_abort_if_up_to_date () {
|
|||||||
# | arg: manifest - Path of the manifest to read
|
# | arg: manifest - Path of the manifest to read
|
||||||
# | arg: key - Name of the key to find
|
# | arg: key - Name of the key to find
|
||||||
ynh_read_manifest () {
|
ynh_read_manifest () {
|
||||||
manifest="$1"
|
manifest="$1"
|
||||||
key="$2"
|
key="$2"
|
||||||
python3 -c "import sys, json;print(json.load(open('$manifest', encoding='utf-8'))['$key'])"
|
python3 -c "import sys, json;print(json.load(open('$manifest', encoding='utf-8'))['$key'])"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Read the upstream version from the manifest
|
# Read the upstream version from the manifest
|
||||||
@@ -78,7 +63,7 @@ ynh_read_manifest () {
|
|||||||
ynh_app_upstream_version () {
|
ynh_app_upstream_version () {
|
||||||
manifest_path="../manifest.json"
|
manifest_path="../manifest.json"
|
||||||
if [ ! -e "$manifest_path" ]; then
|
if [ ! -e "$manifest_path" ]; then
|
||||||
manifest_path="../settings/manifest.json" # Into the restore script, the manifest is not at the same place
|
manifest_path="../settings/manifest.json" # Into the restore script, the manifest is not at the same place
|
||||||
fi
|
fi
|
||||||
version_key=$(ynh_read_manifest "$manifest_path" "version")
|
version_key=$(ynh_read_manifest "$manifest_path" "version")
|
||||||
echo "${version_key/~ynh*/}"
|
echo "${version_key/~ynh*/}"
|
||||||
@@ -94,7 +79,7 @@ ynh_app_upstream_version () {
|
|||||||
ynh_app_package_version () {
|
ynh_app_package_version () {
|
||||||
manifest_path="../manifest.json"
|
manifest_path="../manifest.json"
|
||||||
if [ ! -e "$manifest_path" ]; then
|
if [ ! -e "$manifest_path" ]; then
|
||||||
manifest_path="../settings/manifest.json" # Into the restore script, the manifest is not at the same place
|
manifest_path="../settings/manifest.json" # Into the restore script, the manifest is not at the same place
|
||||||
fi
|
fi
|
||||||
version_key=$(ynh_read_manifest "$manifest_path" "version")
|
version_key=$(ynh_read_manifest "$manifest_path" "version")
|
||||||
echo "${version_key/*~ynh/}"
|
echo "${version_key/*~ynh/}"
|
||||||
@@ -111,24 +96,24 @@ ynh_app_package_version () {
|
|||||||
#
|
#
|
||||||
# usage: ynh_abort_if_up_to_date
|
# usage: ynh_abort_if_up_to_date
|
||||||
ynh_abort_if_up_to_date () {
|
ynh_abort_if_up_to_date () {
|
||||||
local force_upgrade=${YNH_FORCE_UPGRADE:-0}
|
local force_upgrade=${YNH_FORCE_UPGRADE:-0}
|
||||||
local package_check=${PACKAGE_CHECK_EXEC:-0}
|
local package_check=${PACKAGE_CHECK_EXEC:-0}
|
||||||
|
|
||||||
local version=$(ynh_read_manifest "/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" "version" || echo 1.0)
|
local version=$(ynh_read_manifest "/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" "version" || echo 1.0)
|
||||||
local last_version=$(ynh_read_manifest "../manifest.json" "version" || echo 1.0)
|
local last_version=$(ynh_read_manifest "../manifest.json" "version" || echo 1.0)
|
||||||
if [ "$version" = "$last_version" ]
|
if [ "$version" = "$last_version" ]
|
||||||
then
|
then
|
||||||
if [ "$force_upgrade" != "0" ]
|
if [ "$force_upgrade" != "0" ]
|
||||||
then
|
then
|
||||||
echo "Upgrade forced by YNH_FORCE_UPGRADE." >&2
|
echo "Upgrade forced by YNH_FORCE_UPGRADE." >&2
|
||||||
unset YNH_FORCE_UPGRADE
|
unset YNH_FORCE_UPGRADE
|
||||||
elif [ "$package_check" != "0" ]
|
elif [ "$package_check" != "0" ]
|
||||||
then
|
then
|
||||||
echo "Upgrade forced for package check." >&2
|
echo "Upgrade forced for package check." >&2
|
||||||
else
|
else
|
||||||
ynh_die "Up-to-date, nothing to do" 0
|
ynh_die "Up-to-date, nothing to do" 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Operations needed by both 'install' and 'upgrade' scripts
|
# Operations needed by both 'install' and 'upgrade' scripts
|
||||||
@@ -163,8 +148,6 @@ function vpnclient_deploy_files_and_services()
|
|||||||
|
|
||||||
install -b -o root -g ${sysuser} -m 0664 ../conf/openvpn_client.conf.tpl /etc/openvpn/client.conf.tpl
|
install -b -o root -g ${sysuser} -m 0664 ../conf/openvpn_client.conf.tpl /etc/openvpn/client.conf.tpl
|
||||||
install -o root -g root -m 0644 ../conf/openvpn_client.conf.tpl /etc/openvpn/client.conf.tpl.restore
|
install -o root -g root -m 0644 ../conf/openvpn_client.conf.tpl /etc/openvpn/client.conf.tpl.restore
|
||||||
install -b -o root -g root -m 0644 ../conf/nginx_vpnadmin.conf "/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
|
||||||
install -b -o root -g root -m 0644 ../conf/phpfpm_vpnadmin.conf /etc/php5/fpm/pool.d/${app}.conf
|
|
||||||
install -b -o root -g root -m 0755 ../conf/hook_post-iptable-rules /etc/yunohost/hooks.d/90-vpnclient.tpl
|
install -b -o root -g root -m 0755 ../conf/hook_post-iptable-rules /etc/yunohost/hooks.d/90-vpnclient.tpl
|
||||||
install -b -o root -g root -m 0644 ../conf/openvpn@.service /etc/systemd/system/
|
install -b -o root -g root -m 0644 ../conf/openvpn@.service /etc/systemd/system/
|
||||||
|
|
||||||
@@ -183,22 +166,21 @@ function vpnclient_deploy_files_and_services()
|
|||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Configuring nginx web server..."
|
||||||
|
|
||||||
sed "s|<TPL:NGINX_LOCATION>|${path_url}|g" -i "/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
ynh_add_nginx_config
|
||||||
sed "s|<TPL:NGINX_REALPATH>|/var/www/${app}/|g" -i "/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
|
||||||
sed "s|<TPL:PHP_NAME>|${app}|g" -i "/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PHP-FPM CONFIGURATION
|
# PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Configuring php-fpm..."
|
||||||
|
|
||||||
sed "s|<TPL:PHP_NAME>|${app}|g" -i /etc/php5/fpm/pool.d/${app}.conf
|
ynh_add_fpm_config
|
||||||
sed "s|<TPL:PHP_USER>|${sysuser}|g" -i /etc/php5/fpm/pool.d/${app}.conf
|
|
||||||
sed "s|<TPL:PHP_GROUP>|${sysuser}|g" -i /etc/php5/fpm/pool.d/${app}.conf
|
#=================================================
|
||||||
sed "s|<TPL:NGINX_REALPATH>|/var/www/${app}/|g" -i /etc/php5/fpm/pool.d/${app}.conf
|
|
||||||
|
|
||||||
# Fix sources
|
# Fix sources
|
||||||
sed "s|<TPL:NGINX_LOCATION>|${path_url}|g" -i /var/www/${app}/config.php
|
ynh_replace_string "__PATH__" "${path_url}" "/var/www/${app}/config.php"
|
||||||
|
|
||||||
# Copy init script
|
# Copy init script
|
||||||
install -o root -g root -m 0755 ../conf/ynh-vpnclient /usr/local/bin/
|
install -o root -g root -m 0755 ../conf/ynh-vpnclient /usr/local/bin/
|
||||||
|
@@ -49,6 +49,7 @@ service_checker_name=$service_name"-checker"
|
|||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Validating installation parameters..."
|
||||||
|
|
||||||
# Check destination directory
|
# Check destination directory
|
||||||
test ! -e "$final_path" || ynh_die "Path is already in use: ${final_path}."
|
test ! -e "$final_path" || ynh_die "Path is already in use: ${final_path}."
|
||||||
@@ -59,6 +60,7 @@ ynh_webpath_register "$app" "$domain" "$path_url"
|
|||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Storing installation settings..."
|
||||||
|
|
||||||
ynh_app_setting_set "$app" domain "$domain"
|
ynh_app_setting_set "$app" domain "$domain"
|
||||||
ynh_app_setting_set "$app" final_path "$final_path"
|
ynh_app_setting_set "$app" final_path "$final_path"
|
||||||
@@ -68,15 +70,21 @@ ynh_app_setting_set "$app" final_path "$final_path"
|
|||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Installing dependencies..."
|
||||||
|
|
||||||
ynh_install_app_dependencies "$pkg_dependencies"
|
ynh_install_app_dependencies "$pkg_dependencies"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DEPLOY FILES FROM PACKAGE
|
# DEPLOY FILES FROM PACKAGE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Deploy files from package..."
|
||||||
|
|
||||||
vpnclient_deploy_files_and_services "${domain}" "${app}"
|
vpnclient_deploy_files_and_services "${domain}" "${app}"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RELOAD SERVICES
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Reloading services..."
|
||||||
|
|
||||||
# Set default inits
|
# Set default inits
|
||||||
# The boot order of these services are important, so they are disabled by default
|
# The boot order of these services are important, so they are disabled by default
|
||||||
@@ -102,4 +110,8 @@ yunohost service enable $service_checker_name
|
|||||||
systemctl start $service_checker_name.timer
|
systemctl start $service_checker_name.timer
|
||||||
systemctl enable $service_checker_name.timer
|
systemctl enable $service_checker_name.timer
|
||||||
|
|
||||||
yunohost app ssowatconf
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_print_info "Installation of $app completed"
|
||||||
|
@@ -29,6 +29,7 @@ source /usr/share/yunohost/helpers
|
|||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
@@ -37,8 +38,9 @@ service_name="ynh-vpnclient"
|
|||||||
service_checker_name=$service_name"-checker"
|
service_checker_name=$service_name"-checker"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
# STOP AND REMOVE SERVICES
|
||||||
# Stop and remove yunohost services
|
#=================================================
|
||||||
|
ynh_print_info "Stopping and removing services"
|
||||||
|
|
||||||
yunohost service stop $service_checker_name
|
yunohost service stop $service_checker_name
|
||||||
yunohost service disable $service_checker_name
|
yunohost service disable $service_checker_name
|
||||||
@@ -55,19 +57,45 @@ do
|
|||||||
ynh_secure_remove "$FILE"
|
ynh_secure_remove "$FILE"
|
||||||
done
|
done
|
||||||
|
|
||||||
# Remove confs
|
#=================================================
|
||||||
|
# REMOVE NGINX CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Removing nginx web server configuration"
|
||||||
|
|
||||||
|
# Remove the dedicated nginx config
|
||||||
|
ynh_remove_nginx_config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# REMOVE PHP-FPM CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Removing php-fpm configuration"
|
||||||
|
|
||||||
|
# Remove the dedicated php-fpm config
|
||||||
|
ynh_remove_fpm_config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC REMOVE
|
||||||
|
#================================================
|
||||||
|
ynh_print_info "Removing openvpn configuration"
|
||||||
|
|
||||||
|
# Remove openvpn configurations
|
||||||
ynh_secure_remove /etc/openvpn/client.conf
|
ynh_secure_remove /etc/openvpn/client.conf
|
||||||
ynh_secure_remove /etc/openvpn/client.conf.tpl
|
ynh_secure_remove /etc/openvpn/client.conf.tpl
|
||||||
ynh_secure_remove /etc/openvpn/client.conf.tpl.restore
|
ynh_secure_remove /etc/openvpn/client.conf.tpl.restore
|
||||||
ynh_secure_remove /etc/nginx/conf.d/${domain}.d/${app}.conf
|
|
||||||
ynh_secure_remove /etc/php5/fpm/pool.d/${app}.conf
|
# Remove YunoHost hook
|
||||||
ynh_secure_remove /etc/yunohost/hooks.d/90-vpnclient.tpl
|
ynh_secure_remove /etc/yunohost/hooks.d/90-vpnclient.tpl
|
||||||
|
|
||||||
|
# Remove openvpn service
|
||||||
ynh_secure_remove /etc/systemd/system/openvpn@.service
|
ynh_secure_remove /etc/systemd/system/openvpn@.service
|
||||||
|
|
||||||
# Remove certificates
|
# Remove openvpn certificates
|
||||||
ynh_secure_remove /etc/openvpn/keys
|
ynh_secure_remove /etc/openvpn/keys
|
||||||
|
|
||||||
# Remove packages
|
#=================================================
|
||||||
|
# REMOVE DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Removing dependencies"
|
||||||
ynh_remove_app_dependencies
|
ynh_remove_app_dependencies
|
||||||
|
|
||||||
# Remove sources
|
# Remove sources
|
||||||
@@ -82,6 +110,18 @@ systemctl daemon-reload
|
|||||||
systemctl restart php5-fpm
|
systemctl restart php5-fpm
|
||||||
systemctl reload nginx
|
systemctl reload nginx
|
||||||
|
|
||||||
# Removed system user
|
#=================================================
|
||||||
|
# REMOVE DEDICATED USER
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_print_info "Removing the dedicated system user"
|
||||||
|
|
||||||
|
# Delete a system user
|
||||||
ynh_system_user_delete ${app}
|
ynh_system_user_delete ${app}
|
||||||
ynh_secure_remove "/etc/sudoers.d/${app}_ynh"
|
ynh_secure_remove "/etc/sudoers.d/${app}_ynh"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_print_info "Removal of $app completed"
|
||||||
|
@@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers
|
|||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
@@ -64,6 +65,7 @@ ynh_abort_if_errors
|
|||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Installing dependencies..."
|
||||||
|
|
||||||
ynh_install_app_dependencies "$pkg_dependencies"
|
ynh_install_app_dependencies "$pkg_dependencies"
|
||||||
|
|
||||||
@@ -85,8 +87,9 @@ ynh_secure_remove ${tmpdir}
|
|||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD RELEVANT SERVICES
|
# RELOAD RELEVANT SERVICES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Reload services..."
|
||||||
|
|
||||||
systemctl reload php5-fpm
|
systemctl reload php7.0-fpm
|
||||||
systemctl reload nginx
|
systemctl reload nginx
|
||||||
|
|
||||||
### Make sure that the yunohost services have a description and need-lock enabled
|
### Make sure that the yunohost services have a description and need-lock enabled
|
||||||
@@ -133,3 +136,9 @@ if systemctl is-active $service_name.timer >/dev/null;
|
|||||||
then
|
then
|
||||||
yunohost service restart $service_checker_name.timer
|
yunohost service restart $service_checker_name.timer
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_print_info "Upgrade of $app completed"
|
||||||
|
@@ -1,19 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/* VPN Client app for YunoHost
|
/* VPN Client app for YunoHost
|
||||||
* Copyright (C) 2015 Julien Vaubourg <julien@vaubourg.com>
|
* Copyright (C) 2015 Julien Vaubourg <julien@vaubourg.com>
|
||||||
* Contribute at https://github.com/labriqueinternet/vpnclient_ynh
|
* Contribute at https://github.com/labriqueinternet/vpnclient_ynh
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
@@ -22,11 +22,11 @@
|
|||||||
function configure() {
|
function configure() {
|
||||||
option('env', ENV_PRODUCTION);
|
option('env', ENV_PRODUCTION);
|
||||||
option('debug', false);
|
option('debug', false);
|
||||||
option('base_uri', '<TPL:NGINX_LOCATION>/');
|
option('base_uri', '__PATH__/');
|
||||||
|
|
||||||
layout('layout.html.php');
|
layout('layout.html.php');
|
||||||
|
|
||||||
define('PUBLIC_DIR', '<TPL:NGINX_LOCATION>/public');
|
define('PUBLIC_DIR', '__PATH__/public');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Before routing
|
// Before routing
|
||||||
|
Reference in New Issue
Block a user