Format for the sqlite3 databse used for the assistive information changed in Mojave, additional columns added.

This commit is contained in:
Gareth J. Greenaway 2019-05-30 13:36:54 -07:00
parent 9c8a7e6a26
commit 9767dddfbf
No known key found for this signature in database
GPG key ID: 10B62F8A7CAD7A41

View file

@ -55,11 +55,16 @@ def install(app_id, enable=True):
salt '*' assistive.install com.smileonmymac.textexpander
'''
ge_el_capitan = True if _LooseVersion(__grains__['osrelease']) >= salt.utils.stringutils.to_str('10.11') else False
ge_mojave = True if _LooseVersion(__grains__['osrelease']) >= salt.utils.stringutils.to_str('10.14') else False
client_type = _client_type(app_id)
enable_str = '1' if enable else '0'
cmd = 'sqlite3 "/Library/Application Support/com.apple.TCC/TCC.db" ' \
'"INSERT or REPLACE INTO access VALUES(\'kTCCServiceAccessibility\',\'{0}\',{1},{2},1,NULL{3})"'.\
format(app_id, client_type, enable_str, ',NULL' if ge_el_capitan else '')
'"INSERT or REPLACE INTO access VALUES(\'kTCCServiceAccessibility\',\'{0}\',{1},{2},1,NULL{3}{4})"'.\
format(app_id,
client_type,
enable_str,
',NULL' if ge_el_capitan else '',
",NULL,NULL,NULL,NULL,''" if ge_mojave else '')
call = __salt__['cmd.run_all'](
cmd,