[macOS] Fixups to shell functions

This commit is contained in:
Ivan Malison 2016-10-09 23:03:19 -07:00
parent 10b38aec5b
commit efa0f61aaf
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8

View File

@ -13,14 +13,14 @@ function enable_access_for_assistive_devices {
local where_clause="where service='kTCCServiceAccessibility' and client='$bundle_identifier'"
local search_string="SELECT * from access ${where_clause};"
local values_string="VALUES('kTCCServiceAccessibility','$bundle_identifier',0,1,1,NULL)"
if test -z $(sudo sqlite3 '/Library/Application Support/com.apple.TCC/TCC.db' $search_string);
if test -z $(sudo sqlite3 '/Library/Application Support/com.apple.TCC/TCC.db' "$search_string");
then
local sql_string="INSERT INTO access $values_string;"
else
local sql_string="UPDATE access set allowed = 1 ${where_clause};"
fi
echo $sql_string
sudo sqlite3 '/Library/Application Support/com.apple.TCC/TCC.db' $sql_string
echo "$sql_string"
sudo sqlite3 '/Library/Application Support/com.apple.TCC/TCC.db' "$sql_string"
}
function as_user {