Created
December 12, 2019 16:26
-
-
Save krispayne/adc512c647e79259b8d1966bf3877b17 to your computer and use it in GitHub Desktop.
EA for 32bit apps
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Detect all 32-bit apps installed in /Applications, /Library | |
# or /usr/local and output list to logfile stored in /var/log. | |
runOnce="true" | |
if [[ "$runOnce" == "true" || "$runOnce" == "1" ]]; then | |
if [[ -e /usr/local/xattr/.32bitAppsInstalledCheckDone ]]; then | |
# Using runOnce cached value: | |
echo "<result>$(cat /usr/local/xattr/.32bitAppsInstalledCheckDone)</result>" | |
# Delete /usr/local/xattr/.32bitAppsInstalledCheckDone to re-query the computer | |
exit 0 | |
fi | |
fi | |
create32bitCheckDone () { | |
mkdir -p /usr/local/xattr | |
echo $1 > /usr/local/xattr/.32bitAppsInstalledCheckDone | |
} | |
appList=$(system_profiler SPApplicationsDataType | grep -A3 "64-Bit (Intel): No" | grep -E "Location:[^/]*/(Applications|Library|usr/local)/" | /usr/bin/sed -n 's/.*Location:[[:space:]]*\(.*\)/\1/p') | |
eaResult="" | |
# Get a list of all installed applications | |
# -n = string is not null | |
if [[ -n "$appList" ]]; then | |
create32bitCheckDone "$appList" | |
eaResult="$appList" | |
else | |
create32bitCheckDone "Null" | |
eaResult="No 32-bit apps installed." | |
fi | |
echo "$appList" | |
echo "<result>$eaResult</result>" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment