https://github.com/ApolloZhu/CORE-Keygen-and-Special-K-for-Sierra-Utility/blob/master/Special%20K%20for%20Sierra%20Utility.shgit
其實就是一個指向路徑的問題。。。github
1 #! /bin/bash 2 3 echo "This is an app to use Special [K] patchers on macOS Sierra." 4 echo " " 5 echo "This is in NO WAY associated or endorsed by the Special [K] group." 6 echo " " 7 8 # verify that command line tools are installed 9 # patching won't work without them 10 # the patcher will make a corrupt patch if they are installed while patching 11 12 echo "Checking for Command Line tools." 13 echo "Patching cannot proceed without them." 14 echo " " 15 echo "If the tools need to be installed, try patching again when they are done." 16 echo " " 17 18 check=$(xcode-select --install 2>&1) 19 20 echo "$check" | grep -q "install requested" && echo "Tools need to be installed...Quitting" && exit 1 21 22 echo "Command line tools are already installed." 23 echo " " 24 25 26 # ask user to select the Special [K] patcher 27 # keep trying until user quits or finds an acceptable patcher 28 29 while true ; do 30 31 get_patcher=$(osascript -e "POSIX path of (choose file with prompt \"Choose the Special [K] patcher\" of type \"APPL\" default location (path to applications folder))" 2>&1) 32 33 echo "$get_patcher" | grep -q "User cancelled" && echo "No patcher was chosen...Quitting" && exit 1 34 35 patcher="${get_patcher}Contents/MacOS/patcher" 36 eyepatch="${get_patcher}Contents/MacOS/eyePatch" 37 38 [[ -e "$patcher" ]] && [[ -e "$eyepatch" ]] && break 39 40 echo "Does not appear to be a Special [K] patcher, try again..." 41 done 42 43 44 # ask user to select the app to patch 45 # there is no error checking for whether this is the correct app 46 # any output is suppressed so as to not confuse the user 47 # there does not appear to be any message if the app has already been patched 48 # nor if there is a specific error while patching 49 50 the_app=$(osascript -e "POSIX path of (choose file with prompt \"Choose the app to be patched\" of type \"APPL\" default location (path to applications folder))" 2>&1) 51 52 echo "$the_app" | grep -q "User cancelled" && echo "No app was chosen...Quitting" && exit 1 53 54 55 # do the patch 56 # suppress messages that might be confusing, but also might be helpful if problems 57 58 "$patcher" "$the_app" "$eyepatch" "$the_app" 2>&1 > /dev/null 59 60 echo " " && echo "All Done!" && exit 0