From dfc34277832af026453dac3c88aa2f5102d5964b Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Thu, 30 Apr 2015 10:24:27 -0300 Subject: On 2.3+, openvpn-client-export tarball files will be already present on system, it's not necessary to uncompress tarball anymore --- .../openvpn-client-export/openvpn-client-export.inc | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'config/openvpn-client-export') diff --git a/config/openvpn-client-export/openvpn-client-export.inc b/config/openvpn-client-export/openvpn-client-export.inc index 1e76c743..9488119e 100755 --- a/config/openvpn-client-export/openvpn-client-export.inc +++ b/config/openvpn-client-export/openvpn-client-export.inc @@ -44,16 +44,20 @@ $current_openvpn_version_rev = "03"; function openvpn_client_export_install() { global $current_openvpn_version; - conf_mount_rw(); - $tarpath = "/usr/local/pkg/openvpn-client-export-{$current_openvpn_version}.tgz"; - $ovpndir = "/usr/local/share/openvpn"; - $workdir = "{$ovpndir}/client-export"; - if (!is_dir($workdir)) - mkdir($workdir, 0777, true); + $pfs_version = substr(trim(file_get_contents("/etc/version")),0,3); + if ($pfs_version == "2.1" || $pfs_version == "2.2") { + conf_mount_rw(); + $tarpath = "/usr/local/pkg/openvpn-client-export-{$current_openvpn_version}.tgz"; + $ovpndir = "/usr/local/share/openvpn"; + $workdir = "{$ovpndir}/client-export"; - exec("/usr/bin/tar zxf {$tarpath} -C {$ovpndir}"); - conf_mount_ro(); + if (!is_dir($workdir)) + mkdir($workdir, 0777, true); + + exec("/usr/bin/tar zxf {$tarpath} -C {$ovpndir}"); + conf_mount_ro(); + } } function openvpn_client_export_deinstall() { -- cgit v1.2.3