# -*- coding: utf-8 -*-
from setuphelpers import *
# registry key(s) where WAPT will find how to remove the application(s)
uninstallkey = []
# list of required parameters names (string) which can be used during install
required_params = []
# Declaring specific app values (TO CHANGE)
bin_name = 'Windows6.1-KB958830-x86-RefreshPkg.msu'
url_dl = 'https://download.microsoft.com/download/E/D/A/EDA6E3AE-31B9-449D-9E81-4E55F0881707/Windows6.1-KB958830-x86-RefreshPkg.msu'
def install():
# if you want to modify the keys depending on environment (win32/win64... params..)
with disable_file_system_redirection(),EnsureWUAUServRunning():
try:
run(r'wusa.exe "%s" /quiet /norestart' % bin_name)
except CalledProcessError,e:
if e.returncode == 2359302:
pass
print('Activation des features')
print ('AD')
features = [
'RemoteServerAdministrationTools',
'RemoteServerAdministrationTools-Roles',
'RemoteServerAdministrationTools-Roles-AD',
]
run(r'dism.exe /online /enable-feature %s' % " ".join(['/featurename:%s' % f for f in features]))
print ('AD-DS')
features = [
'RemoteServerAdministrationTools-Roles-AD-DS']
run(r'dism.exe /online /enable-feature %s' % " ".join(['/featurename:%s' % f for f in features]))
print ('AD-DS-Snapins')
features = [
'RemoteServerAdministrationTools-Roles-AD-DS-SnapIns']
run(r'dism.exe /online /enable-feature %s' % " ".join(['/featurename:%s' % f for f in features]))
print ('DNS')
features = [
'RemoteServerAdministrationTools-Roles-DNS',
]
run(r'dism.exe /online /enable-feature %s' % " ".join(['/featurename:%s' % f for f in features]))
print ('GP')
features = [
'RemoteServerAdministrationTools-Features',
'RemoteServerAdministrationTools-Features-GP',
]
run(r'dism.exe /online /enable-feature %s' % " ".join(['/featurename:%s' % f for f in features]))
def uninstall():
with EnsureWUAUServRunning():
run('wusa.exe /uninstall /kb:958830 /quiet /norestart')
def update_package():
print('Download/Update package content from upstream binary sources')
# Getting proxy informations from WAPT settings
proxy = {}
if isfile(makepath(application_data(),'waptconsole','waptconsole.ini')):
proxywapt = inifile_readstring(makepath(user_local_appdata(),'waptconsole','waptconsole.ini'),'global','http_proxy')
if proxywapt :
proxy = {'http':proxywapt,'https':proxywapt}
print('Download url is: ' + url_dl)
# Downloading latest binaries
if not isfile(bin_name):
print('Downloading: ' + bin_name)
wget(url_dl,bin_name,proxies=proxy)
print('Update package done. You can now build-upload your package')
else:
print('This package is already up-to-date')
if __name__ == '__main__':
update_package()