@@ -121,7 +121,9 @@ function vpnclient_deploy_files_and_services()
|
|||||||
{
|
{
|
||||||
local domain=$1
|
local domain=$1
|
||||||
local app=$2
|
local app=$2
|
||||||
|
local service_name=$3
|
||||||
local sysuser="${app}"
|
local sysuser="${app}"
|
||||||
|
local service_checker_name="$service_name-checker"
|
||||||
|
|
||||||
# Ensure vpnclient_ynh has its own system user
|
# Ensure vpnclient_ynh has its own system user
|
||||||
if ! ynh_system_user_exists ${sysuser}
|
if ! ynh_system_user_exists ${sysuser}
|
||||||
@@ -138,7 +140,7 @@ function vpnclient_deploy_files_and_services()
|
|||||||
install -o root -g root -m 0755 ../conf/ipv6_compressed /usr/local/bin/
|
install -o root -g root -m 0755 ../conf/ipv6_compressed /usr/local/bin/
|
||||||
|
|
||||||
# Install command-line cube file loader
|
# Install command-line cube file loader
|
||||||
install -o root -g root -m 0755 ../conf/ynh-vpnclient-loadcubefile.sh /usr/local/bin/
|
install -o root -g root -m 0755 ../conf/$service_name-loadcubefile.sh /usr/local/bin/
|
||||||
|
|
||||||
# Copy confs
|
# Copy confs
|
||||||
mkdir -pm 0755 /var/log/nginx/
|
mkdir -pm 0755 /var/log/nginx/
|
||||||
@@ -183,16 +185,20 @@ function vpnclient_deploy_files_and_services()
|
|||||||
ynh_replace_string "__PATH__" "${path_url}" "/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/$service_name /usr/local/bin/
|
||||||
install -o root -g root -m 0644 ../conf/ynh-vpnclient.service /etc/systemd/system/
|
|
||||||
|
|
||||||
# Copy checker timer
|
# Copy checker timer
|
||||||
install -o root -g root -m 0755 ../conf/ynh-vpnclient-checker.sh /usr/local/bin/
|
install -o root -g root -m 0755 ../conf/$service_checker_name.sh /usr/local/bin/
|
||||||
install -o root -g root -m 0644 ../conf/ynh-vpnclient-checker.service /etc/systemd/system/
|
install -o root -g root -m 0644 ../conf/$service_checker_name.timer /etc/systemd/system/
|
||||||
install -o root -g root -m 0644 ../conf/ynh-vpnclient-checker.timer /etc/systemd/system/
|
|
||||||
|
|
||||||
# Reload systemd configuration
|
#=================================================
|
||||||
systemctl daemon-reload
|
# SETUP SYSTEMD
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Configuring a systemd service..."
|
||||||
|
|
||||||
|
ynh_add_systemd_config $service_name "$service_name.service"
|
||||||
|
|
||||||
|
ynh_add_systemd_config $service_checker_name "$service_checker_name.service"
|
||||||
}
|
}
|
||||||
|
|
||||||
function service_is_managed_by_yunohost() {
|
function service_is_managed_by_yunohost() {
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC START
|
# GENERIC START
|
||||||
@@ -5,16 +6,9 @@
|
|||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
if [ ! -e _common.sh ]; then
|
source ../settings/scripts/_common.sh
|
||||||
# Get the _common.sh file if it's not in the current directory
|
|
||||||
cp ../settings/scripts/_common.sh ./_common.sh
|
|
||||||
chmod a+rx _common.sh
|
|
||||||
fi
|
|
||||||
source _common.sh
|
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
ynh_die "backup script is not implemented yet"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MANAGE SCRIPT FAILURE
|
# MANAGE SCRIPT FAILURE
|
||||||
#=================================================
|
#=================================================
|
||||||
@@ -25,54 +19,67 @@ ynh_abort_if_errors
|
|||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
db_name=$(ynh_app_setting_get $app db_name)
|
service_name=$(ynh_app_setting_get $app service_name)
|
||||||
|
service_checker_name=$service_name"-checker"
|
||||||
#=================================================
|
|
||||||
# STANDARD BACKUP STEPS
|
|
||||||
#=================================================
|
|
||||||
# BACKUP THE APP MAIN DIR
|
|
||||||
#=================================================
|
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD BACKUP STEPS
|
# STANDARD BACKUP STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE APP MAIN DIR
|
# BACKUP THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Backing up the main app directory..."
|
||||||
|
|
||||||
ynh_backup "$final_path"
|
ynh_backup "$final_path"
|
||||||
|
|
||||||
|
ynh_backup "/etc/sudoers.d/${app}_ynh"
|
||||||
|
|
||||||
|
ynh_backup "/usr/local/bin/ipv6_expanded"
|
||||||
|
ynh_backup "/usr/local/bin/ipv6_compressed"
|
||||||
|
ynh_backup "/usr/local/bin/$service_name-loadcubefile.sh"
|
||||||
|
|
||||||
|
ynh_backup "/etc/yunohost/hooks.d/90-vpnclient.tpl"
|
||||||
|
|
||||||
|
ynh_backup "/etc/openvpn/client.conf.tpl"
|
||||||
|
ynh_backup "/etc/openvpn/client.conf.tpl.restore"
|
||||||
|
ynh_backup "/etc/openvpn/keys/"
|
||||||
|
|
||||||
|
ynh_backup "/usr/local/bin/$service_name"
|
||||||
|
ynh_backup "/usr/local/bin/$service_checker_name.sh"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE NGINX CONFIGURATION
|
# BACKUP THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Backing up nginx web server configuration..."
|
||||||
|
|
||||||
ynh_backup "/etc/nginx/conf.d/$domain.d/${app}.conf"
|
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE PHP-FPM CONFIGURATION
|
# BACKUP THE PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Backing up php-fpm configuration..."
|
||||||
|
|
||||||
ynh_backup "/etc/php5/fpm/pool.d/$app.conf"
|
ynh_backup "/etc/php/7.0/fpm/pool.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC BACKUP
|
# SPECIFIC BACKUP
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP SYSTEMD
|
# BACKUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Backing up systemd configuration..."
|
||||||
|
|
||||||
ynh_backup "/etc/systemd/system/ynh-vpnclient.service"
|
ynh_backup "/etc/systemd/system/$service_name.service"
|
||||||
ynh_backup "/etc/systemd/system/ynh-vpnclient-checker.service"
|
ynh_backup "/etc/systemd/system/$service_checker_name.service"
|
||||||
ynh_backup "/etc/systemd/system/ynh-vpnclient-checker.timer"
|
ynh_backup "/etc/systemd/system/$service_checker_name.timer"
|
||||||
|
ynh_backup "/etc/systemd/system/openvpn@.service"
|
||||||
|
|
||||||
ynh_backup "/etc/cron.d/$app"
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
@@ -38,8 +38,8 @@ ynh_abort_if_errors
|
|||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
domain=$1
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
path_url=$(ynh_normalize_url_path "$2")
|
path_url=$(ynh_normalize_url_path "$YNH_APP_ARG_PATH")
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
final_path="/var/www/$app"
|
final_path="/var/www/$app"
|
||||||
|
|
||||||
@@ -64,6 +64,7 @@ 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"
|
||||||
|
ynh_app_setting_set "$app" service_name "$service_name"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
@@ -79,7 +80,7 @@ ynh_install_app_dependencies "$pkg_dependencies"
|
|||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "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}" "${service_name}"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD SERVICES
|
# RELOAD SERVICES
|
||||||
@@ -92,19 +93,17 @@ ynh_print_info "Reloading services..."
|
|||||||
systemctl disable openvpn
|
systemctl disable openvpn
|
||||||
systemctl stop openvpn
|
systemctl stop openvpn
|
||||||
|
|
||||||
systemctl enable php5-fpm
|
systemctl restart php7.0-fpm
|
||||||
systemctl restart php5-fpm
|
|
||||||
|
|
||||||
systemctl reload nginx
|
systemctl reload nginx
|
||||||
|
|
||||||
# main service
|
# main service
|
||||||
|
|
||||||
yunohost service add $service_name --description "tunnels the internet traffic through a VPN" --need_lock
|
yunohost service add $service_name --description "Tunnels the internet traffic through a VPN" --need_lock
|
||||||
yunohost service enable $service_name
|
yunohost service enable $service_name
|
||||||
|
|
||||||
# checker service
|
# checker service
|
||||||
|
|
||||||
yunohost service add $service_checker_name --description "makes sure that the VPN service is running" --need_lock
|
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 start $service_checker_name
|
||||||
yunohost service enable $service_checker_name
|
yunohost service enable $service_checker_name
|
||||||
systemctl start $service_checker_name.timer
|
systemctl start $service_checker_name.timer
|
||||||
|
@@ -33,8 +33,7 @@ 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)
|
||||||
|
service_name=$(ynh_app_setting_get $app service_name)
|
||||||
service_name="ynh-vpnclient"
|
|
||||||
service_checker_name=$service_name"-checker"
|
service_checker_name=$service_name"-checker"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
@@ -107,7 +106,7 @@ systemctl daemon-reload
|
|||||||
# Restart services
|
# Restart services
|
||||||
# (this must happen before deleting the user, otherwise the user is
|
# (this must happen before deleting the user, otherwise the user is
|
||||||
# being used by one of the php pool process)
|
# being used by one of the php pool process)
|
||||||
systemctl restart php5-fpm
|
systemctl restart php7.0-fpm
|
||||||
systemctl reload nginx
|
systemctl reload nginx
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
138
scripts/restore
138
scripts/restore
@@ -1,19 +1,14 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC START
|
||||||
#=================================================
|
#=================================================
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
if [ ! -e _common.sh ]; then
|
source ../settings/scripts/_common.sh
|
||||||
# Fetch helpers file if not in current directory
|
|
||||||
cp ../settings/scripts/_common.sh ./_common.sh
|
|
||||||
chmod a+rx _common.sh
|
|
||||||
fi
|
|
||||||
source _common.sh
|
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
ynh_die "restore script is not implemented yet"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MANAGE SCRIPT FAILURE
|
# MANAGE SCRIPT FAILURE
|
||||||
#=================================================
|
#=================================================
|
||||||
@@ -21,23 +16,122 @@ ynh_die "restore script is not implemented yet"
|
|||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
#sysuser="${app}"
|
#=================================================
|
||||||
sysuser="vpnclient" # XXX hard-coded variable
|
# LOAD SETTINGS
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Loading settings..."
|
||||||
|
|
||||||
backup_dir="${1}/apps/vpnclient"
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
mkdir -p /etc/openvpn/
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
cp -a "${backup_dir}/keys/" /etc/openvpn/
|
path_url=$(ynh_app_setting_get $app path)
|
||||||
cp -a "${backup_dir}/client.conf.tpl" /etc/openvpn/
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
chown -R root:${sysuser} /etc/openvpn/keys/
|
service_name=$(ynh_app_setting_get $app service_name)
|
||||||
|
service_checker_name=$service_name"-checker"
|
||||||
|
|
||||||
gitcommit=$(grep revision /etc/yunohost/apps/vpnclient/status.json | sed 's/.*"revision": "\([^"]\+\)".*/\1/')
|
#=================================================
|
||||||
tmpdir=$(mktemp -dp /tmp/ vpnclient-restore-XXXXX)
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Validating restoration parameters..."
|
||||||
|
|
||||||
git clone https://github.com/labriqueinternet/vpnclient_ynh.git "${tmpdir}/"
|
ynh_webpath_available $domain $path_url \
|
||||||
git --work-tree "${tmpdir}/" --git-dir "${tmpdir}/.git/" reset --hard "${gitcommit}"
|
|| ynh_die "Path not available: ${domain}${path_url}"
|
||||||
|
test ! -d $final_path \
|
||||||
|
|| ynh_die "There is already a directory: $final_path "
|
||||||
|
|
||||||
cd "${tmpdir}/scripts/"
|
#=================================================
|
||||||
bash ./upgrade
|
# STANDARD RESTORATION STEPS
|
||||||
|
#=================================================
|
||||||
|
# RESTORE THE NGINX CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
rm -r "${tmpdir}/"
|
ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE THE APP MAIN DIR
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Restoring the app main directory..."
|
||||||
|
|
||||||
|
ynh_restore_file "$final_path"
|
||||||
|
|
||||||
|
ynh_restore_file "/etc/sudoers.d/${app}_ynh"
|
||||||
|
|
||||||
|
ynh_restore_file "/usr/local/bin/ipv6_expanded"
|
||||||
|
ynh_restore_file "/usr/local/bin/ipv6_compressed"
|
||||||
|
ynh_restore_file "/usr/local/bin/$service_name-loadcubefile.sh"
|
||||||
|
|
||||||
|
ynh_restore_file "/etc/yunohost/hooks.d/90-vpnclient.tpl"
|
||||||
|
|
||||||
|
ynh_restore_file "/etc/openvpn/client.conf.tpl"
|
||||||
|
ynh_restore_file "/etc/openvpn/client.conf.tpl.restore"
|
||||||
|
ynh_restore_file "/etc/openvpn/keys/"
|
||||||
|
|
||||||
|
ynh_restore_file "/usr/local/bin/$service_name"
|
||||||
|
ynh_restore_file "/usr/local/bin/$service_checker_name.sh"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RECREATE THE DEDICATED USER
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Recreating the dedicated system user..."
|
||||||
|
|
||||||
|
# Create the dedicated user (if not existing)
|
||||||
|
ynh_system_user_create $app
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE USER RIGHTS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Restore permissions on app files
|
||||||
|
chown -R $app: $final_path
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE THE PHP-FPM CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_restore_file "/etc/php/7.0/fpm/pool.d/$app.conf"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC RESTORATION
|
||||||
|
#=================================================
|
||||||
|
# REINSTALL DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Reinstalling dependencies..."
|
||||||
|
|
||||||
|
# Define and install dependencies
|
||||||
|
ynh_install_app_dependencies "$pkg_dependencies"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE SYSTEMD
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Restoring the systemd configuration..."
|
||||||
|
|
||||||
|
ynh_restore_file "/etc/systemd/system/$service_name.service"
|
||||||
|
ynh_restore_file "/etc/systemd/system/$service_checker_name.service"
|
||||||
|
ynh_restore_file "/etc/systemd/system/$service_checker_name.timer"
|
||||||
|
ynh_restore_file "/etc/systemd/system/openvpn@.service"
|
||||||
|
systemctl enable "$service_name.service"
|
||||||
|
systemctl enable "$service_checker_name.service"
|
||||||
|
systemctl enable "openvpn@.service"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
yunohost service add $service_name --description "Tunnels the internet traffic through a VPN" --need_lock
|
||||||
|
yunohost service add $service_checker_name --description "Makes sure that the VPN service is running" --need_lock
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC FINALIZATION
|
||||||
|
#=================================================
|
||||||
|
# RELOAD NGINX AND PHP-FPM
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Reloading nginx web server and php-fpm..."
|
||||||
|
|
||||||
|
systemctl restart php7.0-fpm
|
||||||
|
systemctl reload nginx
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_print_info "Restoration completed for $app"
|
||||||
|
@@ -21,27 +21,33 @@ path_url=$(ynh_app_setting_get $app path)
|
|||||||
is_public=$(ynh_app_setting_get $app is_public)
|
is_public=$(ynh_app_setting_get $app is_public)
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
server_name=$(ynh_app_setting_get $app server_name)
|
server_name=$(ynh_app_setting_get $app server_name)
|
||||||
|
service_name=$(ynh_app_setting_get $app service_name)
|
||||||
service_name="ynh-vpnclient"
|
|
||||||
service_checker_name=$service_name"-checker"
|
service_checker_name=$service_name"-checker"
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIAL UPGRADE FOR VERSIONS < 1.2.0
|
# SPECIAL UPGRADE FOR VERSIONS < 1.2.0
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Apply renaming that occured in v1.2.0 ("vpnadmin" -> "${app}")
|
# Apply renaming that occured in v1.2.0 ("vpnadmin" -> "${app}")
|
||||||
if [ -f /etc/nginx/conf.d/${domain}.d/vpnadmin.conf ]; then
|
if [ -f /etc/nginx/conf.d/${domain}.d/vpnadmin.conf ]; then
|
||||||
sed "s|/var/www/vpnadmin/|/var/www/${app}/|g" -i "/etc/nginx/conf.d/${domain}.d/vpnadmin.conf"
|
ynh_replace_string "/var/www/vpnadmin/" "/var/www/${app}/" "/etc/nginx/conf.d/${domain}.d/vpnadmin.conf"
|
||||||
sed "s|vpnadmin.sock|${app}.sock|g" -i "/etc/nginx/conf.d/${domain}.d/vpnadmin.conf"
|
ynh_replace_string "vpnadmin.sock" "${app}.sock" "/etc/nginx/conf.d/${domain}.d/vpnadmin.conf"
|
||||||
mv /etc/nginx/conf.d/${domain}.d/vpnadmin.conf /etc/nginx/conf.d/${domain}.d/${app}.conf
|
mv /etc/nginx/conf.d/${domain}.d/vpnadmin.conf /etc/nginx/conf.d/${domain}.d/${app}.conf
|
||||||
fi
|
fi
|
||||||
if [ -f /etc/php5/fpm/pool.d/vpnadmin.conf ]; then
|
if [ -f /etc/php5/fpm/pool.d/vpnadmin.conf ]; then
|
||||||
sed "s|/var/www/vpnadmin/|/var/www/${app}/|g" -i /etc/php5/fpm/pool.d/vpnadmin.conf
|
ynh_replace_string "/var/www/vpnadmin/" "/var/www/${app}/" /etc/php/7.0/fpm/pool.d/vpnadmin.conf
|
||||||
sed "s|vpnadmin.sock|${app}.sock|g" -i /etc/php5/fpm/pool.d/vpnadmin.conf
|
ynh_replace_string "vpnadmin.sock" "${app}.sock" /etc/php/7.0/fpm/pool.d/vpnadmin.conf
|
||||||
mv /etc/php5/fpm/pool.d/vpnadmin.conf /etc/php5/fpm/pool.d/${app}.conf
|
mv /etc/php5/fpm/pool.d/vpnadmin.conf /etc/php/7.0/fpm/pool.d/${app}.conf
|
||||||
fi
|
fi
|
||||||
test -d /var/www/vpnadmin && mv /var/www/vpnadmin /var/www/${app}
|
test -d /var/www/vpnadmin && mv /var/www/vpnadmin /var/www/${app}
|
||||||
|
|
||||||
|
if [ -z $service_name ]; then
|
||||||
|
service_name="ynh-vpnclient"
|
||||||
|
service_checker_name=$service_name"-checker"
|
||||||
|
ynh_app_setting_set "$app" service_name "$service_name"
|
||||||
|
fi
|
||||||
|
|
||||||
## Versions known to have a buggy backup script
|
## Versions known to have a buggy backup script
|
||||||
#buggy_versions="1.0.0 1.0.1 1.1.0"
|
#buggy_versions="1.0.0 1.0.1 1.1.0"
|
||||||
#curr_version=$(read_manifest version)
|
#curr_version=$(read_manifest version)
|
||||||
@@ -78,7 +84,7 @@ tmpdir=$(mktemp -d /tmp/vpnclient-upgrade-XXX)
|
|||||||
cp -r /etc/openvpn/client* ${tmpdir}
|
cp -r /etc/openvpn/client* ${tmpdir}
|
||||||
|
|
||||||
# Deploy files from package
|
# Deploy files from package
|
||||||
vpnclient_deploy_files_and_services "${domain}" "${app}"
|
vpnclient_deploy_files_and_services "${domain}" "${app}" "${service_name}"
|
||||||
|
|
||||||
# Restore previously existing config files
|
# Restore previously existing config files
|
||||||
cp -r ${tmpdir}/client* /etc/openvpn/
|
cp -r ${tmpdir}/client* /etc/openvpn/
|
||||||
@@ -100,7 +106,7 @@ if service_is_managed_by_yunohost $service_name
|
|||||||
then
|
then
|
||||||
yunohost service remove $service_name
|
yunohost service remove $service_name
|
||||||
fi
|
fi
|
||||||
yunohost service add $service_name --description "tunnels the internet traffic through a VPN" --need_lock
|
yunohost service add $service_name --description "Tunnels the internet traffic through a VPN" --need_lock
|
||||||
|
|
||||||
# checker service
|
# checker service
|
||||||
|
|
||||||
@@ -108,7 +114,7 @@ if service_is_managed_by_yunohost $service_checker_name
|
|||||||
then
|
then
|
||||||
yunohost service remove $service_checker_name
|
yunohost service remove $service_checker_name
|
||||||
fi
|
fi
|
||||||
yunohost service add $service_checker_name --description "makes sure that the VPN service is running" --need_lock
|
yunohost service add $service_checker_name --description "Makes sure that the VPN service is running" --need_lock
|
||||||
|
|
||||||
# Reload systemd configuration
|
# Reload systemd configuration
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user