42 lines
1.6 KiB
Python
42 lines
1.6 KiB
Python
|
# -*- coding: utf-8 -*-
|
||
|
from setuphelpers import *
|
||
|
|
||
|
uninstallkey = []
|
||
|
|
||
|
def install():
|
||
|
print('Installing Apple iTunes')
|
||
|
msi = 'iTunes64.msi' if iswin64() else 'iTunes.msi'
|
||
|
run(r'msiexec /qn /norestart /i%s SCHEDULE_ASUW=0' % msi,accept_returncodes=[0,3010])
|
||
|
for soft in installed_softwares('iTunes'):
|
||
|
# Only check for the exact name. Eg, not iTunes Awsome Addon
|
||
|
if soft['name'] == 'iTunes':
|
||
|
uninstallkey = soft['key']
|
||
|
|
||
|
# Disable auto updates, using the parental control
|
||
|
with reg_openkey_noredir(HKEY_LOCAL_MACHINE,r'SOFTWARE\Apple Computer, Inc.\iTunes\Parental Controls\Default',sam=KEY_WRITE,create_if_missing=True) as reg_key:
|
||
|
reg_setvalue(reg_key, 'AdminFlags', 257, REG_DWORD)
|
||
|
|
||
|
# Remove desktop shortcut
|
||
|
remove_desktop_shortcut('iTunes')
|
||
|
|
||
|
def uninstall():
|
||
|
print('Uninstalling Apple iTunes')
|
||
|
for soft in installed_softwares('iTunes'):
|
||
|
if soft['name'] == 'iTunes':
|
||
|
run(r'msiexec /qn /norestart /x%s' % soft['key'])
|
||
|
|
||
|
def audit():
|
||
|
is_installed = False
|
||
|
for soft in installed_softwares('iTunes'):
|
||
|
is_installed = True
|
||
|
if is_installed == False :
|
||
|
print('iTunes is not installed')
|
||
|
return "ERROR"
|
||
|
parental_control = registry_readstring(HKEY_LOCAL_MACHINE,r'SOFTWARE\Apple Computer, Inc.\iTunes\Parental Controls\Default','AdminFlags')
|
||
|
if not parental_control:
|
||
|
print('Parental control is not enabled')
|
||
|
return "WARNING"
|
||
|
elif int(parental_control) != 257:
|
||
|
print('Parental control settings is not 257 as expected')
|
||
|
return "WARNING"
|
||
|
return "OK"
|