Fix permission fixer

This commit is contained in:
Fabian Ising
2023-06-02 14:28:50 +02:00
parent 6ac05e9c1c
commit 7a58e5f86a

View File

@@ -1,11 +1,18 @@
#!/bin/bash #!/bin/bash
ARCH=`uname -m`
if [[ $ARCH == "arm64" ]]; then
PREFIX="/opt/homebrew/"
else
PREFIX="/usr/local"
fi
function set_permissions { function set_permissions {
echo "----------" echo "----------"
echo "Disabling Quarantine for Casks ..." echo "Disabling Quarantine for Casks ..."
echo "----------" echo "----------"
find /usr/local/Caskroom -name *.app -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 /usr/local/Caskroom -type f -perm +111 -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/ -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' \; 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 if [[ $* == *--help* ]]; then
echo "Usage: $0 [option]" 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" echo -e "Options:\n\t--brew-update\n\t--cleanup\n\t--diagnostics\n\t--permission-fix\n\t--system-update"
fi fi
if [[ -z $* ]]; then if [[ -z $* ]]; then
set -- "$*" "--brew-update --cleanup --diagnostics --permission-fix" set -- "$*" "--brew-update --cleanup --diagnostics"
fi fi
if [[ $* == *--system-update* ]]; then if [[ $* == *--system-update* ]]; then