Advertisement
themacdweeb

xProtect ii: The Sequel

Jun 9th, 2013
1,919
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.95 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. # The Getty xProtect over-ride script, ©2013 David Koff
  4. # Please use freely as long as you include both of these commented lines.
  5.  
  6.  
  7. #----------------------------------------------------------
  8. #   Variables
  9. #----------------------------------------------------------
  10. SCRIPTNAME=$0
  11.  
  12. #-----Logging
  13. exec >> "/Library/Logs/Getty Installations.log" 2>&1
  14.  
  15. #-----Directories & Files
  16. xProtectPlist="/System/Library/LaunchDaemons/com.apple.xprotectupdater.plist"
  17. xProtectInitPlist="/System/Library/LaunchDaemons/com.apple.xprotectupdaterinit.plist"
  18. xProtectMetaPlist="/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/XProtect.meta.plist"
  19.  
  20. LaunchDaemons="/System/Library/LaunchDaemons"
  21. LaunchDaemonsDisabled="/System/Library/LaunchDaemonsDisabled"
  22.  
  23. #----------------------------------------------------------
  24. #  Timestamp
  25. #----------------------------------------------------------
  26. echo "                                   "
  27. echo "###################################"
  28. echo "##### $SCRIPTNAME"
  29. echo "##### `date "+%A %m/%d/%Y %H:%M"`"
  30. echo "###################################"
  31. echo "                                   "
  32.  
  33.  
  34. echo ""
  35. echo "### ----- DISABLE XPROTECT ----- ###"
  36. echo ""
  37. echo "### ----- find & rename meta plist"
  38. if [ -f $xProtectMetaPlist ]; then
  39.     zip -r $xProtectMetaPlist.zip $xProtectMetaPlist
  40.     rm -f $xProtectMetaPlist
  41.     echo "The xProtectMetaPlist has been renamed, disabled & left in its original location:"
  42.     echo "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/"
  43. elif [ -f $xProtectMetaPlist.zip ]; then
  44.     echo "The xProtectMetaPlist has already been zipped & stored at:"
  45.     echo "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/"
  46. fi
  47.  
  48.  
  49. #### to put it back to it's original state
  50. # unzip -j /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/XProtect.meta.plist.zip
  51. # rm -f $xProtectMetaPlist.zip
  52.  
  53.  
  54. echo ""
  55. echo "### ----- check for disabled launchdaemons directory"
  56. if [ ! -d $LaunchDaemonsDisabled ]; then
  57.     mkdir -v $LaunchDaemonsDisabled
  58. else
  59.     echo "$LaunchDaemonsDisabled/ directory has already been created."
  60.     rm -fv $LaunchDaemonsDisabled/*
  61.     echo "Now it has also been emptied."
  62. fi
  63.  
  64.  
  65. echo ""
  66. echo "### ----- unload any active xProtect process"
  67. launchctl unload -w com.apple.xprotectupdater-init
  68. launchctl unload -w "$xProtectPlist"
  69.  
  70. echo ""
  71. echo "### ----- move any xProtect plists to new location"
  72. cd $LaunchDaemons
  73. mv -v com.apple.xprotect* $LaunchDaemonsDisabled
  74.  
  75. echo ""
  76. echo "### ----- contents of $LaunchDaemonsDisabled now includes:"
  77. ls $LaunchDaemonsDisabled
  78.  
  79.  
  80. #----------------------------------------------------------
  81. #  Timestamp
  82. #----------------------------------------------------------
  83. echo "                                   "
  84. echo "###################################"
  85. echo "##### END LOG"
  86. echo "##### `date "+%A %m/%d/%Y %H:%M"`"
  87. echo "###################################"
  88. echo "                                   "
  89.  
  90. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement