zoom

[zoom]zoomインストール(pkgutilで解凍する)


AppleScript サンプルコード

【スクリプトエディタで開く】 |

AppleScript サンプルソース(参考)
行番号ソース
001#!/usr/bin/env osascript
002----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
003#
004#   セルフインストールのサンプル zoom
005# pkgutil  --expand-full で解凍する方法
006#
007# com.cocolog-nifty.quicktimer.icefloe
008----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
009use AppleScript version "2.8"
010use framework "Foundation"
011use framework "AppKit"
012use scripting additions
013
014property refMe : a reference to current application
015
016
017##################################
018##【1】CPUタイプのよる処理の分岐
019set recordSysInfo to system info
020set strCpuType to (CPU type of recordSysInfo) as text
021if strCpuType contains "Intel" then
022  set strPkgURL to "https://zoom.us/client/latest/Zoom.pkg?archType=x86" as text
023  log strCpuType
024else if strCpuType contains "ARM" then
025  set strPkgURL to "https://zoom.us/client/latest/Zoom.pkg?archType=arm64" as text
026  log strCpuType
027else
028  return "不明なCUP処理終了"
029end if
030
031##################################
032##【2】ダウンロード 
033##起動時に削除する項目
034set appFileManager to refMe's NSFileManager's defaultManager()
035set ocidTempDirURL to appFileManager's temporaryDirectory()
036##フォルダ名はUUIDを使う
037set ocidConcreteUUID to refMe's NSUUID's UUID()
038set ocidUUIDString to ocidConcreteUUID's UUIDString()
039set ocidTempDirPathURL to ocidTempDirURL's URLByAppendingPathComponent:(ocidUUIDString) isDirectory:true
040##フォルダを777アクセス権で作成
041set ocidAttrDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
042ocidAttrDict's setValue:(511) forKey:(refMe's NSFilePosixPermissions)
043set boolDone to appFileManager's createDirectoryAtURL:(ocidTempDirPathURL) withIntermediateDirectories:(true) attributes:(ocidAttrDict) |error| :(reference)
044log boolDone
045set strTempDirPath to (ocidTempDirPathURL's |path|()) as text
046##ファイル名を取得
047try
048  set strCommandText to ("/usr/bin/curl -s -L -I -o /dev/null -w '%{url_effective}' \"" & strPkgURL & "\" | /usr/bin/rev | /usr/bin/cut -d'/' -f1 | /usr/bin/rev") as text
049  set strSaveFileName to (do shell script strCommandText) as text
050on error
051  try
052    set strCommandText to ("/usr/bin/curl -s -L -I -o /dev/null -w '%{url_effective}' \"" & strPkgURL & "\"  --http1.1 --connect-timeout 20 | /usr/bin/rev | /usr/bin/cut -d'/' -f1 | /usr/bin/rev") as text
053    set strSaveFileName to (do shell script strCommandText) as text
054  on error
055    set strSaveFileName to "install.pkg"
056  end try
057end try
058##ダウンロード
059try
060  set strCommandText to "/usr/bin/curl -L -o  \"" & strTempDirPath & "/" & strSaveFileName & "\"  \"" & strPkgURL & "\" --connect-timeout 20" as text
061  do shell script strCommandText
062on error
063  try
064    set strCommandText to "/usr/bin/curl -L -o  \"" & strTempDirPath & "/" & strSaveFileName & "\"  \"" & strPkgURL & "\"  --http1.1 --connect-timeout 20" as text
065    do shell script strCommandText
066  on error
067    return "インストーラーのダウンロードに失敗しました"
068  end try
069end try
070
071
072##################################
073##【3】インストール前準備
074###Dockのポジションを記憶 "/Library/Managed Preferences" は考慮しない
075set strFilePath to "~/Library/Preferences/com.apple.dock.plist" as text
076set ocidFilePathStr to refMe's NSString's stringWithString:(strFilePath)
077set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
078set ocidFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidFilePath) isDirectory:false)
079set ocidPlistDict to refMe's NSMutableDictionary's alloc()'s initWithContentsOfURL:(ocidFilePathURL)
080set ocidPerAppsArray to ocidPlistDict's objectForKey:("persistent-apps")
081set intArrayNo to (count of ocidPerAppsArray) as integer
082set intCntNo to 0 as integer
083repeat with itemerAppsArray in ocidPerAppsArray
084  set ocidTitleDataDict to (itemerAppsArray's objectForKey:("tile-data"))
085  set ocidFileDataDict to (ocidTitleDataDict's objectForKey:("file-data"))
086  set ocidCFURLString to (ocidFileDataDict's valueForKey:("_CFURLString"))
087  if (ocidCFURLString as text) contains ("zoom.us.app") then
088    exit repeat
089  end if
090  set intCntNo to intCntNo + 1 as integer
091end repeat
092if intArrayNo = intCntNo then
093  set intDocNo to (intArrayNo) as integer
094  log "Dockに登録されていません。一番下を指定します"
095else
096  set intDocNo to (intCntNo) as integer
097  log "Dockの " & intCntNo & "番目に登録されています"
098end if
099
100###アプリケーション終了
101set listUTI to {"us.zoom.caphost", "us.zoom.xos", "us.zoom.CptHost", "us.zoom.Transcode", "us.zoom.ZMScreenshot"} as list
102###通常終了
103repeat with itemUTI in listUTI
104  ###NSRunningApplication
105  set ocidRunningApplication to refMe's NSRunningApplication
106  ###起動中のすべてのリスト
107  set ocidAppArray to (ocidRunningApplication's runningApplicationsWithBundleIdentifier:(itemUTI))
108  ###複数起動時も順番に終了
109  repeat with itemAppArray in ocidAppArray
110    itemAppArray's terminate()
111  end repeat
112end repeat
113delay 2
114###強制終了
115repeat with itemUTI in listUTI
116  ###NSRunningApplication
117  set ocidRunningApplication to refMe's NSRunningApplication
118  ###起動中のすべてのリスト
119  set ocidAppArray to (ocidRunningApplication's runningApplicationsWithBundleIdentifier:(itemUTI))
120  ###複数起動時も順番に終了
121  repeat with itemAppArray in ocidAppArray
122    itemAppArray's forceTerminate()
123  end repeat
124end repeat
125###ユーザーアプリケーションディレクトリ700で
126set ocidURLsPathArray to (appFileManager's URLsForDirectory:(refMe's NSApplicationDirectory) inDomains:(refMe's NSUserDomainMask))
127set ocidAppDirPathURL to ocidURLsPathArray's firstObject()
128set ocidAttrDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
129ocidAttrDict's setValue:(448) forKey:(refMe's NSFilePosixPermissions)
130set boolDone to appFileManager's createDirectoryAtURL:(ocidAppDirPathURL) withIntermediateDirectories:(true) attributes:(ocidAttrDict) |error| :(reference)
131###ローカライズファイル
132set ocidLocalizedPathURL to ocidAppDirPathURL's URLByAppendingPathComponent:(".localized")
133set ocidLocalizedPath to ocidLocalizedPathURL's |path|()
134set boolDone to appFileManager's createFileAtPath:(ocidLocalizedPath) |contents|:(missing value) attributes:(ocidAttrDict)
135###Groupsフォルダ
136set ocidGroupsDirPathURL to ocidAppDirPathURL's URLByAppendingPathComponent:("Groups")
137set boolDone to appFileManager's createDirectoryAtURL:(ocidGroupsDirPathURL) withIntermediateDirectories:(true) attributes:(ocidAttrDict) |error| :(reference)
138###ローカライズファイル
139set ocidLocalizedPathURL to ocidGroupsDirPathURL's URLByAppendingPathComponent:(".localized")
140set ocidLocalizedPath to ocidLocalizedPathURL's |path|()
141set boolDone to appFileManager's createFileAtPath:(ocidLocalizedPath) |contents|:(missing value) attributes:(ocidAttrDict)
142
143###ゴミ箱
144set ocidURLsPathArray to (appFileManager's URLsForDirectory:(refMe's NSTrashDirectory) inDomains:(refMe's NSUserDomainMask))
145set ocidTrashDirPathURL to ocidURLsPathArray's firstObject()
146
147################################################
148###クリーニング
149################################################
150to doGoToTrash(arg_strFilePath)
151  set strFilePath to arg_strFilePath as text
152  set ocidFilePathStr to refMe's NSString's stringWithString:(strFilePath)
153  set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
154  set ocidFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidFilePath))
155  set appFileManager to refMe's NSFileManager's defaultManager()
156  set boolDone to appFileManager's trashItemAtURL:(ocidFilePathURL) resultingItemURL:(ocidFilePathURL) |error| :(reference)
157end doGoToTrash
158
159doGoToTrash("/Applications/zoom.us.app")
160doGoToTrash("/Applications/ZoomOutlookPlugin")
161doGoToTrash("~/Applications/zoom.us.app")
162doGoToTrash("~/Applications/Groups/zoom.us.app")
163delay 1 --> Dockからの削除待ち
164doGoToTrash("~/Applications/ZoomOutlookPlugin")
165doGoToTrash("~/Library/Caches/us.zoom.xos")
166doGoToTrash("~/Library/WebKit/us.zoom.xos")
167doGoToTrash("~/Library/Saved Application State/us.zoom.xos.savedState")
168doGoToTrash("~/Library/Receipts/ZoomMacOutlookPlugin.pkg.plist")
169doGoToTrash("~/Library/Receipts/ZoomMacOutlookPlugin.pkg.bom")
170doGoToTrash("~/Library/Logs/ZoomPhone")
171doGoToTrash("~/Library/Logs/zoom.us")
172doGoToTrash("~/Library/HTTPStorages/us.zoom.xos.binarycookies")
173doGoToTrash("~/Library/HTTPStorages/us.zoom.xos")
174
175delay 1 --> Dockからの削除待ち
176
177##################################
178##【4】インストール本処理(ユーザーインストール)
179###パッケージがあるか?確認
180set strPkgPath to ("" & strTempDirPath & "/" & strSaveFileName & "") as text
181set ocidFilePathStr to refMe's NSString's stringWithString:(strFilePath)
182set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
183set boolFileExist to appFileManager's fileExistsAtPath:(ocidFilePath) isDirectory:(false)
184if boolFileExist = true then
185  # set strCommandText to "/usr/sbin/installer -pkg    \"" & strTempDirPath & "/" & strSaveFileName & "\" -target CurrentUserHomeDirectory -dumplog -allowUntrusted  -lang ja" as text
186  set strCommandText to ("/usr/sbin/pkgutil  --expand-full \"" & strTempDirPath & "/" & strSaveFileName & "\" \"" & strTempDirPath & "/EXPAND" & "\"") as text
187  log strCommandText
188  do shell script strCommandText
189else
190  return "パッケージが見つかりません"
191end if
192###移動
193set ocidExpandAppPathURL to ocidTempDirPathURL's URLByAppendingPathComponent:("/EXPAND/zoomus.pkg/Payload/zoom.us.app") isDirectory:(false)
194###ユーザーインストールした場合のURL
195set strAppPath to "~/Applications/Groups/zoom.us.app" as text
196set ocidAppPathstr to refMe's NSString's stringWithString:(strAppPath)
197set ocidAppPath to ocidAppPathstr's stringByStandardizingPath()
198set ocidAppPathURL to refMe's NSURL's alloc()'s initFileURLWithPath:(ocidAppPath) isDirectory:true
199###移動
200set ListDone to (appFileManager's moveItemAtURL:(ocidExpandAppPathURL) toURL:(ocidAppPathURL) |error| :(reference))
201
202##開く
203set appSharedWorkspace to refMe's NSWorkspace's sharedWorkspace()
204set ocidOpenURLsArray to (refMe's NSMutableArray's alloc()'s initWithCapacity:0)
205(ocidOpenURLsArray's addObject:(ocidAppPathURL))
206appSharedWorkspace's activateFileViewerSelectingURLs:(ocidOpenURLsArray)
207
208##################################
209##【5】後処理
210
211set coidAbsoluteStringPath to ocidAppPathURL's absoluteString()
212
213################################
214###PLIST 読み込み
215set strFilePath to "~/Library/Preferences/com.apple.dock.plist" as text
216set ocidFilePathStr to refMe's NSString's stringWithString:(strFilePath)
217set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
218set ocidPlistPathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidFilePath) isDirectory:false)
219set ocidPlistDict to refMe's NSMutableDictionary's alloc()'s initWithContentsOfURL:(ocidPlistPathURL)
220set ocidPersistentArray to ocidPlistDict's objectForKey:"persistent-apps"
221
222################################
223####persistent-appsデータ生成
224set ocidAddDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
225###GUID実際はランダム番号だがNSFileSystemFileNumberを使う
226set listPathAttar to appFileManager's attributesOfItemAtPath:(ocidAppPath) |error| :(reference)
227set ocidAttar to item 1 of listPathAttar
228set numGUID to ocidAttar's valueForKey:(refMe's NSFileSystemFileNumber)
229set ocidIntValue to (refMe's NSNumber's numberWithInteger:(numGUID))
230ocidAddDict's setValue:(numGUID) forKey:("GUID")
231###
232set ocidStringValue to (refMe's NSString's stringWithString:("file-tile"))
233ocidAddDict's setValue:(ocidStringValue) forKey:("tile-type")
234################################
235set ocidAddTitleDataDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
236####dock-extra
237set ocidBoolValue to (refMe's NSNumber's numberWithBool:false)
238ocidAddTitleDataDict's setValue:(ocidBoolValue) forKey:("dock-extra")
239####dock-extra
240set ocidBoolValue to (refMe's NSNumber's numberWithBool:false)
241ocidAddTitleDataDict's setValue:(ocidBoolValue) forKey:("is-beta")
242####bundle-identifier
243set ocidAppBundle to (refMe's NSBundle's bundleWithURL:(ocidAppPathURL))
244set ocidBundleID to ocidAppBundle's bundleIdentifier
245set ocidStringValue to ocidBundleID's UTF8String()
246ocidAddTitleDataDict's setValue:(ocidStringValue) forKey:("bundle-identifier")
247####file-label"
248set listAttributesDict to ocidAppPathURL's resourceValuesForKeys:({refMe's NSURLLocalizedNameKey}) |error| :(reference)
249set ocidAttributesDict to (item 1 of listAttributesDict)
250set ocidLocalizedName to (ocidAttributesDict's objectForKey:(refMe's NSURLLocalizedNameKey))
251set ocidFileLabel to (ocidLocalizedName's stringByDeletingPathExtension())
252set ocidStringValue to ocidFileLabel's UTF8String()
253ocidAddTitleDataDict's setValue:(ocidStringValue) forKey:("file-label")
254####file-mod-date
255set listAttributesDict to ocidAppPathURL's resourceValuesForKeys:({refMe's NSURLContentModificationDateKey}) |error| :(reference)
256set ocidAttributesDict to (item 1 of listAttributesDict)
257set ocidModificationDate to (ocidAttributesDict's objectForKey:(refMe's NSURLContentModificationDateKey))
258set ocidModDate to ocidModificationDate's timeIntervalSince1970
259set ocidIntValue to ocidModDate's intValue()
260ocidAddTitleDataDict's setValue:(ocidIntValue) forKey:("file-mod-date")
261####parent-mod-date
262set ocidNow to refMe's NSDate's now
263set ocidNowNo to ocidNow's timeIntervalSince1970
264set ocidIntValue to ocidNowNo's intValue
265ocidAddTitleDataDict's setValue:(ocidIntValue) forKey:("parent-mod-date")
266####book
267set listBookMarkData to (ocidAppPathURL's bookmarkDataWithOptions:(11) includingResourceValuesForKeys:({missing value}) relativeToURL:(missing value) |error| :(reference))
268set ocidkDataValue to item 1 of listBookMarkData
269(ocidAddTitleDataDict's setObject:(ocidkDataValue) forKey:("book"))
270####file-type
271# 169   Launchpad とMission Control
272# 41      それ以外はまぁ41で間違いなさそう
273set ocidIntValue to (refMe's NSNumber's numberWithInteger:41)
274(ocidAddTitleDataDict's setValue:(ocidIntValue) forKey:("file-type"))
275#########
276set ocidAddFileDataDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
277(ocidAddFileDataDict's setValue:(coidAbsoluteStringPath) forKey:("_CFURLString"))
278####
279#   0 /File/Path
280#   15 file:// のURL形式
281set ocidIntValue to (refMe's NSNumber's numberWithInteger:15)
282(ocidAddFileDataDict's setValue:(ocidIntValue) forKey:("_CFURLStringType"))
283#########
284(ocidAddTitleDataDict's setObject:(ocidAddFileDataDict) forKey:("file-data"))
285ocidAddDict's setObject:(ocidAddTitleDataDict) forKey:("tile-data")
286####追加データを元のPLISTに戻す
287ocidPersistentArray's insertObject:(ocidAddDict) atIndex:(intDocNo)
288####保存
289set boolDone to ocidPlistDict's writeToURL:(ocidPlistPathURL) atomically:true
290
291
292###CFPreferencesを再起動
293try
294  set strCommandText to "/usr/bin/killall cfprefsd" as text
295  do shell script strCommandText
296on error
297  set strPlistPath to "/System/Library/LaunchAgents/com.apple.cfprefsd.xpc.agent.plist"
298  set strCommandText to ("/bin/launchctl stop -w \"" & strAgentPath & "\"")
299  try
300    do shell script strCommandText
301  end try
302  set strCommandText to ("/bin/launchctl start -w \"" & strAgentPath & "\"")
303  try
304    do shell script strCommandText
305  end try
306end try
307
308########################
309## Dock 再起動
310########################
311
312set strBundleID to "com.apple.dock"
313
314########################
315## 再起動
316########################
317set appSharedWorkspace to refMe's NSWorkspace's sharedWorkspace()
318##バンドルからアプリケーションのURLを取得
319set ocidAppBundle to (refMe's NSBundle's bundleWithIdentifier:(strBundleID))
320if ocidAppBundle ≠ (missing value) then
321  set ocidAppPathURL to ocidAppBundle's bundleURL()
322else if ocidAppBundle = (missing value) then
323  set ocidAppPathURL to (appSharedWorkspace's URLForApplicationWithBundleIdentifier:(strBundleID))
324end if
325##予備(アプリケーションのURL)
326if ocidAppPathURL = (missing value) then
327  tell application "Finder"
328    try
329      set aliasAppApth to (application file id strBundleID) as alias
330      set strAppPath to POSIX path of aliasAppApth as text
331      set strAppPathStr to refMe's NSString's stringWithString:(strAppPath)
332      set strAppPath to strAppPathStr's stringByStandardizingPath()
333      set ocidAppPathURL to refMe's NSURL's alloc()'s initFileURLWithPath:(strAppPath) isDirectory:true
334    on error
335      return "アプリケーションが見つかりませんでした"
336    end try
337  end tell
338end if
339##Dock終了
340set ocidRunningApplication to refMe's NSRunningApplication
341###起動中のすべてのリスト
342set ocidAppArray to (ocidRunningApplication's runningApplicationsWithBundleIdentifier:(strBundleID))
343###複数起動時も順番に終了
344repeat with itemAppArray in ocidAppArray
345  ###終了
346  itemAppArray's terminate()
347end repeat
348##1秒まって終了を確認
349delay 1
350##終了できない場合は強制終了
351repeat with itemAppArray in ocidAppArray
352  set boolTerminate to itemAppArray's terminated
353  if boolTerminate = false then
354    itemAppArray's forceTerminate()
355  end if
356end repeat
357
358###起動
359set ocidOpenConfig to refMe's NSWorkspaceOpenConfiguration's configuration
360###コンフィグ
361(ocidOpenConfig's setActivates:(refMe's NSNumber's numberWithBool:true))
362###起動
363(appSharedWorkspace's openApplicationAtURL:(ocidAppPathURL) configuration:(ocidOpenConfig) completionHandler:(missing value))
364
365return "再起動"
AppleScriptで生成しました

|

[zoom]関連プロセス強制終了


あくまでも参考にしてください

【スクリプトエディタで開く】 |

サンプルソース(参考)
行番号ソース
001#! /usr/bin/env osascript
002----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
003#メニューバーの● ■ ▶︎ の右三角をクリックして実行してください↑
004#
005#
006#
007# com.cocolog-nifty.quicktimer.icefloe
008----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
009use AppleScript version "2.8"
010use framework "Foundation"
011use framework "UniformTypeIdentifiers"
012use framework "AppKit"
013use scripting additions
014
015property refMe : a reference to current application
016
017
018set listBundleID to {"us.zoom.xos", "us.zoom.ZoomUninstaller", "us.zoom.ZMScreenshot", "us.zoom.CptHost", "us.zoom.caphost", "us.zoom.Transcode", "us.zoom.ZoomAutoUpdater", "us.zoom.zCCIMeetingHost", "us.zoom.ZoomClips"} as list
019(*
020repeat with itemBundleID in listBundleID
021  set strBundleID to itemBundleID as text
022  try
023    tell application id strBundleID to quit
024  end try
025end repeat
026*)
027
028repeat with itemBundleID in listBundleID
029  set strBundleID to itemBundleID as text
030  try
031    set ocidResultsArray to (refMe's NSRunningApplication's runningApplicationsWithBundleIdentifier:(strBundleID))
032    set numCntArray to ocidResultsArray count
033    set ocidRunApp to (ocidResultsArray's objectAtIndex:0)
034    ###通常終了
035    set boolDone to ocidRunApp's terminate()
036    ####強制終了
037    set boolDone to ocidRunApp's forceTerminate()
038  end try
039end repeat
040
041
042set listAppName to {"zoom.us", "ZoomUninstaller", "ZMScreenshot", "CptHost", "caphost", "Transcode", "ZoomAutoUpdater", "zCCIMeetingHost", "ZoomClips"} as list
043
044
045repeat with itemAppName in listAppName
046  set strAppName to itemAppName as text
047  set strCommandText to "/bin/ps  -alxe | grep \"" & strAppName & "\" | grep -v \"grep\" | awk '{ print $2 }'" as text
048  set strResponce to (do shell script strCommandText) as text
049  log strResponce
050  set AppleScript's text item delimiters to "\r"
051  set listPID to every text item of strResponce
052  set AppleScript's text item delimiters to ""
053  
054  if (count of listPID) = 0 then
055    log "対象プロセス無し"
056  else
057    repeat with itemPID in listPID
058      ###プロセスを終了させる
059      doQuitApp2PID(itemPID)
060    end repeat
061  end if
062end repeat
063
064
065
066###################################
067########アプリケーションを終了させる
068###################################
069to doQuitApp2PID(argPID)
070  set strPID to argPID as text
071  #### killallを使う場合
072  set strCommandText to ("/bin/kill -15  " & strPID & "") as text
073  set ocidCommandText to refMe's NSString's stringWithString:strCommandText
074  set ocidTermTask to refMe's NSTask's alloc()'s init()
075  ocidTermTask's setLaunchPath:"/bin/zsh"
076  ocidTermTask's setArguments:({"-c", ocidCommandText})
077  set listResults to ocidTermTask's launchAndReturnError:(reference)
078  log listResults
079  if item 1 of listResults is true then
080    log "正常終了"
081  else
082    try
083      set strCommandText to ("/bin/kill -9  " & strPID & "") as text
084      set strResponse to (do shell script strCommandText) as text
085    end try
086  end if
087end doQuitApp2PID
AppleScriptで生成しました

|

[zoom]キャッシュクリア


#!/bin/bash
#com.cocolog-nifty.quicktimer.icefloe
#
#################################################
###管理者インストールしているか?チェック
USER_WHOAMI=$(/usr/bin/whoami)
/bin/echo "実行ユーザー(whoami): $USER_WHOAMI"
###実行しているユーザー名
CONSOLE_USER=$(/bin/echo "show State:/Users/ConsoleUser" | /usr/sbin/scutil | /usr/bin/awk '/Name :/ { print $3 }')
/bin/echo "コンソールユーザー(scutil): $CONSOLE_USER"
###実行しているユーザー名
HOME_USER=$(/bin/echo "$HOME" | /usr/bin/awk -F'/' '{print $NF}')
/bin/echo "実行ユーザー(HOME): $HOME_USER"
###logname
LOGIN_NAME=$(/usr/bin/logname)
/bin/echo "ログイン名(logname): $LOGIN_NAME"
###UID
USER_NAME=$(/usr/bin/id -un)
/bin/echo "ユーザー名(id): $USER_NAME"
###STAT
STAT_USR=$(/usr/bin/stat -f%Su /dev/console)
/bin/echo "STAT_USR(console): $STAT_USR"
#################################################
###
USER_MKTMP_DIR=$(/usr/bin/mktemp -d)
USR_TMP_DIR_T=$(/usr/bin/dirname "$USER_MKTMP_DIR")
USR_TMP_DIR=$(/usr/bin/dirname "$USR_TMP_DIR_T")
###
STR_GO2_TRASH_DIR="$USR_TMP_DIR""/T/us.zoom.xos"
/bin/mkdir -p "$STR_GO2_TRASH_DIR"
USER_TRASH_DIR=$(/usr/bin/mktemp -d "$HOME/.Trash/ZOOM.XXXXXXXX")
/bin/mv "$STR_GO2_TRASH_DIR" "$USER_TRASH_DIR"
###
STR_GO2_TRASH_DIR="$USR_TMP_DIR""/C/us.zoom.xos"
/bin/mkdir -p "$STR_GO2_TRASH_DIR"
USER_TRASH_DIR=$(/usr/bin/mktemp -d "$HOME/.Trash/ZOOM.XXXXXXXX")
/bin/mv "$STR_GO2_TRASH_DIR" "$USER_TRASH_DIR"

#################################################
###
STR_GO2_TRASH_DIR="/Applications/ZoomOutlookPlugin"
/bin/mkdir -p "$STR_GO2_TRASH_DIR"
USER_TRASH_DIR=$(/usr/bin/mktemp -d "$HOME/.Trash/ZOOM.XXXXXXXX")
/bin/mv "$STR_GO2_TRASH_DIR" "$USER_TRASH_DIR"
###
STR_GO2_TRASH_DIR="$HOME/Library/Caches/us.zoom.xos"
/bin/mkdir -p "$STR_GO2_TRASH_DIR"
USER_TRASH_DIR=$(/usr/bin/mktemp -d "$HOME/.Trash/ZOOM.XXXXXXXX")
/bin/mv "$STR_GO2_TRASH_DIR" "$USER_TRASH_DIR"
###
STR_GO2_TRASH_DIR="$HOME/Library/Application Scripts/BJ4HAAB9B3.ZoomClient3rd"
/bin/mkdir -p "$STR_GO2_TRASH_DIR"
USER_TRASH_DIR=$(/usr/bin/mktemp -d "$HOME/.Trash/ZOOM.XXXXXXXX")
/bin/mv "$STR_GO2_TRASH_DIR" "$USER_TRASH_DIR"
###
STR_GO2_TRASH_DIR="$HOME/Library/WebKit/us.zoom.xos"
/bin/mkdir -p "$STR_GO2_TRASH_DIR"
USER_TRASH_DIR=$(/usr/bin/mktemp -d "$HOME/.Trash/ZOOM.XXXXXXXX")
/bin/mv "$STR_GO2_TRASH_DIR" "$USER_TRASH_DIR"
###
STR_GO2_TRASH_DIR="$HOME//Library/Logs/zoom.us"
/bin/mkdir -p "$STR_GO2_TRASH_DIR"
USER_TRASH_DIR=$(/usr/bin/mktemp -d "$HOME/.Trash/ZOOM.XXXXXXXX")
/bin/mv "$STR_GO2_TRASH_DIR" "$USER_TRASH_DIR"
###
STR_GO2_TRASH_DIR="$HOME/Library/Logs/ZoomPhone"
/bin/mkdir -p "$STR_GO2_TRASH_DIR"
USER_TRASH_DIR=$(/usr/bin/mktemp -d "$HOME/.Trash/ZOOM.XXXXXXXX")
/bin/mv "$STR_GO2_TRASH_DIR" "$USER_TRASH_DIR"
###
STR_GO2_TRASH_DIR="$HOME/Library/HTTPStorages/us.zoom.xos"
/bin/mkdir -p "$STR_GO2_TRASH_DIR"
USER_TRASH_DIR=$(/usr/bin/mktemp -d "$HOME/.Trash/ZOOM.XXXXXXXX")
/bin/mv "$STR_GO2_TRASH_DIR" "$USER_TRASH_DIR"
###
STR_GO2_TRASH_DIR="$HOME/Library/Group Containers/BJ4HAAB9B3.ZoomClient3rd"
/bin/mkdir -p "$STR_GO2_TRASH_DIR"
USER_TRASH_DIR=$(/usr/bin/mktemp -d "$HOME/.Trash/ZOOM.XXXXXXXX")
/bin/mv "$STR_GO2_TRASH_DIR" "$USER_TRASH_DIR"
###
STR_GO2_TRASH_DIR="$HOME/Library/Application Support/zoom.us/data/WaitingRoom"
/bin/mkdir -p "$STR_GO2_TRASH_DIR"
USER_TRASH_DIR=$(/usr/bin/mktemp -d "$HOME/.Trash/ZOOM.XXXXXXXX")
/bin/mv "$STR_GO2_TRASH_DIR" "$USER_TRASH_DIR"
###
STR_GO2_TRASH_DIR="$HOME/Library/Application Support/zoom.us/data/VideoClips"
/bin/mkdir -p "$STR_GO2_TRASH_DIR"
USER_TRASH_DIR=$(/usr/bin/mktemp -d "$HOME/.Trash/ZOOM.XXXXXXXX")
/bin/mv "$STR_GO2_TRASH_DIR" "$USER_TRASH_DIR"

###############
STR_GO2_TRASH_DIR="$HOME/Library/Receipts/ZoomMacOutlookPlugin.pkg.plist"
/usr/bin/touch "$STR_GO2_TRASH_DIR"
USER_TRASH_DIR=$(/usr/bin/mktemp -d "$HOME/.Trash/ZOOM.XXXXXXXX")
/bin/mv "$STR_GO2_TRASH_DIR" "$USER_TRASH_DIR"
###
STR_GO2_TRASH_DIR="$HOME/Library/Receipts/ZoomMacOutlookPlugin.pkg.bom"
/usr/bin/touch "$STR_GO2_TRASH_DIR"
USER_TRASH_DIR=$(/usr/bin/mktemp -d "$HOME/.Trash/ZOOM.XXXXXXXX")
/bin/mv "$STR_GO2_TRASH_DIR" "$USER_TRASH_DIR"
###
STR_GO2_TRASH_DIR="$HOME/Library/Receipts/us.zoom.pkg.videomeeting.bom"
/usr/bin/touch "$STR_GO2_TRASH_DIR"
USER_TRASH_DIR=$(/usr/bin/mktemp -d "$HOME/.Trash/ZOOM.XXXXXXXX")
/bin/mv "$STR_GO2_TRASH_DIR" "$USER_TRASH_DIR"
###
STR_GO2_TRASH_DIR="$HOME/Library/Receipts/us.zoom.pkg.videomeeting.plist"
/usr/bin/touch "$STR_GO2_TRASH_DIR"
USER_TRASH_DIR=$(/usr/bin/mktemp -d "$HOME/.Trash/ZOOM.XXXXXXXX")
/bin/mv "$STR_GO2_TRASH_DIR" "$USER_TRASH_DIR"
###
STR_GO2_TRASH_DIR="$HOME/Library/Logs/zoomusinstall.log"
/usr/bin/touch "$STR_GO2_TRASH_DIR"
USER_TRASH_DIR=$(/usr/bin/mktemp -d "$HOME/.Trash/ZOOM.XXXXXXXX")
/bin/mv "$STR_GO2_TRASH_DIR" "$USER_TRASH_DIR"
###
STR_GO2_TRASH_DIR="$HOME/Library/HTTPStorages/us.zoom.xos.binarycookies"
/usr/bin/touch "$STR_GO2_TRASH_DIR"
USER_TRASH_DIR=$(/usr/bin/mktemp -d "$HOME/.Trash/ZOOM.XXXXXXXX")
/bin/mv "$STR_GO2_TRASH_DIR" "$USER_TRASH_DIR"
###
STR_GO2_TRASH_DIR="$HOME/Library/Application Support/zoom.us/data/zoomus.enc.db.malformed"
/usr/bin/touch "$STR_GO2_TRASH_DIR"
USER_TRASH_DIR=$(/usr/bin/mktemp -d "$HOME/.Trash/ZOOM.XXXXXXXX")
/bin/mv "$STR_GO2_TRASH_DIR" "$USER_TRASH_DIR"
###
STR_GO2_TRASH_DIR="$HOME/Library/Application Support/zoom.us/data/meetingpaaplog.bin"
/usr/bin/touch "$STR_GO2_TRASH_DIR"
USER_TRASH_DIR=$(/usr/bin/mktemp -d "$HOME/.Trash/ZOOM.XXXXXXXX")
/bin/mv "$STR_GO2_TRASH_DIR" "$USER_TRASH_DIR"
###
STR_GO2_TRASH_DIR="$HOME/Library/Application Support/zoom.us/data/ptpaaplog.bin"
/usr/bin/touch "$STR_GO2_TRASH_DIR"
USER_TRASH_DIR=$(/usr/bin/mktemp -d "$HOME/.Trash/ZOOM.XXXXXXXX")
/bin/mv "$STR_GO2_TRASH_DIR" "$USER_TRASH_DIR"
###
STR_GO2_TRASH_DIR="$HOME/Library/Application Support/zoom.us/data/zmonitorlog.bin"
/usr/bin/touch "$STR_GO2_TRASH_DIR"
USER_TRASH_DIR=$(/usr/bin/mktemp -d "$HOME/.Trash/ZOOM.XXXXXXXX")
/bin/mv "$STR_GO2_TRASH_DIR" "$USER_TRASH_DIR"

#####
#
/usr/bin/touch "$HOME/Library/Application Support/zoom.us/ZoomClips.app"

/bin/rm "$HOME/Library/Application Support/zoom.us/ZoomClips.app"

/bin/ln -s "$HOME/Library/Application Support/zoom.us/Plugins/Frameworks/ZoomClips.app" "$HOME/Library/Application Support/zoom.us/ZoomClips.app"

/bin/echo "Done"
exit 0


|

[bash]Zoomアップデート 少し修正


【スクリプトエディタで開く】|

#!/bin/bash
#com.cocolog-nifty.quicktimer.icefloe
#ユーザードメインにインストール
########################################
##実行パス
SCRIPT_PATH="${BASH_SOURCE[0]}"
/bin/echo "実行中のスクリプト"
/bin/echo "\"$SCRIPT_PATH\""


########################################
##事前チェック

CHK_APP_PATH="/Applications/zoom.us.app"
if [ -e "$CHK_APP_PATH" ]; then
  /bin/echo "【エラー】$CHK_APP_PATHが存在します以下のコマンドをターミナルで実行してください"
  /bin/echo "/usr/bin/sudo /bin/mv \"$CHK_APP_PATH\" \"$HOME/.Trash\""
  exit 1
fi
CHK_APP_PATH="/Applications/ZoomOutlookPlugin"
if [ -e "$CHK_APP_PATH" ]; then
TRASH_DIR=$(/usr/bin/mktemp -d "$HOME/.Trash/ZOOM.XXXXXXXX")
/bin/chmod 777 "$TRASH_DIR"
/bin/mv "$CHK_APP_PATH" "$TRASH_DIR"
fi
if [ -e "$CHK_APP_PATH" ]; then
  /bin/echo "【エラー】$CHK_APP_PATHが存在します以下のコマンドをターミナルで実行してください"
  /bin/echo "/usr/bin/sudo /bin/mv \"$CHK_APP_PATH\" \"$HOME/.Trash\""
  exit 1
fi
CHK_APP_PATH="/Library/Application Support/zoom.us"
if [ -e "$CHK_APP_PATH" ]; then
  /bin/echo "【エラー】$CHK_APP_PATHが存在します以下のコマンドをターミナルで実行してください"
  /bin/echo "/usr/bin/sudo /bin/mv \"$CHK_APP_PATH\" \"$HOME/.Trash\""
  exit 1
fi

CHK_APP_PATH="/Library/PrivilegedHelperTools/us.zoom.ZoomDaemon"
if [ -e "$CHK_APP_PATH" ]; then
  /bin/echo "【エラー】$CHK_APP_PATHが存在します以下のコマンドをターミナルで実行してください"
  /bin/echo "/usr/bin/sudo /bin/mv \"$CHK_APP_PATH\" \"$HOME/.Trash\""
  exit 1
fi
CHK_APP_PATH="/Library/LaunchDaemons/us.zoom.ZoomDaemon.plist"
if [ -e "$CHK_APP_PATH" ]; then
  /bin/echo "【エラー】$CHK_APP_PATHが存在します以下のコマンドをターミナルで実行してください"
  /bin/echo "/usr/bin/sudo /bin/mv \"$CHK_APP_PATH\" \"$HOME/.Trash\""
  exit 1
fi

########################################
##OS
PLIST_PATH="/System/Library/CoreServices/SystemVersion.plist"
STR_OS_VER=$(/usr/bin/defaults read "$PLIST_PATH" ProductVersion)
/bin/echo "OS VERSION :" "$STR_OS_VER"
STR_MAJOR_VERSION="${STR_OS_VER%%.*}"
/bin/echo "STR_MAJOR_VERSION :" "$STR_MAJOR_VERSION"
STR_MINOR_VERSION="${STR_OS_VER#*.}"
/bin/echo "STR_MINOR_VERSION :" "$STR_MINOR_VERSION"
# STR_MAJOR_VERSION=$(/usr/bin/sw_vers -productVersion | /usr/bin/cut -d '.' -f 1,1)
# STR_MINOR_VERSION=$(/usr/bin/sw_vers -productVersion | /usr/bin/cut -d '.' -f 2,2)

########################################
##ユーザー
USER_WHOAMI=$(/usr/bin/whoami)
/bin/echo "実行したユーザーは:$USER_WHOAMI"
CURRENT_USER=$(/bin/echo "$HOME" | /usr/bin/awk -F'/' '{print $NF}')
/bin/echo "実行中ユーザー:" "$CURRENT_USER"

########################################
###ダウンロード起動時に削除する項目
USER_TEMP_DIR=$(/usr/bin/mktemp -d)
/bin/echo "起動時に削除されるディレクトリ:" "$USER_TEMP_DIR"

########################################
##デバイス
#起動ディスクの名前を取得する
/usr/bin/touch "$USER_TEMP_DIR/diskutil.plist"
/usr/sbin/diskutil info -plist / >"$USER_TEMP_DIR/diskutil.plist"
STARTUPDISK_NAME=$(/usr/bin/defaults read "$USER_TEMP_DIR/diskutil.plist" VolumeName)
/bin/echo "ボリューム名:" "$STARTUPDISK_NAME"
STR_DEVICE_UUID=$(/usr/sbin/ioreg -c IOPlatformExpertDevice | grep IOPlatformUUID | awk -F'"' '{print $4}')
/bin/echo "デバイスUUID: " "$STR_DEVICE_UUID"
############################################################
##基本メンテナンス
##ライブラリの不可視属性を解除
/usr/bin/chflags nohidden "/Users/$CURRENT_USER/Library"
/usr/bin/SetFile -a v "/Users/$CURRENT_USER/Library"
## Managed Itemsフォルダを作る
/bin/mkdir -p "/Users/$CURRENT_USER/Library/Managed Items"
/bin/chmod 755 "/Users/$CURRENT_USER/Library/Managed Items"
/usr/sbin/chown "$CURRENT_USER" "/Users/$CURRENT_USER/Library/Managed Items"
/usr/bin/touch "/Users/$CURRENT_USER/Library/Managed Items/.localized"

########################################
## HOME
########################################
## Developer
STR_CHECK_DIR_PATH="/Users/$CURRENT_USER/Developer"
/bin/mkdir -p "$STR_CHECK_DIR_PATH"
/bin/chmod 700 "$STR_CHECK_DIR_PATH"
/usr/bin/touch "$STR_CHECK_DIR_PATH/.localized"
## bin
STR_CHECK_DIR_PATH="/Users/$CURRENT_USER/bin"
/bin/mkdir -p "$STR_CHECK_DIR_PATH"
/bin/chmod 700 "$STR_CHECK_DIR_PATH"
##アクセス権チェック
/bin/chmod 700 "/Users/$CURRENT_USER/Library"
/bin/chmod 700 "/Users/$CURRENT_USER/Movies"
/bin/chmod 700 /"Users/$CURRENT_USER/Music"
/bin/chmod 700 "/Users/$CURRENT_USER/Pictures"
/bin/chmod 700 "/Users/$CURRENT_USER/Downloads"
/bin/chmod 700 "/Users/$CURRENT_USER/Documents"
/bin/chmod 700 "/Users/$CURRENT_USER/Desktop"
##全ローカルユーザーに対して実施したい処理があれば追加する
/bin/echo "ユーザーディレクトリチェックDONE"
########################################
## Public
########################################
/bin/chmod 755 "/Users/$CURRENT_USER/Public"
##
STR_CHECK_DIR_PATH="/Users/$CURRENT_USER/Public/Drop Box"
/bin/mkdir -p "$STR_CHECK_DIR_PATH"
/bin/chmod 733 "$STR_CHECK_DIR_PATH"
/usr/bin/touch "$STR_CHECK_DIR_PATH/.localized"
/usr/bin/chgrp -Rf nobody "$STR_CHECK_DIR_PATH"
##########
STR_CHECK_DIR_PATH="/Users/$CURRENT_USER/Public/Documents"
/bin/mkdir -p "$STR_CHECK_DIR_PATH"
/bin/chmod 700 "$STR_CHECK_DIR_PATH"
/usr/bin/touch "$STR_CHECK_DIR_PATH/.localized"
/usr/bin/chgrp -Rf admin "$STR_CHECK_DIR_PATH"
##
STR_CHECK_DIR_PATH="/Users/$CURRENT_USER/Public/Downloads"
/bin/mkdir -p "$STR_CHECK_DIR_PATH"
/bin/chmod 700 "$STR_CHECK_DIR_PATH"
/usr/bin/touch "$STR_CHECK_DIR_PATH/.localized"
/usr/bin/chgrp -Rf admin "$STR_CHECK_DIR_PATH"
##
STR_CHECK_DIR_PATH="/Users/$CURRENT_USER/Public/Favorites"
/bin/mkdir -p "$STR_CHECK_DIR_PATH"
/bin/chmod 700 "$STR_CHECK_DIR_PATH"
/usr/bin/touch "$STR_CHECK_DIR_PATH/.localized"
/usr/bin/chgrp -Rf admin "$STR_CHECK_DIR_PATH"
##########
STR_CHECK_DIR_PATH="/Users/$CURRENT_USER/Public/Groups"
/bin/mkdir -p "$STR_CHECK_DIR_PATH"
/bin/chmod 770 "$STR_CHECK_DIR_PATH"
/usr/bin/touch "$STR_CHECK_DIR_PATH/.localized"
/usr/bin/chgrp -Rf staff "$STR_CHECK_DIR_PATH"
##
STR_CHECK_DIR_PATH="/Users/$CURRENT_USER/Public/Shared"
/bin/mkdir -p "$STR_CHECK_DIR_PATH"
/bin/chmod 750 "$STR_CHECK_DIR_PATH"
/usr/bin/touch "$STR_CHECK_DIR_PATH/.localized"
/usr/bin/chgrp -Rf staff "$STR_CHECK_DIR_PATH"
##########
STR_CHECK_DIR_PATH="/Users/$CURRENT_USER/Public/Guest"
/bin/mkdir -p "$STR_CHECK_DIR_PATH"
/bin/chmod 777 "$STR_CHECK_DIR_PATH"
/usr/bin/touch "$STR_CHECK_DIR_PATH/.localized"
/usr/bin/chgrp -Rf nobody "$STR_CHECK_DIR_PATH"
##
STR_CHECK_DIR_PATH="/Users/$CURRENT_USER/Public/Shared Items"
/bin/mkdir -p "$STR_CHECK_DIR_PATH"
/bin/chmod 775 "$STR_CHECK_DIR_PATH"
/usr/bin/touch "$STR_CHECK_DIR_PATH/.localized"
/usr/bin/chgrp -Rf nobody "$STR_CHECK_DIR_PATH"

########################################
## Applications
########################################
## Applications
STR_CHECK_DIR_PATH="/Users/$CURRENT_USER/Applications"
/bin/mkdir -p "$STR_CHECK_DIR_PATH"
/bin/chmod 700 "$STR_CHECK_DIR_PATH"
/usr/bin/touch "$STR_CHECK_DIR_PATH/.localized"
##サブフォルダを作る
LIST_SUB_DIR_NAME=("Demos" "Desktop" "Developer" "Documents" "Downloads" "Favorites" "Groups" "Library" "Movies" "Music" "Pictures" "Public" "Shared" "Sites" "System" "Users" "Utilities")
##リストの数だけ処理
for ITEM_DIR_NAME in "${LIST_SUB_DIR_NAME[@]}"; do
  /bin/mkdir -p "$STR_CHECK_DIR_PATH/${ITEM_DIR_NAME}"
  /bin/chmod 700 "$STR_CHECK_DIR_PATH/${ITEM_DIR_NAME}"
  /usr/bin/touch "$STR_CHECK_DIR_PATH/${ITEM_DIR_NAME}/.localized"
done
########################################
##シンボリックリンクを作る
if [[ ! -e "/Users/$CURRENT_USER/Applications/Applications" ]]; then
  /bin/ln -s "/Applications" "/Users/$CURRENT_USER/Applications/Applications"
fi
if [[ ! -e "/Users/$CURRENT_USER/Applications/Utilities/Finder Applications" ]]; then
  /bin/ln -s "/System/Library/CoreServices/Finder.app/Contents/Applications" "/Users/$CURRENT_USER/Applications/Utilities/Finder Applications"
fi
if [[ ! -e "/Users/$CURRENT_USER/Applications/Utilities/Finder Libraries" ]]; then
  /bin/ln -s "/System/Library/CoreServices/Finder.app/Contents/Resources/MyLibraries" "/Users/$CURRENT_USER/Applications/Utilities/Finder Libraries"
fi
if [[ ! -e "/Users/$CURRENT_USER/Applications/Utilities/System Applications" ]]; then
  /bin/ln -s "/System/Library/CoreServices/Applications" "/Users/$CURRENT_USER/Applications/Utilities/System Applications"
fi
if [[ ! -e "/Users/$CURRENT_USER/Applications/Utilities/System Utilities" ]]; then
  /bin/ln -s "/Applications/Utilities" "/Users/$CURRENT_USER/Applications/Utilities/System Utilities"
fi


##全ローカルユーザーに対して実施したい処理があれば追加する
/bin/echo "ユーザーディレクトリチェックDONE"
################################################
###設定項目
STR_BUNDLEID="us.zoom.xos"
STR_APP_PATH="$HOME/Applications/zoom.us.app"
###アプリケーション名を取得
STR_APP_NAME=$(/usr/bin/defaults read "$STR_APP_PATH/Contents/Info.plist" CFBundleDisplayName)
if [ -z "$STR_APP_NAME" ]; then
  STR_APP_NAME=$(/usr/bin/defaults read "$STR_APP_PATH/Contents/Info.plist" CFBundleName)
fi
/bin/echo "アプリケーション名:$STR_APP_NAME"
#######################################
### DOCKに登録済みかゴミ箱に入れる前に調べておく
## Dockの登録数を調べる
JSON_PERSISENT_APPS=$(/usr/bin/defaults read com.apple.dock persistent-apps)
NUN_CNT_ITEM=$(/bin/echo "$JSON_PERSISENT_APPS" | grep -o "tile-data" | wc -l)
/bin/echo "Dock登録数:$NUN_CNT_ITEM"
##Dockの登録数だけ繰り返し
NUM_CNT=0 #カウンタ初期化
NUM_POSITION="NULL" #ポジション番号にNULL文字を入れる
###対象のバンドルIDがDockに登録されているか順番に調べる
while [ $NUM_CNT -lt "$NUN_CNT_ITEM" ]; do
  ##順番にバンドルIDを取得して
  STR_CHK_BUNDLEID=$(/usr/libexec/PlistBuddy -c "Print:persistent-apps:$NUM_CNT:tile-data:bundle-identifier" "$HOME/Library/Preferences/com.apple.dock.plist")
  ##対象のバンドルIDだったら
  if [ "$STR_CHK_BUNDLEID" = "$STR_BUNDLEID" ]; then
    /bin/echo "DockのポジションNO: $NUM_CNT バンドルID:$STR_CHK_BUNDLEID"
    ##位置情報ポジションを記憶しておく
    NUM_POSITION=$NUM_CNT
  fi
  NUM_CNT=$((NUM_CNT + 1))
done

#######################################
## 本処理 ダウンロードディレクトリ
DOWNLOADS_DIR_PATH=$(/usr/bin/mktemp -d)
/bin/chmod 777 "$DOWNLOADS_DIR_PATH"
/bin/echo "ダウンロードディレクトリ:" "$DOWNLOADS_DIR_PATH"
#######################################
##プロセス終了
/usr/bin/killall "zoom.us" 2>/dev/null
/usr/bin/killall "caphost" 2>/dev/null

#######################################
##古いファイルをゴミ箱に USER
function DO_MOVE_TO_TRASH() {
  if [ -e "$1" ]; then
    TRASH_DIR=$(/usr/bin/mktemp -d "/Users/$CURRENT_USER/.Trash/ZOOM.XXXXXXXX")
    /bin/chmod 777 "$TRASH_DIR"
    /bin/mv "$1" "$TRASH_DIR"
  fi
}
DO_MOVE_TO_TRASH "/Users/$CURRENT_USER/Applications/zoom.us.app"
DO_MOVE_TO_TRASH "/Users/$CURRENT_USER/Applications/ZoomOutlookPlugin"

DO_MOVE_TO_TRASH "/Users/$CURRENT_USER/Applications/Groups/zoom.us.app"
DO_MOVE_TO_TRASH "/Users/$CURRENT_USER/Applications/Groups/ZoomOutlookPlugin"

DO_MOVE_TO_TRASH "/Users/$CURRENT_USER/Library/Caches/us.zoom.xos"
DO_MOVE_TO_TRASH "/Users/$CURRENT_USER/Library/WebKit/us.zoom.xos"
DO_MOVE_TO_TRASH "/Users/$CURRENT_USER/Library/Saved Application State/us.zoom.xos.savedState"
DO_MOVE_TO_TRASH "/Users/$CURRENT_USER/Library/Receipts/ZoomMacOutlookPlugin.pkg.plist"
DO_MOVE_TO_TRASH "/Users/$CURRENT_USER/Library/Receipts/ZoomMacOutlookPlugin.pkg.bom"
DO_MOVE_TO_TRASH "/Users/$CURRENT_USER/Library/Logs/ZoomPhone"
DO_MOVE_TO_TRASH "/Users/$CURRENT_USER/Library/Logs/zoom.us"
DO_MOVE_TO_TRASH "/Users/$CURRENT_USER/Library/HTTPStorages/us.zoom.xos.binarycookies"
DO_MOVE_TO_TRASH "/Users/$CURRENT_USER/Library/HTTPStorages/us.zoom.xos"

#######################################
## 本処理 ダウンロード
ARCHITEC=$(/usr/bin/arch)
/bin/echo "Running on $ARCHITEC"
if [ "$ARCHITEC" == "arm64" ]; then

  STR_URL="https://zoom.us/client/latest/ZoomMacOutlookPlugin.pkg?archType=arm64"
  ###ファイル名を取得
  PKG_FILE_NAME=$(/usr/bin/curl -s -L -I -o /dev/null -w '%{url_effective}' "$STR_URL" | /usr/bin/rev | /usr/bin/cut -d'/' -f1 | /usr/bin/rev)
  /bin/echo "PKG_FILE_NAME" "$PKG_FILE_NAME"
  if ! /usr/bin/curl -L -o "$DOWNLOADS_DIR_PATH/$PKG_FILE_NAME" "$STR_URL" --connect-timeout 20; then
    /bin/echo "ファイルのダウンロードに失敗しました HTTP1.1をトライします"
    /usr/bin/curl -L -o "$DOWNLOADS_DIR_PATH/$PKG_FILE_NAME" "$STR_URL" --http1.1 --connect-timeout 20
  fi
  /usr/bin/killall "zoom.us" 2>/dev/null
  /usr/bin/killall "caphost" 2>/dev/null
  ###本処理 インストール
  /usr/sbin/installer -pkg "$DOWNLOADS_DIR_PATH/$PKG_FILE_NAME" -target CurrentUserHomeDirectory -dumplog -allowUntrusted -lang ja

  #######################################
  STR_URL="https://zoom.us/client/latest/Zoom.pkg?archType=arm64"
  ###ファイル名を取得
  PKG_FILE_NAME=$(/usr/bin/curl -s -L -I -o /dev/null -w '%{url_effective}' "$STR_URL" | /usr/bin/rev | /usr/bin/cut -d'/' -f1 | /usr/bin/rev)
  /bin/echo "PKG_FILE_NAME" "$PKG_FILE_NAME"
  if ! /usr/bin/curl -L -o "$DOWNLOADS_DIR_PATH/$PKG_FILE_NAME" "$STR_URL" --connect-timeout 20; then
    /bin/echo "ファイルのダウンロードに失敗しました HTTP1.1をトライします"
    /usr/bin/curl -L -o "$DOWNLOADS_DIR_PATH/$PKG_FILE_NAME" "$STR_URL" --http1.1 --connect-timeout 20
  fi
  /usr/bin/killall "zoom.us" 2>/dev/null
  /usr/bin/killall "caphost" 2>/dev/null
  ###本処理 インストール
  /usr/sbin/installer -pkg "$DOWNLOADS_DIR_PATH/$PKG_FILE_NAME" -target CurrentUserHomeDirectory -dumplog -allowUntrusted -lang ja

else

  #######################################
  STR_URL="https://zoom.us/client/latest/ZoomMacOutlookPlugin.pkg?archType=x86"
  ###ファイル名を取得
  PKG_FILE_NAME=$(/usr/bin/curl -s -L -I -o /dev/null -w '%{url_effective}' "$STR_URL" | /usr/bin/rev | /usr/bin/cut -d'/' -f1 | /usr/bin/rev)
  /bin/echo "PKG_FILE_NAME" "$PKG_FILE_NAME"
  if ! /usr/bin/curl -L -o "$DOWNLOADS_DIR_PATH/$PKG_FILE_NAME" "$STR_URL" --connect-timeout 20; then
    /bin/echo "ファイルのダウンロードに失敗しました HTTP1.1をトライします"
    /usr/bin/curl -L -o "$DOWNLOADS_DIR_PATH/$PKG_FILE_NAME" "$STR_URL" --http1.1 --connect-timeout 20
  fi
  /usr/bin/killall "zoom.us" 2>/dev/null
  /usr/bin/killall "caphost" 2>/dev/null
  ###本処理 インストール
  /usr/sbin/installer -pkg "$DOWNLOADS_DIR_PATH/$PKG_FILE_NAME" -target CurrentUserHomeDirectory -dumplog -allowUntrusted -lang ja

  #######################################
  STR_URL="https://zoom.us/client/latest/Zoom.pkg?archType=x86"
  ###ファイル名を取得
  PKG_FILE_NAME=$(/usr/bin/curl -s -L -I -o /dev/null -w '%{url_effective}' "$STR_URL" | /usr/bin/rev | /usr/bin/cut -d'/' -f1 | /usr/bin/rev)
  /bin/echo "PKG_FILE_NAME" "$PKG_FILE_NAME"
  if ! /usr/bin/curl -L -o "$DOWNLOADS_DIR_PATH/$PKG_FILE_NAME" "$STR_URL" --connect-timeout 20; then
    /bin/echo "ファイルのダウンロードに失敗しました HTTP1.1をトライします"
    /usr/bin/curl -L -o "$DOWNLOADS_DIR_PATH/$PKG_FILE_NAME" "$STR_URL" --http1.1 --connect-timeout 20
  fi
  /usr/bin/killall "zoom.us" 2>/dev/null
  /usr/bin/killall "caphost" 2>/dev/null
  ###本処理 インストール
  /usr/sbin/installer -pkg "$DOWNLOADS_DIR_PATH/$PKG_FILE_NAME" -target CurrentUserHomeDirectory -dumplog -allowUntrusted -lang ja

fi


#######################################
##結果 対象のバンドルIDが無ければ
  /bin/echo "DockのポジションNO: $NUM_POSITION"
if [ "$NUM_POSITION" = "NULL" ]; then
  /bin/echo "Dockに未登録です"
  PLIST_DICT="<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>$STR_APP_PATH</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>"
  /usr/bin/defaults write com.apple.dock persistent-apps -array-add "$PLIST_DICT"
else
  ##すでに登録済みの場合は一旦削除
  /bin/echo "Dockの$NUM_POSITION に登録済み 削除してから同じ場所に登録しなおします"
  ##削除して
##/usr/libexec/PlistBuddy -c "Delete:persistent-apps:$NUM_POSITION" "$HOME/Library/Preferences/com.apple.dock.plist"
  ##保存
##/usr/libexec/PlistBuddy -c "Save" "$HOME/Library/Preferences/com.apple.dock.plist"
  ###同じ内容を作成する
##/usr/libexec/PlistBuddy -c "Revert" "$HOME/Library/Preferences/com.apple.dock.plist"
  /usr/libexec/PlistBuddy -c "add:persistent-apps:$NUM_POSITION dict" "$HOME/Library/Preferences/com.apple.dock.plist"
  /usr/libexec/PlistBuddy -c "add:persistent-apps:$NUM_POSITION:GUID integer $RANDOM$RANDOM" "$HOME/Library/Preferences/com.apple.dock.plist"
  ## 想定値 file-tile directory-tile
  /usr/libexec/PlistBuddy -c "add:persistent-apps:$NUM_POSITION:tile-type string file-tile" "$HOME/Library/Preferences/com.apple.dock.plist"
  ###↑この親Dictに子要素としてtile-dataをDictで追加
  /usr/libexec/PlistBuddy -c "add:persistent-apps:$NUM_POSITION:tile-data dict" "$HOME/Library/Preferences/com.apple.dock.plist"
  ###↑子要素のtile-dataにキーと値を入れていく
  /usr/libexec/PlistBuddy -c "add:persistent-apps:$NUM_POSITION:tile-data:showas integer 0" "$HOME/Library/Preferences/com.apple.dock.plist"
  ## 想定値 2:フォルダ 41:アプリケーション 169 Launchpad とMission Control
  /usr/libexec/PlistBuddy -c "add:persistent-apps:$NUM_POSITION:tile-data:file-type integer 41" "$HOME/Library/Preferences/com.apple.dock.plist"
  /usr/libexec/PlistBuddy -c "add:persistent-apps:$NUM_POSITION:tile-data:displayas integer 0" "$HOME/Library/Preferences/com.apple.dock.plist"
  /usr/libexec/PlistBuddy -c "add:persistent-apps:$NUM_POSITION:tile-data:parent-mod-date integer $(date '+%s')" "$HOME/Library/Preferences/com.apple.dock.plist"
  /usr/libexec/PlistBuddy -c "add:persistent-apps:$NUM_POSITION:tile-data:file-mod-date integer $(date '+%s')" "$HOME/Library/Preferences/com.apple.dock.plist"
  /usr/libexec/PlistBuddy -c "add:persistent-apps:$NUM_POSITION:tile-data:file-label string $STR_APP_NAME" "$HOME/Library/Preferences/com.apple.dock.plist"
  /usr/libexec/PlistBuddy -c "add:persistent-apps:$NUM_POSITION:tile-data:is-beta bool false" "$HOME/Library/Preferences/com.apple.dock.plist"
  ###↑この子要素のtile-dataに孫要素でfile-dataをDictで追加
  /usr/libexec/PlistBuddy -c "add:persistent-apps:$NUM_POSITION:tile-data:file-data dict" "$HOME/Library/Preferences/com.apple.dock.plist"
  ###値を入れていく
  /usr/libexec/PlistBuddy -c "add:persistent-apps:$NUM_POSITION:tile-data:file-data:_CFURLStringType integer 15" "$HOME/Library/Preferences/com.apple.dock.plist"
  /usr/libexec/PlistBuddy -c "add:persistent-apps:$NUM_POSITION:tile-data:file-data:_CFURLString string file://$STR_APP_PATH" "$HOME/Library/Preferences/com.apple.dock.plist"
  ##保存
  /usr/libexec/PlistBuddy -c "Save" "$HOME/Library/Preferences/com.apple.dock.plist"
fi
/usr/bin/killall "cfprefsd"

sleep 1
###
/bin/echo "処理終了 DOCKを再起動します"
/usr/bin/killall "Dock"

exit 0


|

pkgインストール(ユーザー権限)

だいぶ改良した

【スクリプトエディタで開く】|

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
# セルフインストールのサンプル zoom
#
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
use AppleScript version "2.8"
use framework "Foundation"
use framework "AppKit"
use scripting additions

property refMe : a reference to current application


##################################
##【1】CPUタイプのよる処理の分岐
set recordSysInfo to system info
set strCpuType to (CPU type of recordSysInfo) as text
if strCpuType contains "Intel" then
  set strPkgURL to "https://zoom.us/client/latest/Zoom.pkg?archType=arm64" as text
  log strCpuType
else if strCpuType contains "ARM" then
  set strPkgURL to "https://zoom.us/client/latest/Zoom.pkg?archType=arm64" as text
  log strCpuType
else
return "不明なCUP処理終了"
end if

##################################
##【2】ダウンロード 
##起動時に削除する項目
set appFileManager to refMe's NSFileManager's defaultManager()
set ocidTempDirURL to appFileManager's temporaryDirectory()
##フォルダ名はUUIDを使う
set ocidConcreteUUID to refMe's NSUUID's UUID()
set ocidUUIDString to ocidConcreteUUID's UUIDString()
set ocidTempDirPathURL to ocidTempDirURL's URLByAppendingPathComponent:(ocidUUIDString) isDirectory:true
##フォルダを777アクセス権で作成
set ocidAttrDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
ocidAttrDict's setValue:(511) forKey:(refMe's NSFilePosixPermissions)
set boolDone to appFileManager's createDirectoryAtURL:(ocidTempDirPathURL) withIntermediateDirectories:(true) attributes:(ocidAttrDict) |error|:(reference)
log boolDone
set strTempDirPath to (ocidTempDirPathURL's |path|()) as text
##ファイル名を取得
try
  set strCommandText to ("/usr/bin/curl -s -L -I -o /dev/null -w '%{url_effective}' \"" & strPkgURL & "\" | /usr/bin/rev | /usr/bin/cut -d'/' -f1 | /usr/bin/rev") as text
  set strSaveFileName to (do shell script strCommandText) as text
on error
  try
    set strCommandText to ("/usr/bin/curl -s -L -I -o /dev/null -w '%{url_effective}' \"" & strPkgURL & "\" --http1.1 --connect-timeout 20 | /usr/bin/rev | /usr/bin/cut -d'/' -f1 | /usr/bin/rev") as text
    set strSaveFileName to (do shell script strCommandText) as text
  on error
    set strSaveFileName to "install.pkg"
  end try
end try
##ダウンロード
try
  set strCommandText to "/usr/bin/curl -L -o \"" & strTempDirPath & "/" & strSaveFileName & "\"  \"" & strPkgURL & "\" --connect-timeout 20" as text
  do shell script strCommandText
on error
  try
    set strCommandText to "/usr/bin/curl -L -o \"" & strTempDirPath & "/" & strSaveFileName & "\"  \"" & strPkgURL & "\" --http1.1 --connect-timeout 20" as text
    do shell script strCommandText
  on error
return "インストーラーのダウンロードに失敗しました"
  end try
end try


##################################
##【3】インストール前準備
###Dockのポジションを記憶 "/Library/Managed Preferences" は考慮しない
set strFilePath to "~/Library/Preferences/com.apple.dock.plist" as text
set ocidFilePathStr to refMe's NSString's stringWithString:(strFilePath)
set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
set ocidFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidFilePath) isDirectory:false)
set ocidPlistDict to refMe's NSMutableDictionary's alloc()'s initWithContentsOfURL:(ocidFilePathURL)
set ocidPerAppsArray to ocidPlistDict's objectForKey:("persistent-apps")
set intArrayNo to (count of ocidPerAppsArray) as integer
set intCntNo to 0 as integer
repeat with itemerAppsArray in ocidPerAppsArray
  set ocidTitleDataDict to (itemerAppsArray's objectForKey:("tile-data"))
  set ocidFileDataDict to (ocidTitleDataDict's objectForKey:("file-data"))
  set ocidCFURLString to (ocidFileDataDict's valueForKey:("_CFURLString"))
  if (ocidCFURLString as text) contains ("zoom.us.app") then
    exit repeat
  end if
  set intCntNo to intCntNo + 1 as integer
end repeat
if intArrayNo = intCntNo then
  set intDocNo to (intArrayNo) as integer
  log "Dockに登録されていません。一番下を指定します"
else
  set intDocNo to (intCntNo) as integer
  log "Dockの " & intCntNo & "番目に登録されています"
end if

###アプリケーション終了
set listUTI to {"us.zoom.caphost", "us.zoom.xos", "us.zoom.CptHost", "us.zoom.Transcode", "us.zoom.ZMScreenshot"} as list
###通常終了
repeat with itemUTI in listUTI
  ###NSRunningApplication
  set ocidRunningApplication to refMe's NSRunningApplication
  ###起動中のすべてのリスト
  set ocidAppArray to (ocidRunningApplication's runningApplicationsWithBundleIdentifier:(itemUTI))
  ###複数起動時も順番に終了
  repeat with itemAppArray in ocidAppArray
itemAppArray's terminate()
  end repeat
end repeat
delay 2
###強制終了
repeat with itemUTI in listUTI
  ###NSRunningApplication
  set ocidRunningApplication to refMe's NSRunningApplication
  ###起動中のすべてのリスト
  set ocidAppArray to (ocidRunningApplication's runningApplicationsWithBundleIdentifier:(itemUTI))
  ###複数起動時も順番に終了
  repeat with itemAppArray in ocidAppArray
itemAppArray's forceTerminate()
  end repeat
end repeat
###ユーザーアプリケーションディレクトリ700で
set ocidURLsPathArray to (appFileManager's URLsForDirectory:(refMe's NSApplicationDirectory) inDomains:(refMe's NSUserDomainMask))
set ocidAppDirPathURL to ocidURLsPathArray's firstObject()
set ocidAttrDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
ocidAttrDict's setValue:(448) forKey:(refMe's NSFilePosixPermissions)
set boolDone to appFileManager's createDirectoryAtURL:(ocidAppDirPathURL) withIntermediateDirectories:(true) attributes:(ocidAttrDict) |error|:(reference)
###ローカライズファイル
set ocidLocalizedPathURL to ocidAppDirPathURL's URLByAppendingPathComponent:(".localized")
set ocidLocalizedPath to ocidLocalizedPathURL's |path|()
set boolDone to appFileManager's createFileAtPath:(ocidLocalizedPath) |contents|:(missing value) attributes:(ocidAttrDict)
###ゴミ箱
set ocidURLsPathArray to (appFileManager's URLsForDirectory:(refMe's NSTrashDirectory) inDomains:(refMe's NSUserDomainMask))
set ocidTrashDirPathURL to ocidURLsPathArray's firstObject()

################################################
###クリーニング
################################################
to doGoToTrash(arg_strFilePath)
  set strFilePath to arg_strFilePath as text
  set ocidFilePathStr to refMe's NSString's stringWithString:(strFilePath)
  set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
  set ocidFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidFilePath))
  set appFileManager to refMe's NSFileManager's defaultManager()
  set boolDone to appFileManager's trashItemAtURL:(ocidFilePathURL) resultingItemURL:(ocidFilePathURL) |error|:(reference)
end doGoToTrash

doGoToTrash("/Applications/zoom.us.app")
doGoToTrash("/Applications/ZoomOutlookPlugin")
doGoToTrash("~/Applications/zoom.us.app")
delay 1 --> Dockからの削除待ち
doGoToTrash("~/Applications/ZoomOutlookPlugin")
doGoToTrash("~/Library/Caches/us.zoom.xos")
doGoToTrash("~/Library/WebKit/us.zoom.xos")
doGoToTrash("~/Library/Saved Application State/us.zoom.xos.savedState")
doGoToTrash("~/Library/Receipts/ZoomMacOutlookPlugin.pkg.plist")
doGoToTrash("~/Library/Receipts/ZoomMacOutlookPlugin.pkg.bom")
doGoToTrash("~/Library/Logs/ZoomPhone")
doGoToTrash("~/Library/Logs/zoom.us")
doGoToTrash("~/Library/HTTPStorages/us.zoom.xos.binarycookies")
doGoToTrash("~/Library/HTTPStorages/us.zoom.xos")

delay 1 --> Dockからの削除待ち

##################################
##【4】インストール本処理(ユーザーインストール)
###パッケージがあるか?確認
set strPkgPath to ("" & strTempDirPath & "/" & strSaveFileName & "") as text
set ocidFilePathStr to refMe's NSString's stringWithString:(strFilePath)
set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
set boolFileExist to appFileManager's fileExistsAtPath:(ocidFilePath) isDirectory:(false)
if boolFileExist = true then
  set strCommandText to "/usr/sbin/installer -pkg \"" & strTempDirPath & "/" & strSaveFileName & "\" -target CurrentUserHomeDirectory -dumplog -allowUntrusted -lang ja" as text
  do shell script strCommandText
else
return "パッケージが見つかりません"
end if


##################################
##【5】後処理
##
###ユーザーインストールした場合のURL
set strAppPath to "~/Applications/zoom.us.app" as text
set ocidAppPathstr to refMe's NSString's stringWithString:(strAppPath)
set ocidAppPath to ocidAppPathstr's stringByStandardizingPath()
set ocidAppPathURL to refMe's NSURL's alloc()'s initFileURLWithPath:(ocidAppPath) isDirectory:true
set coidAbsoluteStringPath to ocidAppPathURL's absoluteString()

################################
###PLIST 読み込み
set strFilePath to "~/Library/Preferences/com.apple.dock.plist" as text
set ocidFilePathStr to refMe's NSString's stringWithString:(strFilePath)
set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
set ocidPlistPathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidFilePath) isDirectory:false)
set ocidPlistDict to refMe's NSMutableDictionary's alloc()'s initWithContentsOfURL:(ocidPlistPathURL)
set ocidPersistentArray to ocidPlistDict's objectForKey:"persistent-apps"

################################
####persistent-appsデータ生成
set ocidAddDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
###GUID実際はランダム番号だがNSFileSystemFileNumberを使う
set listPathAttar to appFileManager's attributesOfItemAtPath:(ocidAppPath) |error|:(reference)
set ocidAttar to item 1 of listPathAttar
set numGUID to ocidAttar's valueForKey:(refMe's NSFileSystemFileNumber)
set ocidIntValue to (refMe's NSNumber's numberWithInteger:(numGUID))
ocidAddDict's setValue:(numGUID) forKey:("GUID")
###
set ocidStringValue to (refMe's NSString's stringWithString:("file-tile"))
ocidAddDict's setValue:(ocidStringValue) forKey:("tile-type")
################################
set ocidAddTitleDataDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
####dock-extra
set ocidBoolValue to (refMe's NSNumber's numberWithBool:false)
ocidAddTitleDataDict's setValue:(ocidBoolValue) forKey:("dock-extra")
####dock-extra
set ocidBoolValue to (refMe's NSNumber's numberWithBool:false)
ocidAddTitleDataDict's setValue:(ocidBoolValue) forKey:("is-beta")
####bundle-identifier
set ocidAppBundle to (refMe's NSBundle's bundleWithURL:(ocidAppPathURL))
set ocidBundleID to ocidAppBundle's bundleIdentifier
set ocidStringValue to ocidBundleID's UTF8String()
ocidAddTitleDataDict's setValue:(ocidStringValue) forKey:("bundle-identifier")
####file-label"
set listAttributesDict to ocidAppPathURL's resourceValuesForKeys:({refMe's NSURLLocalizedNameKey}) |error|:(reference)
set ocidAttributesDict to (item 1 of listAttributesDict)
set ocidLocalizedName to (ocidAttributesDict's objectForKey:(refMe's NSURLLocalizedNameKey))
set ocidFileLabel to (ocidLocalizedName's stringByDeletingPathExtension())
set ocidStringValue to ocidFileLabel's UTF8String()
ocidAddTitleDataDict's setValue:(ocidStringValue) forKey:("file-label")
####file-mod-date
set listAttributesDict to ocidAppPathURL's resourceValuesForKeys:({refMe's NSURLContentModificationDateKey}) |error|:(reference)
set ocidAttributesDict to (item 1 of listAttributesDict)
set ocidModificationDate to (ocidAttributesDict's objectForKey:(refMe's NSURLContentModificationDateKey))
set ocidModDate to ocidModificationDate's timeIntervalSince1970
set ocidIntValue to ocidModDate's intValue()
ocidAddTitleDataDict's setValue:(ocidIntValue) forKey:("file-mod-date")
####parent-mod-date
set ocidNow to refMe's NSDate's now
set ocidNowNo to ocidNow's timeIntervalSince1970
set ocidIntValue to ocidNowNo's intValue
ocidAddTitleDataDict's setValue:(ocidIntValue) forKey:("parent-mod-date")
####book
set listBookMarkData to (ocidAppPathURL's bookmarkDataWithOptions:(11) includingResourceValuesForKeys:({missing value}) relativeToURL:(missing value) |error|:(reference))
set ocidkDataValue to item 1 of listBookMarkData
(ocidAddTitleDataDict's setObject:(ocidkDataValue) forKey:("book"))
####file-type
# 169 Launchpad とMission Control
# 41 それ以外はまぁ41で間違いなさそう
set ocidIntValue to (refMe's NSNumber's numberWithInteger:41)
(ocidAddTitleDataDict's setValue:(ocidIntValue) forKey:("file-type"))
#########
set ocidAddFileDataDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
(ocidAddFileDataDict's setValue:(coidAbsoluteStringPath) forKey:("_CFURLString"))
####
# 0 /File/Path
# 15 file:// のURL形式
set ocidIntValue to (refMe's NSNumber's numberWithInteger:15)
(ocidAddFileDataDict's setValue:(ocidIntValue) forKey:("_CFURLStringType"))
#########
(ocidAddTitleDataDict's setObject:(ocidAddFileDataDict) forKey:("file-data"))
ocidAddDict's setObject:(ocidAddTitleDataDict) forKey:("tile-data")
####追加データを元のPLISTに戻す
ocidPersistentArray's insertObject:(ocidAddDict) atIndex:(intDocNo)
####保存
set boolDone to ocidPlistDict's writeToURL:(ocidPlistPathURL) atomically:true


###CFPreferencesを再起動
try
  set strCommandText to "/usr/bin/killall cfprefsd" as text
  do shell script strCommandText
on error
  set strPlistPath to "/System/Library/LaunchAgents/com.apple.cfprefsd.xpc.agent.plist"
  set strCommandText to ("/bin/launchctl stop -w \"" & strAgentPath & "\"")
  try
    do shell script strCommandText
  end try
  set strCommandText to ("/bin/launchctl start -w \"" & strAgentPath & "\"")
  try
    do shell script strCommandText
  end try
end try

########################
## Dock 再起動
########################

set strBundleID to "com.apple.dock"

########################
## 再起動
########################
set appSharedWorkspace to refMe's NSWorkspace's sharedWorkspace()
##バンドルからアプリケーションのURLを取得
set ocidAppBundle to (refMe's NSBundle's bundleWithIdentifier:(strBundleID))
if ocidAppBundle ≠ (missing value) then
  set ocidAppPathURL to ocidAppBundle's bundleURL()
else if ocidAppBundle = (missing value) then
  set ocidAppPathURL to (appSharedWorkspace's URLForApplicationWithBundleIdentifier:(strBundleID))
end if
##予備(アプリケーションのURL)
if ocidAppPathURL = (missing value) then
  tell application "Finder"
    try
      set aliasAppApth to (application file id strBundleID) as alias
      set strAppPath to POSIX path of aliasAppApth as text
      set strAppPathStr to refMe's NSString's stringWithString:(strAppPath)
      set strAppPath to strAppPathStr's stringByStandardizingPath()
      set ocidAppPathURL to refMe's NSURL's alloc()'s initFileURLWithPath:(strAppPath) isDirectory:true
    on error
return "アプリケーションが見つかりませんでした"
    end try
  end tell
end if
##Dock終了
set ocidRunningApplication to refMe's NSRunningApplication
###起動中のすべてのリスト
set ocidAppArray to (ocidRunningApplication's runningApplicationsWithBundleIdentifier:(strBundleID))
###複数起動時も順番に終了
repeat with itemAppArray in ocidAppArray
  ###終了
itemAppArray's terminate()
end repeat
##1秒まって終了を確認
delay 1
##終了できない場合は強制終了
repeat with itemAppArray in ocidAppArray
  set boolTerminate to itemAppArray's terminated
  if boolTerminate = false then
itemAppArray's forceTerminate()
  end if
end repeat

###起動
set ocidOpenConfig to refMe's NSWorkspaceOpenConfiguration's configuration
###コンフィグ
(ocidOpenConfig's setActivates:(refMe's NSNumber's numberWithBool:true))
###起動
(appSharedWorkspace's openApplicationAtURL:(ocidAppPathURL) configuration:(ocidOpenConfig) completionHandler:(missing value))

return "再起動"

|

[bash]zoomクライアントアプリ・ユーザーインストール(ログインユーザーのみ)


【スクリプトエディタで開く】|

#!/bin/bash
#com.cocolog-nifty.quicktimer.icefloe
########################

########################################
##ユーザー
USER_WHOAMI=$(/usr/bin/whoami)
/bin/echo "実行したユーザーは:$USER_WHOAMI"

CURRENT_USER=$(/bin/echo "$HOME" | /usr/bin/awk -F'/' '{print $NF}')
/bin/echo "実行ユーザー:" "$CURRENT_USER"

USER_TEMP_DIR=$(/usr/bin/mktemp -d)
/bin/echo "起動時に削除されるディレクトリ:" "$USER_TEMP_DIR"

########################################
#起動ディスクの名前を取得する
/usr/bin/touch "$USER_TEMP_DIR/diskutil.plist"

/usr/sbin/diskutil info -plist / >"$USER_TEMP_DIR/diskutil.plist"
STARTUPDISK_NAME=$(/usr/bin/defaults read "$USER_TEMP_DIR/diskutil.plist" VolumeName)
/bin/echo "ボリューム名:" "$STARTUPDISK_NAME"

/bin/mkdir -p "$HOME/Applications"
/bin/chmod 700 "$HOME/Applications"
/usr/sbin/chown "$CURRENT_USER" "$HOME/Applications"
/usr/bin/touch "$HOME/Applications/.localized"

/bin/mkdir -p "$HOME/Applications/Utilities"
/bin/chmod 755 "$HOME/Applications/Utilities"
/usr/sbin/chown "$SUDO_USER" "$HOME/Applications/Utilities"
/usr/bin/touch "$HOME/Applications/Utilities/.localized"

/usr/bin/chflags nohidden "$HOME/Library"
/usr/bin/SetFile -a v "$HOME/Library"

#####ダウンロードディレクトリ
DOWNLOADS_DIR_PATH=$(/usr/bin/mktemp -d)
/bin/chmod 777 "$DOWNLOADS_DIR_PATH"
/bin/echo "ダウンロードディレクトリ:" "$DOWNLOADS_DIR_PATH"

#####本処理 ダウンロード

ARCHITEC=$(/usr/bin/arch)
/bin/echo "Running on $ARCHITEC"
if [ "$ARCHITEC" == "arm64" ]; then

  #######################################
  STR_URL="https://zoom.us/client/latest/ZoomMacOutlookPlugin.pkg?archType=arm64"
  ###ファイル名を取得
  PKG_FILE_NAME=$(/usr/bin/curl -s -L -I -o /dev/null -w '%{url_effective}' "$STR_URL" | /usr/bin/rev | /usr/bin/cut -d'/' -f1 | /usr/bin/rev)
  /bin/echo "PKG_FILE_NAME" "$PKG_FILE_NAME"
  if ! /usr/bin/curl -L -o "$DOWNLOADS_DIR_PATH/$PKG_FILE_NAME" "$STR_URL" --connect-timeout 20; then
    /bin/echo "ファイルのダウンロードに失敗しました HTTP1.1をトライします"
    /usr/bin/curl -L -o "$DOWNLOADS_DIR_PATH/$PKG_FILE_NAME" "$STR_URL" --http1.1 --connect-timeout 20
  fi
  ###本処理 インストール
  /usr/sbin/installer -pkg "$DOWNLOADS_DIR_PATH/$PKG_FILE_NAME" -target CurrentUserHomeDirectory -dumplog -allowUntrusted -lang ja

  #######################################
  STR_URL="https://zoom.us/client/latest/Zoom.pkg?archType=arm64"
  ###ファイル名を取得
  PKG_FILE_NAME=$(/usr/bin/curl -s -L -I -o /dev/null -w '%{url_effective}' "$STR_URL" | /usr/bin/rev | /usr/bin/cut -d'/' -f1 | /usr/bin/rev)
  /bin/echo "PKG_FILE_NAME" "$PKG_FILE_NAME"
  if ! /usr/bin/curl -L -o "$DOWNLOADS_DIR_PATH/$PKG_FILE_NAME" "$STR_URL" --connect-timeout 20; then
    /bin/echo "ファイルのダウンロードに失敗しました HTTP1.1をトライします"
    /usr/bin/curl -L -o "$DOWNLOADS_DIR_PATH/$PKG_FILE_NAME" "$STR_URL" --http1.1 --connect-timeout 20
  fi
  ###本処理 インストール
  /usr/sbin/installer -pkg "$DOWNLOADS_DIR_PATH/$PKG_FILE_NAME" -target CurrentUserHomeDirectory -dumplog -allowUntrusted -lang ja

else

  #######################################
  STR_URL="https://zoom.us/client/latest/ZoomMacOutlookPlugin.pkg?archType=x86"
  ###ファイル名を取得
  PKG_FILE_NAME=$(/usr/bin/curl -s -L -I -o /dev/null -w '%{url_effective}' "$STR_URL" | /usr/bin/rev | /usr/bin/cut -d'/' -f1 | /usr/bin/rev)
  /bin/echo "PKG_FILE_NAME" "$PKG_FILE_NAME"
  if ! /usr/bin/curl -L -o "$DOWNLOADS_DIR_PATH/$PKG_FILE_NAME" "$STR_URL" --connect-timeout 20; then
    /bin/echo "ファイルのダウンロードに失敗しました HTTP1.1をトライします"
    /usr/bin/curl -L -o "$DOWNLOADS_DIR_PATH/$PKG_FILE_NAME" "$STR_URL" --http1.1 --connect-timeout 20
  fi
  ###本処理 インストール
  /usr/sbin/installer -pkg "$DOWNLOADS_DIR_PATH/$PKG_FILE_NAME" -target CurrentUserHomeDirectory -dumplog -allowUntrusted -lang ja

  #######################################
  STR_URL="https://zoom.us/client/latest/Zoom.pkg?archType=x86"
  ###ファイル名を取得
  PKG_FILE_NAME=$(/usr/bin/curl -s -L -I -o /dev/null -w '%{url_effective}' "$STR_URL" | /usr/bin/rev | /usr/bin/cut -d'/' -f1 | /usr/bin/rev)
  /bin/echo "PKG_FILE_NAME" "$PKG_FILE_NAME"
  if ! /usr/bin/curl -L -o "$DOWNLOADS_DIR_PATH/$PKG_FILE_NAME" "$STR_URL" --connect-timeout 20; then
    /bin/echo "ファイルのダウンロードに失敗しました HTTP1.1をトライします"
    /usr/bin/curl -L -o "$DOWNLOADS_DIR_PATH/$PKG_FILE_NAME" "$STR_URL" --http1.1 --connect-timeout 20
  fi
  ###本処理 インストール
  /usr/sbin/installer -pkg "$DOWNLOADS_DIR_PATH/$PKG_FILE_NAME" -target CurrentUserHomeDirectory -dumplog -allowUntrusted -lang ja

fi

PLIST_DICT="<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>$HOME/Applications/zoom.us.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>"
/usr/bin/defaults write com.apple.dock persistent-apps -array-add "$PLIST_DICT"

/usr/bin/killall Dock

/bin/echo "処理終了しました"

exit 0


|

[bash]zoomユーザーインストール(クリーニング付き)修正

アプリケーションを正常終了させるように変更した

【スクリプトエディタで開く】|

#!/bin/bash
#com.cocolog-nifty.quicktimer.icefloe
########################

###管理者インストールしているか?チェック

USER_WHOAMI=$(/usr/bin/whoami)
echo "実行したユーザーは:$USER_WHOAMI"
if [ "$USER_WHOAMI" != "root" ]; then
  echo "このスクリプトを実行するには管理者権限が必要です。"
  echo "sudo で実行してください"
  exit 1
fi

#テンポラリーディレクトリ
STR_DATE=$(date '+%s')
/bin/mkdir -p /tmp/"$STR_DATE"
#起動ディスクの名前を取得する
/usr/bin/touch /tmp/"$STR_DATE"/diskutil.plist
/usr/sbin/diskutil info -plist / >/tmp/"$STR_DATE"/diskutil.plist
STARTUPDISK_NAME=$(/usr/bin/defaults read /private/tmp/"$STR_DATE"/diskutil.plist VolumeName)
echo "$STARTUPDISK_NAME"

/usr/bin/sudo -u "$SUDO_USER" /bin/mkdir -p "$HOME"/Applications
/usr/bin/sudo -u "$SUDO_USER" /bin/chmod 700 "$HOME"/Applications
/usr/bin/sudo -u "$SUDO_USER" /usr/sbin/chown "$SUDO_USER" "$HOME"/Applications
/usr/bin/touch "$HOME"/Applications/.localized

/usr/bin/sudo -u "$SUDO_USER" /bin/mkdir -p "$HOME"/Applications/Utilities
/usr/bin/sudo -u "$SUDO_USER" /bin/chmod 755 "$HOME"/Applications/Utilities
/usr/bin/sudo -u "$SUDO_USER" /usr/sbin/chown "$SUDO_USER" "$HOME"/Applications/Utilities
/usr/bin/touch "$HOME"/Applications/Utilities/.localized

/usr/bin/chflags nohidden "$HOME"/Library
/usr/bin/SetFile -a v "$HOME"/Library

/usr/bin/osascript -e "tell application id \"us.zoom.xos\" to quit"
sleep 2

/usr/bin/killall "zoom.us" 2>/dev/null
/usr/bin/killall "zoom.us Networking" 2>/dev/null
/usr/bin/killall "caphost" 2>/dev/null

#####古いファイルをゴミ箱に SUDO
function DO_MOVE_TO_TRASH_SUDO() {
  if [ -e "$1" ]; then
    TRASH_DIR=$(/usr/bin/mktemp -d "$HOME/.Trash/XXXXXXXX")
    /usr/bin/sudo /bin/mv "$1" "$TRASH_DIR"
    /usr/bin/sudo /bin/chmod 777 "$TRASH_DIR"
  fi
}

DO_MOVE_TO_TRASH_SUDO "/Applications/zoom.us.app"
DO_MOVE_TO_TRASH_SUDO "/Applications/ZoomOutlookPlugin"
DO_MOVE_TO_TRASH_SUDO "/Users/Shared/ZoomOutlookPlugin"
DO_MOVE_TO_TRASH_SUDO "/Library/Application Support/ZoomOutlookPlugin"
DO_MOVE_TO_TRASH_SUDO "/Library/PrivilegedHelperTools/us.zoom.ZoomDaemon"
DO_MOVE_TO_TRASH_SUDO "/Library/ScriptingAdditions/zOLPluginInjection.osax"
DO_MOVE_TO_TRASH_SUDO "/Library/Logs/zoomusinstall.log"
DO_MOVE_TO_TRASH_SUDO "/Library/Logs/zoomoutlookplugin.log"

#####古いファイルをゴミ箱に LaunchCtl
function DO_MOVE_TO_TRASH_LAUNCHCTL() {
  if [ -e "$1" ]; then
    /usr/bin/sudo /bin/launchctl stop -w "$1"
    /usr/bin/sudo /bin/launchctl unload -w "$1"
    TRASH_DIR=$(/usr/bin/mktemp -d "$HOME/.Trash/XXXXXXXX")
    /usr/bin/sudo /bin/mv "$1" "$TRASH_DIR"
    /usr/bin/sudo /bin/chmod 777 "$TRASH_DIR"
  fi
}

DO_MOVE_TO_TRASH_LAUNCHCTL "/Library/LaunchDaemons/us.zoom.ZoomDaemon.plist"
DO_MOVE_TO_TRASH_LAUNCHCTL "/Library/LaunchAgents/us.zoom.pluginagent.plist"

#####古いファイルをゴミ箱に  USER
function DO_MOVE_TO_TRASH() {
  if [ -e "$1" ]; then
    TRASH_DIR=$(/usr/bin/mktemp -d "$HOME/.Trash/XXXXXXXX")
    /bin/mv "$1" "$TRASH_DIR"
    /bin/chmod 777 "$TRASH_DIR"
  fi
}
#####古いファイルをゴミ箱に
DO_MOVE_TO_TRASH "$HOME/Applications/zoom.us.app"
DO_MOVE_TO_TRASH "$HOME/Applications/ZoomOutlookPlugin"
DO_MOVE_TO_TRASH "$HOME/Applications/Utilities/ZoomOutlookPlugin"
DO_MOVE_TO_TRASH "$HOME/Library/Caches/us.zoom.xos"
DO_MOVE_TO_TRASH "$HOME/Library/WebKit/us.zoom.xos"
DO_MOVE_TO_TRASH "$HOME/Library/HTTPStorages/us.zoom.xos"
DO_MOVE_TO_TRASH "$HOME/Library/HTTPStorages/us.zoom.xos.binarycookies"
DO_MOVE_TO_TRASH "$HOME/Library/Logs/zoomusinstall.log"
DO_MOVE_TO_TRASH "$HOME/Library/Logs/ZoomPhone"
DO_MOVE_TO_TRASH "$HOME/Library/Logs/zoom.us"
DO_MOVE_TO_TRASH "$HOME/Library/Receipts/us.zoom.pkg.videomeeting.bom"
DO_MOVE_TO_TRASH "$HOME/Library/Receipts/us.zoom.pkg.videomeeting.plist"
DO_MOVE_TO_TRASH "$HOME/Library/Receipts/ZoomMacOutlookPlugin.pkg.bom"
DO_MOVE_TO_TRASH "$HOME/Library/Receipts/ZoomMacOutlookPlugin.pkg.plist"

#####古いファイルをゴミ箱に LaunchCtl
function DO_MOVE_TO_TRASH_LAUNCHAGENT() {
  if [ -e "$1" ]; then
    /bin/launchctl stop -w "$1"
    /bin/launchctl unload -w "$1"
    TRASH_DIR=$(/usr/bin/mktemp -d "$HOME/.Trash/XXXXXXXX")
    /bin/mv "$1" "$TRASH_DIR"
  fi
}

DO_MOVE_TO_TRASH_LAUNCHAGENT "$HOME/Library/LaunchAgents/us.zoom.pluginagent.plist"

###############/var/folde TemporaryDirectory
MKTEMP_DIR=$(mktemp -d)
TEMP_DIR_T="$(dirname "$MKTEMP_DIR")"
#####古いファイルをゴミ箱に
GOTOTRASH_PATH="$TEMP_DIR_T/us.zoom.xos"
if [ -e "$GOTOTRASH_PATH" ]; then
  TRASH_DIR=$(/usr/bin/mktemp -d "$HOME/.Trash/XXXXXXXX")
  /bin/mv "$GOTOTRASH_PATH" "$TRASH_DIR"
fi

TEMP_DIR="$(dirname "$TEMP_DIR_T")"
TEMP_DIR_C="${TEMP_DIR}/C"

#####古いファイルをゴミ箱に
GOTOTRASH_PATH="$TEMP_DIR_C/us.zoom.xos"
if [ -e "$GOTOTRASH_PATH" ]; then
  TRASH_DIR=$(/usr/bin/mktemp -d "$HOME/.Trash/XXXXXXXX")
  /bin/mv "$GOTOTRASH_PATH" "$TRASH_DIR"
fi
GOTOTRASH_PATH="$TEMP_DIR_C/com.tonelib.zoom"
if [ -e "$GOTOTRASH_PATH" ]; then
  TRASH_DIR=$(/usr/bin/mktemp -d "$HOME/.Trash/XXXXXXXX")
  /bin/mv "$GOTOTRASH_PATH" "$TRASH_DIR"
fi

#####本処理 ダウンロード

ARCHITEC=$(/usr/bin/arch)
/bin/echo "Running on $ARCHITEC"
if [ "$ARCHITEC" == "arm64" ]; then
  /usr/bin/curl -L -o /tmp/"$STR_DATE"/Zoom.pkg 'https://zoom.us/client/latest/Zoom.pkg?archType=arm64' --connect-timeout 20
  /usr/bin/curl -L -o /tmp/"$STR_DATE"/ZoomMacOutlookPlugin.pkg 'https://zoom.us/client/latest/ZoomMacOutlookPlugin.pkg?archType=arm64' --connect-timeout 20
else
  /usr/bin/curl -L -o /tmp/"$STR_DATE"/Zoom.pkg 'https://zoom.us/client/latest/Zoom.pkg' --connect-timeout 20
  /usr/bin/curl -L -o /tmp/"$STR_DATE"/ZoomMacOutlookPlugin.pkg 'https://zoom.us/client/latest/ZoomMacOutlookPlugin.pkg' --connect-timeout 20
fi
###本処理 インストール
###実行しているユーザー名
SUDO_USER=$(echo "$HOME" | awk -F'/' '{print $NF}')
echo "$SUDO_USER"

/usr/bin/sudo -u "$SUDO_USER" /usr/sbin/installer -pkg /tmp/"$STR_DATE"/Zoom.pkg -target CurrentUserHomeDirectory -dumplog -allowUntrusted -lang ja

/usr/bin/sudo -u "$SUDO_USER" /usr/sbin/installer -pkg /tmp/"$STR_DATE"/ZoomMacOutlookPlugin.pkg -target CurrentUserHomeDirectory -dumplog -allowUntrusted -lang ja

PLIST_DICT="<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>$HOME/Applications/zoom.us.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>"
/usr/bin/sudo -u "$SUDO_USER" /usr/bin/defaults write com.apple.dock persistent-apps -array-add "$PLIST_DICT"

/usr/bin/killall Dock

echo "処理終了しました"

exit 0

|

[bash]zoomユーザーインストール(クリーニング付き)

設定は残すように変更した

ダウンロード - zoomuserinstall.zip




【スクリプトエディタで開く】

#!/bin/bash
#com.cocolog-nifty.quicktimer.icefloe
########################

###管理者インストールしているか?チェック

USER_WHOAMI=$(/usr/bin/whoami)
echo "実行したユーザーは:$USER_WHOAMI"
if [ "$USER_WHOAMI" != "root" ]; then
  echo "このスクリプトを実行するには管理者権限が必要です。"
  echo "sudo で実行してください"
  exit 1
fi

#テンポラリーディレクトリ
STR_DATE=$(date '+%s')
/bin/mkdir -p /tmp/"$STR_DATE"
#起動ディスクの名前を取得する
/usr/bin/touch /tmp/"$STR_DATE"/diskutil.plist
/usr/sbin/diskutil info -plist / >/tmp/"$STR_DATE"/diskutil.plist
STARTUPDISK_NAME=$(/usr/bin/defaults read /private/tmp/"$STR_DATE"/diskutil.plist VolumeName)
echo "$STARTUPDISK_NAME"

/usr/bin/sudo -u "$SUDO_USER" /bin/mkdir -p "$HOME"/Applications
/usr/bin/sudo -u "$SUDO_USER" /bin/chmod 700 "$HOME"/Applications
/usr/bin/sudo -u "$SUDO_USER" /usr/sbin/chown "$SUDO_USER" "$HOME"/Applications
/usr/bin/touch "$HOME"/Applications/.localized

/usr/bin/sudo -u "$SUDO_USER" /bin/mkdir -p "$HOME"/Applications/Utilities
/usr/bin/sudo -u "$SUDO_USER" /bin/chmod 755 "$HOME"/Applications/Utilities
/usr/bin/sudo -u "$SUDO_USER" /usr/sbin/chown "$SUDO_USER" "$HOME"/Applications/Utilities
/usr/bin/touch "$HOME"/Applications/Utilities/.localized

/usr/bin/chflags nohidden "$HOME"/Library
/usr/bin/SetFile -a v "$HOME"/Library

/usr/bin/killall "zoom.us" 2>/dev/null
/usr/bin/killall "zoom.us Networking" 2>/dev/null
/usr/bin/killall "caphost" 2>/dev/null

#####古いファイルをゴミ箱に SUDO
function DO_MOVE_TO_TRASH_SUDO() {
  if [ -e "$1" ]; then
    TRASH_DIR=$(/usr/bin/mktemp -d "$HOME/.Trash/XXXXXXXX")
    /usr/bin/sudo /bin/mv "$1" "$TRASH_DIR"
    /usr/bin/sudo /bin/chmod 777 "$TRASH_DIR"
  fi
}

DO_MOVE_TO_TRASH_SUDO "/Applications/zoom.us.app"
DO_MOVE_TO_TRASH_SUDO "/Applications/ZoomOutlookPlugin"
DO_MOVE_TO_TRASH_SUDO "/Users/Shared/ZoomOutlookPlugin"
DO_MOVE_TO_TRASH_SUDO "/Library/Application Support/ZoomOutlookPlugin"
DO_MOVE_TO_TRASH_SUDO "/Library/PrivilegedHelperTools/us.zoom.ZoomDaemon"
DO_MOVE_TO_TRASH_SUDO "/Library/ScriptingAdditions/zOLPluginInjection.osax"
DO_MOVE_TO_TRASH_SUDO "/Library/Logs/zoomusinstall.log"
DO_MOVE_TO_TRASH_SUDO "/Library/Logs/zoomoutlookplugin.log"

#####古いファイルをゴミ箱に LaunchCtl
function DO_MOVE_TO_TRASH_LAUNCHCTL() {
  if [ -e "$1" ]; then
    /usr/bin/sudo /bin/launchctl stop -w "$1"
    /usr/bin/sudo /bin/launchctl unload -w "$1"
    TRASH_DIR=$(/usr/bin/mktemp -d "$HOME/.Trash/XXXXXXXX")
    /usr/bin/sudo /bin/mv "$1" "$TRASH_DIR"
    /usr/bin/sudo /bin/chmod 777 "$TRASH_DIR"
  fi
}

DO_MOVE_TO_TRASH_LAUNCHCTL "/Library/LaunchDaemons/us.zoom.ZoomDaemon.plist"
DO_MOVE_TO_TRASH_LAUNCHCTL "/Library/LaunchAgents/us.zoom.pluginagent.plist"

#####古いファイルをゴミ箱に  USER
function DO_MOVE_TO_TRASH() {
  if [ -e "$1" ]; then
    TRASH_DIR=$(/usr/bin/mktemp -d "$HOME/.Trash/XXXXXXXX")
    /bin/mv "$1" "$TRASH_DIR"
    /bin/chmod 777 "$TRASH_DIR"
  fi
}
#####古いファイルをゴミ箱に
DO_MOVE_TO_TRASH "$HOME/Applications/zoom.us.app"
DO_MOVE_TO_TRASH "$HOME/Applications/ZoomOutlookPlugin"
DO_MOVE_TO_TRASH "$HOME/Applications/Utilities/ZoomOutlookPlugin"
DO_MOVE_TO_TRASH "$HOME/Library/Caches/us.zoom.xos"
DO_MOVE_TO_TRASH "$HOME/Library/WebKit/us.zoom.xos"
DO_MOVE_TO_TRASH "$HOME/Library/HTTPStorages/us.zoom.xos"
DO_MOVE_TO_TRASH "$HOME/Library/HTTPStorages/us.zoom.xos.binarycookies"
DO_MOVE_TO_TRASH "$HOME/Library/Logs/zoomusinstall.log"
DO_MOVE_TO_TRASH "$HOME/Library/Logs/ZoomPhone"
DO_MOVE_TO_TRASH "$HOME/Library/Logs/zoom.us"
DO_MOVE_TO_TRASH "$HOME/Library/Receipts/us.zoom.pkg.videomeeting.bom"
DO_MOVE_TO_TRASH "$HOME/Library/Receipts/us.zoom.pkg.videomeeting.plist"
DO_MOVE_TO_TRASH "$HOME/Library/Receipts/ZoomMacOutlookPlugin.pkg.bom"
DO_MOVE_TO_TRASH "$HOME/Library/Receipts/ZoomMacOutlookPlugin.pkg.plist"

#####古いファイルをゴミ箱に LaunchCtl
function DO_MOVE_TO_TRASH_LAUNCHAGENT() {
  if [ -e "$1" ]; then
    /bin/launchctl stop -w "$1"
    /bin/launchctl unload -w "$1"
    TRASH_DIR=$(/usr/bin/mktemp -d "$HOME/.Trash/XXXXXXXX")
    /bin/mv "$1" "$TRASH_DIR"
  fi
}

DO_MOVE_TO_TRASH_LAUNCHAGENT "$HOME/Library/LaunchAgents/us.zoom.pluginagent.plist"

###############/var/folde TemporaryDirectory
MKTEMP_DIR=$(mktemp -d)
TEMP_DIR_T="$(dirname "$MKTEMP_DIR")"
#####古いファイルをゴミ箱に
GOTOTRASH_PATH="$TEMP_DIR_T/us.zoom.xos"
if [ -e "$GOTOTRASH_PATH" ]; then
  TRASH_DIR=$(/usr/bin/mktemp -d "$HOME/.Trash/XXXXXXXX")
  /bin/mv "$GOTOTRASH_PATH" "$TRASH_DIR"
fi

TEMP_DIR="$(dirname "$TEMP_DIR_T")"
TEMP_DIR_C="${TEMP_DIR}/C"

#####古いファイルをゴミ箱に
GOTOTRASH_PATH="$TEMP_DIR_C/us.zoom.xos"
if [ -e "$GOTOTRASH_PATH" ]; then
  TRASH_DIR=$(/usr/bin/mktemp -d "$HOME/.Trash/XXXXXXXX")
  /bin/mv "$GOTOTRASH_PATH" "$TRASH_DIR"
fi
GOTOTRASH_PATH="$TEMP_DIR_C/com.tonelib.zoom"
if [ -e "$GOTOTRASH_PATH" ]; then
  TRASH_DIR=$(/usr/bin/mktemp -d "$HOME/.Trash/XXXXXXXX")
  /bin/mv "$GOTOTRASH_PATH" "$TRASH_DIR"
fi

#####本処理 ダウンロード

ARCHITEC=$(/usr/bin/arch)
/bin/echo "Running on $ARCHITEC"
if [ "$ARCHITEC" == "arm64" ]; then
  /usr/bin/curl -L -o /tmp/"$STR_DATE"/Zoom.pkg 'https://zoom.us/client/latest/Zoom.pkg?archType=arm64' --connect-timeout 20
  /usr/bin/curl -L -o /tmp/"$STR_DATE"/ZoomMacOutlookPlugin.pkg 'https://zoom.us/client/latest/ZoomMacOutlookPlugin.pkg?archType=arm64' --connect-timeout 20
else
  /usr/bin/curl -L -o /tmp/"$STR_DATE"/Zoom.pkg 'https://zoom.us/client/latest/Zoom.pkg' --connect-timeout 20
  /usr/bin/curl -L -o /tmp/"$STR_DATE"/ZoomMacOutlookPlugin.pkg 'https://zoom.us/client/latest/ZoomMacOutlookPlugin.pkg' --connect-timeout 20
fi
###本処理 インストール
###実行しているユーザー名
SUDO_USER=$(echo "$HOME" | awk -F'/' '{print $NF}')
echo "$SUDO_USER"

/usr/bin/sudo -u "$SUDO_USER" /usr/sbin/installer -pkg /tmp/"$STR_DATE"/Zoom.pkg -target CurrentUserHomeDirectory -dumplog -allowUntrusted -lang ja

/usr/bin/sudo -u "$SUDO_USER" /usr/sbin/installer -pkg /tmp/"$STR_DATE"/ZoomMacOutlookPlugin.pkg -target CurrentUserHomeDirectory -dumplog -allowUntrusted -lang ja

PLIST_DICT="<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>$HOME/Applications/zoom.us.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>"
/usr/bin/sudo -u "$SUDO_USER" /usr/bin/defaults write com.apple.dock persistent-apps -array-add "$PLIST_DICT"

/usr/bin/killall Dock

exit 0

|

[zoom]不具合発生時の再インストール用スクリプト

初期設定からキャッシュから
可能な限り、既存のファイルを削除します。
-->限りなく初期設定にもどる『はず』です。
不具合発生時以外の利用はお勧めしません。

ダウンロード - zoomuserinstall.scpt.zip



#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
# 注意!このスクリプトは初期設定等を削除する不具合発生時用です
# 通常時は利用しないでください
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
##自分環境がos12なので2.8にしているだけです
use AppleScript version "2.8"
use framework "Foundation"
use scripting additions



set theCommandText to ("date '+%Y%m%d_%H%M%S'") as text
set theDate to (do shell script theCommandText) as text
set theDate to theDate as text



set theCommandText to ("id -un") as text
set theUserName to (do shell script theCommandText) as text
set theUserName to theUserName as text

set theCommandText to ("echo $HOME") as text
set theHomeDir to (do shell script theCommandText) as text

set theCommandText to ("mkdir -p '/tmp/" & theDate & "'") as text
do shell script theCommandText

set theCommandText to ("/usr/bin/SetFile -a v $HOME/Library") as text
do shell script theCommandText

set theCommandText to ("/usr/bin/chflags nohidden $HOME/Library") as text
do shell script theCommandText

try
set theCommandText to ("killall \"zoom.us\"") as text
do shell script theCommandText

set theCommandText to ("killall \"zoom.us Networking\"") as text
do shell script theCommandText
end try

try
set theGo2TrashPath to ("/Applications/zoom.us.app") as text
tell application "Finder"
set aliasGo2TrashPath to POSIX file theGo2TrashPath as alias
move aliasGo2TrashPath to trash
end tell
end try
try
set theGo2TrashPath to ("" & theHomeDir & "/Applications/zoom.us.app") as text
tell application "Finder"
set aliasGo2TrashPath to POSIX file theGo2TrashPath as alias
move aliasGo2TrashPath to trash
end tell
end try
try
set theGo2TrashPath to ("/Applications/ZoomOutlookPlugin") as text
tell application "Finder"
set aliasGo2TrashPath to POSIX file theGo2TrashPath as alias
move aliasGo2TrashPath to trash
end tell
end try
try
set theGo2TrashPath to ("" & theHomeDir & "/Applications/ZoomOutlookPlugin") as text
tell application "Finder"
set aliasGo2TrashPath to POSIX file theGo2TrashPath as alias
move aliasGo2TrashPath to trash
end tell
end try
try
set theGo2TrashPath to ("/Users/Shared/ZoomOutlookPlugin") as text
tell application "Finder"
set aliasGo2TrashPath to POSIX file theGo2TrashPath as alias
move aliasGo2TrashPath to trash
end tell
end try
try
set theGo2TrashPath to ("" & theHomeDir & "/Applications/Utilities/ZoomOutlookPlugin") as text
tell application "Finder"
set aliasGo2TrashPath to POSIX file theGo2TrashPath as alias
move aliasGo2TrashPath to trash
end tell
end try
try
set theGo2TrashPath to ("" & theHomeDir & "/Library/Application Support/zoom.us/Plugins/zMacResRetina.bundle") as text
tell application "Finder"
set aliasGo2TrashPath to POSIX file theGo2TrashPath as alias
move aliasGo2TrashPath to trash
end tell
end try
try
set theGo2TrashPath to ("" & theHomeDir & "/Library/Application Support/zoom.us") as text
tell application "Finder"
set aliasGo2TrashPath to POSIX file theGo2TrashPath as alias
move aliasGo2TrashPath to trash
end tell
end try
try
set theGo2TrashPath to ("" & theHomeDir & "/Library/Application Support/ZoomPresence") as text
tell application "Finder"
set aliasGo2TrashPath to POSIX file theGo2TrashPath as alias
move aliasGo2TrashPath to trash
end tell
end try
try
set theGo2TrashPath to ("" & theHomeDir & "/Library/Caches/us.zoom.xos") as text
tell application "Finder"
set aliasGo2TrashPath to POSIX file theGo2TrashPath as alias
move aliasGo2TrashPath to trash
end tell
end try
try
set theGo2TrashPath to ("" & theHomeDir & "/Library/Cookies/us.zoom.xos.binarycookies") as text
tell application "Finder"
set aliasGo2TrashPath to POSIX file theGo2TrashPath as alias
move aliasGo2TrashPath to trash
end tell
end try
try
set theGo2TrashPath to ("" & theHomeDir & "/Library/HTTPStorages/us.zoom.xos.binarycookies") as text
tell application "Finder"
set aliasGo2TrashPath to POSIX file theGo2TrashPath as alias
move aliasGo2TrashPath to trash
end tell
end try
try
set theGo2TrashPath to ("" & theHomeDir & "/Library/HTTPStorages/us.zoom.xos") as text
tell application "Finder"
set aliasGo2TrashPath to POSIX file theGo2TrashPath as alias
move aliasGo2TrashPath to trash
end tell
end try
try
set theGo2TrashPath to ("" & theHomeDir & "/Library/Preferences/us.zoom.Transcode.plist") as text
tell application "Finder"
set aliasGo2TrashPath to POSIX file theGo2TrashPath as alias
move aliasGo2TrashPath to trash
end tell
end try
try
set theGo2TrashPath to ("" & theHomeDir & "/Library/Preferences/us.zoom.xos.plist") as text
tell application "Finder"
set aliasGo2TrashPath to POSIX file theGo2TrashPath as alias
move aliasGo2TrashPath to trash
end tell
end try
try
set theGo2TrashPath to ("" & theHomeDir & "/Library/Preferences/us.zoom.ZoomPresence.plist") as text
tell application "Finder"
set aliasGo2TrashPath to POSIX file theGo2TrashPath as alias
move aliasGo2TrashPath to trash
end tell
end try
try
set theGo2TrashPath to ("" & theHomeDir & "/Library/Preferences/ZoomChat.plist") as text
tell application "Finder"
set aliasGo2TrashPath to POSIX file theGo2TrashPath as alias
move aliasGo2TrashPath to trash
end tell
end try
try
set theGo2TrashPath to ("" & theHomeDir & "/Library/Receipts/us.zoom.pkg.videmeeting.bom") as text
tell application "Finder"
set aliasGo2TrashPath to POSIX file theGo2TrashPath as alias
move aliasGo2TrashPath to trash
end tell
end try
try
set theGo2TrashPath to ("" & theHomeDir & "/Library/Receipts/us.zoom.pkg.videmeeting.plist") as text
tell application "Finder"
set aliasGo2TrashPath to POSIX file theGo2TrashPath as alias
move aliasGo2TrashPath to trash
end tell
end try
try
set theGo2TrashPath to ("" & theHomeDir & "/Library/Receipts/us.zoom.pkg.videomeeting.bom") as text
tell application "Finder"
set aliasGo2TrashPath to POSIX file theGo2TrashPath as alias
move aliasGo2TrashPath to trash
end tell
end try
try
set theGo2TrashPath to ("" & theHomeDir & "/Library/Receipts/us.zoom.pkg.videomeeting.plist") as text
tell application "Finder"
set aliasGo2TrashPath to POSIX file theGo2TrashPath as alias
move aliasGo2TrashPath to trash
end tell
end try
try
set theGo2TrashPath to ("" & theHomeDir & "/Library/Saved Application State/us.zoom.xos.savedState") as text
tell application "Finder"
set aliasGo2TrashPath to POSIX file theGo2TrashPath as alias
move aliasGo2TrashPath to trash
end tell
end try
try
set theGo2TrashPath to ("" & theHomeDir & "/Library/WebKit/us.zoom.xos") as text
tell application "Finder"
set aliasGo2TrashPath to POSIX file theGo2TrashPath as alias
move aliasGo2TrashPath to trash
end tell
end try
try
set theGo2TrashPath to ("" & theHomeDir & "/Applications/ZoomOutlookPlugin") as text
tell application "Finder"
set aliasGo2TrashPath to POSIX file theGo2TrashPath as alias
move aliasGo2TrashPath to trash
end tell
end try
try
set theGo2TrashPath to ("" & theHomeDir & "/Applications/Utilities/ZoomOutlookPlugin") as text
tell application "Finder"
set aliasGo2TrashPath to POSIX file theGo2TrashPath as alias
move aliasGo2TrashPath to trash
end tell
end try
try
set theGo2TrashPath to ("" & theHomeDir & "/Library/Logs/zoomusinstall.log") as text
tell application "Finder"
set aliasGo2TrashPath to POSIX file theGo2TrashPath as alias
move aliasGo2TrashPath to trash
end tell
end try
try
set theGo2TrashPath to ("" & theHomeDir & "/Library/Logs/zoom.us") as text
tell application "Finder"
set aliasGo2TrashPath to POSIX file theGo2TrashPath as alias
move aliasGo2TrashPath to trash
end tell
end try
try
set theGo2TrashPath to ("" & theHomeDir & "/Library/Logs/ZoomPhone") as text
tell application "Finder"
set aliasGo2TrashPath to POSIX file theGo2TrashPath as alias
move aliasGo2TrashPath to trash
end tell
end try

#########
set aliasTempFolder to (path to temporary items from user domain) as alias
tell application "Finder"
set aliasTempFolderDir to (parent of (parent of aliasTempFolder)) as alias
end tell
set theTempFolderUnixPass to (POSIX path of aliasTempFolderDir) as text
try
set theGo2TrashPath to ("" & theTempFolderUnixPass & "C/us.zoom.xos") as text
tell application "Finder"
set aliasGo2TrashPath to POSIX file theGo2TrashPath as alias
move aliasGo2TrashPath to trash
end tell
end try
try
set theGo2TrashPath to ("" & theTempFolderUnixPass & "T/us.zoom.xos") as text
tell application "Finder"
set aliasGo2TrashPath to POSIX file theGo2TrashPath as alias
move aliasGo2TrashPath to trash
end tell
end try

set objSysInfo to system info
set theCpuType to (CPU type of objSysInfo) as text

if theCpuType contains "Intel" then

try
set theCommandText to ("curl -L -o /tmp/" & theDate & "/Zoom.pkg 'https://zoom.us/client/latest/Zoom.pkg' --connect-timeout 20") as text
do shell script theCommandText
end try
try
set theCommandText to ("curl -L -o /tmp/" & theDate & "/ZoomMacOutlookPlugin.pkg 'https://zoom.us/client/latest/ZoomMacOutlookPlugin.pkg' --connect-timeout 20") as text
do shell script theCommandText
end try
else

try
set theCommandText to ("curl -L -o /tmp/" & theDate & "/Zoom.pkg 'https://zoom.us/client/latest/Zoom.pkg?archType=arm64' --connect-timeout 20") as text
do shell script theCommandText
try
set theCommandText to ("curl -L -o /tmp/" & theDate & "/ZoomMacOutlookPlugin.pkg 'https://zoom.us/client/latest/ZoomMacOutlookPlugin.pkg?archType=arm64' --connect-timeout 20") as text
do shell script theCommandText
end try
end try
end if
############################################################
############################################################
############################################################

set theCommandText to "date +%s"
set theSqlDateNo to (do shell script theCommandText) as text

try
set theCommandText to ("/usr/bin/tccutil reset All us.zoom.xos") as text
do shell script theCommandText
end try

try
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"SELECT * FROM access\" | grep us.zoom.xos") as text
set theSqlSelect to (do shell script theCommandText) as text
end try

if theSqlSelect contains "kTCCServiceSystemPolicyAllFiles" then
try
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"REPLACE INTO access VALUES('kTCCServiceSystemPolicyAllFiles','us.zoom.xos',0,2,4,1, NULL, NULL,0,'UNUSED', NULL,0," & theSqlDateNo & ");\"") as text
do shell script theCommandText
end try
else
try
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"INSERT INTO access VALUES('kTCCServiceSystemPolicyAllFiles','us.zoom.xos',0,2,4,1, NULL, NULL,0,'UNUSED', NULL,0," & theSqlDateNo & ");\"") as text
do shell script theCommandText
end try
end if

delay 1
try
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"INSERT INTO access VALUES('kTCCServiceScreenCapture','us.zoom.xos',0,2,4,1, NULL, NULL,0,'UNUSED', NULL,0," & theSqlDateNo & ");\"") as text
do shell script theCommandText
on error
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"REPLACE INTO access VALUES('kTCCServiceScreenCapture','us.zoom.xos',0,2,4,1, NULL, NULL,0,'UNUSED', NULL,0," & theSqlDateNo & ");\"") as text
do shell script theCommandText
end try
delay 1
try
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"INSERT INTO access VALUES('kTCCServiceAccessibility','us.zoom.xos',0,2,4,1, NULL, NULL,0,'UNUSED', NULL,0," & theSqlDateNo & ");\"") as text
do shell script theCommandText
on error
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"REPLACE INTO access VALUES('kTCCServiceAccessibility','us.zoom.xos',0,2,4,1, NULL, NULL,0,'UNUSED', NULL,0," & theSqlDateNo & ");\"") as text
do shell script theCommandText
end try
delay 1
try
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"INSERT INTO access VALUES('kTCCServiceCamera','us.zoom.xos',0,2,4,1, NULL, NULL,0,'UNUSED', NULL,0," & theSqlDateNo & ");\"") as text
do shell script theCommandText
on error
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"REPLACE INTO access VALUES('kTCCServiceCamera','us.zoom.xos',0,2,4,1, NULL, NULL,0,'UNUSED', NULL,0," & theSqlDateNo & ");\"") as text
do shell script theCommandText
end try
delay 1
try
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"INSERT INTO access VALUES('kTCCServiceMicrophone','us.zoom.xos',0,2,4,1, NULL, NULL,0,'UNUSED', NULL,0," & theSqlDateNo & ");\"") as text
do shell script theCommandText
on error
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"REPLACE INTO access VALUES('kTCCServiceMicrophone','us.zoom.xos',0,2,4,1, NULL, NULL,0,'UNUSED', NULL,0," & theSqlDateNo & ");\"") as text
do shell script theCommandText
end try
delay 1
try
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"INSERT INTO access VALUES('kTCCServiceAddressBook','us.zoom.xos',0,2,4,1, NULL, NULL,0,'UNUSED', NULL,0," & theSqlDateNo & ");\"") as text
do shell script theCommandText
on error
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"REPLACE INTO access VALUES('kTCCServiceAddressBook','us.zoom.xos',0,2,4,1, NULL, NULL,0,'UNUSED', NULL,0," & theSqlDateNo & ");\"") as text
do shell script theCommandText
end try
delay 1
try
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"INSERT INTO access VALUES('kTCCServiceCalendar','us.zoom.xos',0,2,4,1, NULL, NULL,0,'UNUSED', NULL,0," & theSqlDateNo & ");\"") as text
do shell script theCommandText
on error
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"REPLACE INTO access VALUES('kTCCServiceCalendar','us.zoom.xos',0,2,4,1, NULL, NULL,0,'UNUSED', NULL,0," & theSqlDateNo & ");\"") as text
do shell script theCommandText
end try
delay 1
try
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"INSERT INTO access VALUES('kTCCServiceBluetoothAlways','us.zoom.xos',0,2,4,1, NULL, NULL,0,'UNUSED', NULL,0," & theSqlDateNo & ");\"") as text
do shell script theCommandText
on error
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"REPLACE INTO access VALUES('kTCCServiceBluetoothAlways','us.zoom.xos',0,2,4,1, NULL, NULL,0,'UNUSED', NULL,0," & theSqlDateNo & ");\"") as text
do shell script theCommandText
end try
delay 1
try
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"INSERT INTO access VALUES('kTCCServiceFileProviderDomain','us.zoom.xos',0,2,4,1, NULL, NULL,0,'UNUSED', NULL,0," & theSqlDateNo & ");\"") as text
do shell script theCommandText
on error
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"REPLACE INTO access VALUES('kTCCServiceFileProviderDomain','us.zoom.xos',0,2,4,1, NULL, NULL,0,'UNUSED', NULL,0," & theSqlDateNo & ");\"") as text
do shell script theCommandText
end try
delay 1
try
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"INSERT INTO access VALUES('kTCCServiceSpeechRecognition','us.zoom.xos',0,2,4,1, NULL, NULL,0,'UNUSED', NULL,0," & theSqlDateNo & ");\"") as text
do shell script theCommandText
on error
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"REPLACE INTO access VALUES('kTCCServiceSpeechRecognition','us.zoom.xos',0,2,4,1, NULL, NULL,0,'UNUSED', NULL,0," & theSqlDateNo & ");\"") as text
do shell script theCommandText
end try
delay 1
try
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"INSERT INTO access VALUES('kTCCServiceListenEvent','us.zoom.xos',0,2,4,1, NULL, NULL,0,'UNUSED', NULL,0," & theSqlDateNo & ");\"") as text
do shell script theCommandText
on error
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"REPLACE INTO access VALUES('kTCCServiceListenEvent','us.zoom.xos',0,2,4,1, NULL, NULL,0,'UNUSED', NULL,0," & theSqlDateNo & ");\"") as text
do shell script theCommandText
end try
delay 1
try
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"INSERT INTO access VALUES('kTCCServiceUbiquity','us.zoom.xos',0,2,4,1, NULL, NULL,0,'UNUSED', NULL,0," & theSqlDateNo & ");\"") as text
do shell script theCommandText
on error
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"REPLACE INTO access VALUES('kTCCServiceUbiquity','us.zoom.xos',0,2,4,1, NULL, NULL,0,'UNUSED', NULL,0," & theSqlDateNo & ");\"") as text
do shell script theCommandText
end try
delay 1
try
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"INSERT INTO access VALUES('kTCCServicePhotos','us.zoom.xos',0,2,4,1, NULL, NULL,0,'UNUSED', NULL,0," & theSqlDateNo & ");\"") as text
do shell script theCommandText
on error
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"REPLACE INTO access VALUES('kTCCServicePhotos','us.zoom.xos',0,2,4,1, NULL, NULL,0,'UNUSED', NULL,0," & theSqlDateNo & ");\"") as text
do shell script theCommandText
end try
delay 1
try
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"INSERT INTO access VALUES('kTCCServicePhotosAdd','us.zoom.xos',0,2,4,1, NULL, NULL,0,'UNUSED', NULL,0," & theSqlDateNo & ");\"") as text
do shell script theCommandText
on error
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"REPLACE INTO access VALUES('kTCCServicePhotosAdd','us.zoom.xos',0,2,4,1, NULL, NULL,0,'UNUSED', NULL,0," & theSqlDateNo & ");\"") as text
do shell script theCommandText
end try
delay 1
try
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"INSERT INTO access VALUES('kTCCServiceUbiquity','us.zoom.xos',0,2,4,1, NULL, NULL,0,'UNUSED', NULL,0," & theSqlDateNo & ");\"") as text
do shell script theCommandText
on error
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"REPLACE INTO access VALUES('kTCCServiceUbiquity','us.zoom.xos',0,2,4,1, NULL, NULL,0,'UNUSED', NULL,0," & theSqlDateNo & ");\"") as text
do shell script theCommandText
end try
delay 1
try
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"INSERT INTO access VALUES('kTCCServiceAppleEvents','us.zoom.xos',0,2,4,1, NULL, NULL,0,'UNUSED', NULL,0," & theSqlDateNo & ");\"") as text
do shell script theCommandText
on error
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"REPLACE INTO access VALUES('kTCCServiceAppleEvents','us.zoom.xos',0,2,4,1, NULL, NULL,0,'UNUSED', NULL,0," & theSqlDateNo & ");\"") as text
do shell script theCommandText
end try
delay 1
try
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"INSERT INTO access VALUES('kTCCServiceSystemPolicyDesktopFolder','us.zoom.xos',0,2,4,1, NULL, NULL,0,'UNUSED', NULL,0," & theSqlDateNo & ");\"") as text
do shell script theCommandText
on error
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"REPLACE INTO access VALUES('kTCCServiceSystemPolicyDesktopFolder','us.zoom.xos',0,2,4,1, NULL, NULL,0,'UNUSED', NULL,0," & theSqlDateNo & ");\"") as text
do shell script theCommandText
end try
delay 1
try
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"INSERT INTO access VALUES('kTCCServiceSystemPolicyDocumentsFolder','us.zoom.xos',0,2,4,1, NULL, NULL,0,'UNUSED', NULL,0," & theSqlDateNo & ");\"") as text
do shell script theCommandText
on error
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"REPLACE INTO access VALUES('kTCCServiceSystemPolicyDocumentsFolder','us.zoom.xos',0,2,4,1, NULL, NULL,0,'UNUSED', NULL,0," & theSqlDateNo & ");\"") as text
do shell script theCommandText
end try
delay 1
try
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"INSERT INTO access VALUES('kTCCServiceLiverpool','us.zoom.xos',0,2,4,1, NULL, NULL,0,'UNUSED', NULL,0," & theSqlDateNo & ");\"") as text
do shell script theCommandText
on error
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"REPLACE INTO access VALUES('kTCCServiceLiverpool','us.zoom.xos',0,2,4,1, NULL, NULL,0,'UNUSED', NULL,0," & theSqlDateNo & ");\"") as text
do shell script theCommandText
end try
delay 1
try
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"INSERT INTO access VALUES('kTCCServiceFocusStatus','us.zoom.xos',0,2,4,1, NULL, NULL,0,'UNUSED', NULL,0," & theSqlDateNo & ");\"") as text
do shell script theCommandText
on error
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"REPLACE INTO access VALUES('kTCCServiceFocusStatus','us.zoom.xos',0,2,4,1, NULL, NULL,0,'UNUSED', NULL,0," & theSqlDateNo & ");\"") as text
do shell script theCommandText
end try
delay 1
try
set theCommandText to ("/usr/bin/sqlite3 $HOME/Library/Application\\ Support/com.apple.TCC/TCC.db \"INSERT INTO access VALUES('kTCCServiceReminders','us.zoom.xos',0,2,4,1, NULL, NULL,0,'UNUSED', NULL,0," & theSqlDateNo</