Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*
- # uninstall key retrieved from msi properties with 'ProductCode' key. See below
- #ActiveX https://fpdownload.adobe.com/get/flashplayer/distyfp/current/win/install_flash_player_28_active_x.msi
- #NPAPI https://fpdownload.adobe.com/get/flashplayer/distyfp/current/win/install_flash_player_28_plugin.msi
- #PPAPI https://fpdownload.adobe.com/get/flashplayer/distyfp/current/win/install_flash_player_28_ppapi.msi
- #Uninstaller
- #https://fpdownload.macromedia.com/get/flashplayer/current/support/uninstall_flash_player.exe
- from setuphelpers import *
- import platform
- # uninstall key retrieved from msi properties with 'ProductCode' key. See below
- uninstallkey=[]
- def windows_version():
- """see https://msdn.microsoft.com/en-us/library/windows/desktop/ms724832(v=vs.85).aspx"""
- try:
- return Version(platform.win32_ver()[1],3)
- except:
- return Version(platform.win32_ver()[1])
- def install():
- for uninstall in installed_softwares('Adobe Flash Player'):
- if not 'MsiExec.exe' in uninstall['uninstall_string'] :
- if uninstall_key_exists(uninstall['key']):
- run_notfatal('"uninstall_flash_player.exe" -uninstall')
- print("Installing flash for firefox")
- major_version = control.version.split('.',1)[0]
- install_msi_if_needed('install_flash_player_%s_plugin.msi'%major_version,killbefore=['firefox.exe','chrome.exe'])
- print("Installing flash for internet explorer if < win10")
- if windows_version()<Version('6.2.0'):
- install_msi_if_needed('install_flash_player_%s_active_x.msi'%major_version,killbefore=['iexplore.exe'])
- # DISABLED - AUTO INSTALLED WITH CHROME
- # print("Installing flash for Chrome")
- # if windows_version()<Version('6.2.0'):
- # install_msi_if_needed('install_flash_player_%s_ppapi.msi'%major_version,killbefore=['chrome.exe'])
- print("Disable autoupdate")
- if iswin64():
- filecopyto("mms.cfg",makepath(os.environ['SYSTEMROOT'],"SysWOW64","Macromed","Flash"))
- else:
- filecopyto("mms.cfg",makepath(os.environ['SYSTEMROOT'],"System32","Macromed","Flash"))
- for task in ('Adobe Flash Player Updater',"Adobe Flash Player PPAPI Notifier"):
- if task_exists(task):
- delete_task(task)
- if service_installed('AdobeFlashPlayerUpdateSvc'):
- if service_is_running('AdobeFlashPlayerUpdateSvc'):
- service_stop('AdobeFlashPlayerUpdateSvc')
- run('sc delete AdobeFlashPlayerUpdateSvc')
- def update_sources():
- """Update to current version from macromedia"""
- os.chdir(os.path.dirname(__file__))
- # find latest version
- import requests,BeautifulSoup
- page = requests.get('https://get.adobe.com/fr/flashplayer',headers={'User-Agent':'Mozilla/5.0 (Windows NT 6.1; Win64; x64)'}).text
- bs = BeautifulSoup.BeautifulSoup(page)
- latest_version = bs.find(id="autoSelectedVersion").find(id="AUTO_ID_columnleft_p_version").text.replace('Version','').strip()
- print('Latest version: %s' % latest_version)
- major_version = latest_version.split('.',1)[0]
- allmsi = glob.glob('*.msi')
- for msi in allmsi:
- vers = get_msi_properties(msi)['ProductVersion']
- if vers != latest_version :
- remove_file(msi)
- if not isfile('install_flash_player_%s_active_x.msi' % major_version ) :
- wget('https://download.macromedia.com/get/flashplayer/pdc/%s/install_flash_player_%s_active_x.msi' % (latest_version,major_version),os.getcwd())
- if not isfile('install_flash_player_%s_plugin.msi' % major_version ) :
- wget('https://download.macromedia.com/get/flashplayer/pdc/%s/install_flash_player_%s_plugin.msi' % (latest_version,major_version),os.getcwd())
- #if not isfile('install_flash_player_%s_ppapi.msi' % major_version ) :
- # wget('https://download.macromedia.com/get/flashplayer/pdc/%s/install_flash_player_%s_ppapi.msi' % (latest_version,major_version),os.getcwd())
- wget('https://fpdownload.macromedia.com/get/flashplayer/current/support/uninstall_flash_player.exe' ,os.getcwd())
- # change version of package
- from waptpackage import PackageEntry
- pe = PackageEntry()
- pe.load_control_from_wapt(os.getcwd())
- pe.version = get_msi_properties('install_flash_player_%s_active_x.msi' % major_version)['ProductVersion']+'-0'
- pe.save_control_to_wapt(os.getcwd())
- if __name__ == '__main__':
- update_sources()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement