mirror of
https://github.com/mtan93/dialog-scripts.git
synced 2026-03-08 05:31:54 +00:00
new dialogURL and expectedDialogTeamID variables
Updated variables to better avoid conflict with variables used in your scripts
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
|
||||
function dialogCheck(){
|
||||
# Get the URL of the latest PKG From the Dialog GitHub repo
|
||||
url=$(curl --silent --fail "https://api.github.com/repos/bartreardon/Dialog/releases/latest" | awk -F '"' "/browser_download_url/ && /pkg\"/ { print \$4; exit }")
|
||||
dialogURL=$(curl --silent --fail "https://api.github.com/repos/bartreardon/Dialog/releases/latest" | awk -F '"' "/browser_download_url/ && /pkg\"/ { print \$4; exit }")
|
||||
# Expected Team ID of the downloaded PKG
|
||||
expectedTeamID="PWA5E9TQ59"
|
||||
expectedDialogTeamID="PWA5E9TQ59"
|
||||
|
||||
# Check for Dialog and install if not found
|
||||
if [ ! -e "/Library/Application Support/Dialog/Dialog.app" ]; then
|
||||
@@ -13,11 +13,11 @@ function dialogCheck(){
|
||||
workDirectory=$( /usr/bin/basename "$0" )
|
||||
tempDirectory=$( /usr/bin/mktemp -d "/private/tmp/$workDirectory.XXXXXX" )
|
||||
# Download the installer package
|
||||
/usr/bin/curl --location --silent "$url" -o "$tempDirectory/Dialog.pkg"
|
||||
/usr/bin/curl --location --silent "$dialogURL" -o "$tempDirectory/Dialog.pkg"
|
||||
# Verify the download
|
||||
teamID=$(/usr/sbin/spctl -a -vv -t install "$tempDirectory/Dialog.pkg" 2>&1 | awk '/origin=/ {print $NF }' | tr -d '()')
|
||||
# Install the package if Team ID validates
|
||||
if [ "$expectedTeamID" = "$teamID" ] || [ "$expectedTeamID" = "" ]; then
|
||||
if [ "$expectedDialogTeamID" = "$teamID" ] || [ "$expectedDialogTeamID" = "" ]; then
|
||||
/usr/sbin/installer -pkg "$tempDirectory/Dialog.pkg" -target /
|
||||
else
|
||||
# displayAppleScript # uncomment this if you're using my displayAppleScript function
|
||||
|
||||
Reference in New Issue
Block a user