From 7a58e5f86a9637217a996b5dd542576bf9e499b5 Mon Sep 17 00:00:00 2001 From: Fabian Ising Date: Fri, 2 Jun 2023 14:28:50 +0200 Subject: [PATCH] Fix permission fixer --- update_mac.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/update_mac.sh b/update_mac.sh index dfbd169..cf2ac03 100755 --- a/update_mac.sh +++ b/update_mac.sh @@ -1,11 +1,18 @@ #!/bin/bash +ARCH=`uname -m` +if [[ $ARCH == "arm64" ]]; then + PREFIX="/opt/homebrew/" +else + PREFIX="/usr/local" +fi + function set_permissions { echo "----------" echo "Disabling Quarantine for Casks ..." echo "----------" - find /usr/local/Caskroom -name *.app -exec bash -c "xattr -d com.apple.quarantine {} 2> /dev/null" \; - find /usr/local/Caskroom -type f -perm +111 -exec bash -c "xattr -d com.apple.quarantine {} 2> /dev/null" \; + find $PREFIX/Caskroom -name *.app -exec bash -c "xattr -d com.apple.quarantine {} 2> /dev/null" \; + find $PREFIX/Caskroom -type f -perm +111 -exec bash -c "xattr -d com.apple.quarantine {} 2> /dev/null" \; find /Applications/ -name *.app -exec bash -c 'xattr -d com.apple.quarantine "{}" 2> /dev/null' \; find /Applications/ -type f -perm +111 -exec bash -c 'xattr -d com.apple.quarantine "{}" 2> /dev/null' \; } @@ -45,12 +52,12 @@ function diagnostics { } if [[ $* == *--help* ]]; then echo "Usage: $0 [option]" - echo "Default options: --brew-update --cleanup --diagnostics --permission-fix" + echo "Default options: --brew-update --cleanup --diagnostics" echo -e "Options:\n\t--brew-update\n\t--cleanup\n\t--diagnostics\n\t--permission-fix\n\t--system-update" fi if [[ -z $* ]]; then - set -- "$*" "--brew-update --cleanup --diagnostics --permission-fix" + set -- "$*" "--brew-update --cleanup --diagnostics" fi if [[ $* == *--system-update* ]]; then