Advertisement
Guest User

OSX file:/// BUG FIX SCRIPT 10.8.2

a guest
Feb 2nd, 2013
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #! /bin/bash
  2.  
  3. # special thanks to @landonfuller
  4. # this is his fix / patch. Just my script.
  5. # ~John
  6.  
  7. PATCHFILE="/System/Library/PrivateFrameworks/DataDetectorsCore.framework/Versions/Current/DataDetectorsCore"
  8. #PATCHFILE="/tmp/DataDetectorsCore"
  9.  
  10. printf "\n === Patches OSX 10.8.2 DataDetectorsCore file to bypass the File:/// bug === \n"
  11.  
  12. if [ "$(id -u)" != "0" ]; then
  13.    printf "\n\n ERROR: This script must be run using sudo.\n Example:  sudo ./Filefix.sh \n\n" 1>&2
  14.    exit 1
  15. fi
  16.  
  17. FALSE=1
  18. TRUE=0
  19. function shasum_isgood {
  20.     printf "\n + Checking file SHA sum : "
  21.  
  22.     SHASUM=$( shasum $PATCHFILE )
  23.    
  24.     printf $SHASUM | grep $1
  25.     if [ $? -eq 0 ]; then
  26.         printf " ++ PASS\n"
  27.         return $TRUE  
  28.     fi
  29.    
  30.     printf "FAIL"
  31.     return $FALSE
  32. }
  33.  
  34. function patch_file {
  35.     printf "\n + Patching file: "
  36.     printf '\xeb' | dd bs=1 seek=646039 count=1 conv=notrunc of=$PATCHFILE
  37.     printf " ++ DONE\n"
  38. }
  39.  
  40. function backup_original {
  41.     printf "\n + Backing up original file in $HOME : "
  42.     cp -vf $PATCHFILE $HOME
  43.     PRINTF " ++ DONE\n"
  44. }
  45.  
  46.  
  47. if shasum_isgood 3fe12fd274433877c9e307ba9c09a06dde11882e ; then
  48.     backup_original
  49.     patch_file 
  50. else
  51.     printf "\n\n + ERROR: File version mismatch. Patching aborted.\n\n"
  52. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement