[mod] install and upgrade scripts share some common code.
This commit is contained in:
@@ -54,6 +54,29 @@ ynh_clean_setup () {
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# DO UPGRADE
|
||||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
|
||||
ynh_install_app_dependencies "$pkg_dependencies"
|
||||
|
||||
#=================================================
|
||||
# DEPLOY FILES FROM PACKAGE
|
||||
#=================================================
|
||||
|
||||
# Keep a copy of existing config files before overwriting them
|
||||
tmpdir=$(mktemp -d /tmp/vpnclient-upgrade-XXX)
|
||||
sudo cp -r /etc/openvpn/client* ${tmpdir}
|
||||
|
||||
# Deploy files from package
|
||||
vpnclient_deploy_files_and_services
|
||||
|
||||
# Restore previously existing config files
|
||||
sudo cp -r ${tmpdir}/client* /etc/openvpn/
|
||||
sudo rm -rf ${tmpdir}
|
||||
|
||||
#=================================================
|
||||
# RELOAD RELEVANT SERVICES
|
||||
#=================================================
|
||||
@@ -61,4 +84,6 @@ ynh_abort_if_errors
|
||||
ynh_systemctl reload php5-fpm
|
||||
ynh_systemctl reload nginx
|
||||
|
||||
ynh_systemctl restart ynh-vpnclient
|
||||
|
||||
exit 0
|
||||
|
Reference in New Issue
Block a user