|
|
|
@ -13,13 +13,21 @@ if isfile(makepath(programfiles32,'wapt','private','symetric.txt')) and isfile(m |
|
|
|
|
variables.update(yaml.safe_load(f.decrypt(open(makepath(programfiles32,'wapt','private','variables.txt'),'r').read()))) |
|
|
|
|
|
|
|
|
|
def install(): |
|
|
|
|
import re |
|
|
|
|
|
|
|
|
|
version = control['version'].split('-',1)[0] |
|
|
|
|
|
|
|
|
|
print('Register OpenVPN as a trusted publisher') |
|
|
|
|
run(r'certutil.exe -addstore trustedpublisher openvpn.p7b') |
|
|
|
|
run(r'certutil.exe -f -addstore trustedpublisher openvpn.p7b') |
|
|
|
|
|
|
|
|
|
print('Installing OpenVPN client') |
|
|
|
|
install_exe_if_needed('openvpn-install-%s-I603.exe' % version,'/S',key='OpenVPN',min_version='%s-I602' % version,killbefore=['openvpn','openvpn-gui']) |
|
|
|
|
|
|
|
|
|
os_version = 'Win10' |
|
|
|
|
|
|
|
|
|
# We need to identify the build |
|
|
|
|
for file in glob.glob('openvpn-install-%s-I*-%s.exe' % (version, os_version)): |
|
|
|
|
build = re.search('openvpn\-install\-%s\-(I\d+)\-%s\.exe' % (version, os_version), file).group(1) |
|
|
|
|
install_exe_if_needed('openvpn-install-%s-%s-%s.exe' % (version, build, os_version), '/S', key='OpenVPN', min_version='%s-%s-%s' % (version, build, os_version), killbefore=['openvpn','openvpn-gui']) |
|
|
|
|
uninstallkey.append('TAP-Windows') |
|
|
|
|
|
|
|
|
|
if 'openvpn_config' in variables: |
|
|
|
@ -37,15 +45,21 @@ def update_package(): |
|
|
|
|
current_version = control['version'].split('-',1)[0] |
|
|
|
|
if Version(latest_version) > Version(current_version): |
|
|
|
|
print('Updating Package from %s to %s' % (current_version, latest_version)) |
|
|
|
|
if not isfile('openvpn-install-%s-I603.exe' % latest_version): |
|
|
|
|
url = 'https://swupdate.openvpn.org/community/releases/openvpn-install-%s-I603.exe' % latest_version |
|
|
|
|
# Win7 Would be possible, but has a problem installing the tap driver, even when the cert is added to the trust store |
|
|
|
|
# Just maintain the package for Win10 and later. Win7 is EOL in 2020 anyway |
|
|
|
|
for os_version in ['Win10']: |
|
|
|
|
build = re.search('openvpn\-install\-%s\-(I\d+)\-%s\.exe' % (latest_version, os_version), page).group(1) |
|
|
|
|
if not isfile('openvpn\-install-%s-%s.exe' % (latest_version, build)): |
|
|
|
|
url = 'https://swupdate.openvpn.org/community/releases/openvpn-install-%s-%s-%s.exe' % (latest_version, build, os_version) |
|
|
|
|
print('downloading %s' % url) |
|
|
|
|
wget(url, os.getcwd()) |
|
|
|
|
for file in glob.glob('*.exe'): |
|
|
|
|
if file != 'openvpn-install-%s-I603.exe' % latest_version: |
|
|
|
|
for file in glob.glob('*%s.exe' % os_version): |
|
|
|
|
if file != 'openvpn-install-%s-%s-%s.exe' % (latest_version, build, os_version): |
|
|
|
|
print('Removing %s' % file) |
|
|
|
|
remove_file(file) |
|
|
|
|
|
|
|
|
|
pe.version = latest_version + '-0' |
|
|
|
|
pe.maturity = 'PREPROD' |
|
|
|
|
pe.save_control_to_wapt(os.getcwd()) |
|
|
|
|
print('Package updated to %s' % latest_version) |
|
|
|
|
else: |
|
|
|
|