Advertisement
themacdweeb

Set Apple Software Update With Reposado.sh

Oct 16th, 2013
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 5.68 KB | None | 0 0
  1. #!/bin/sh
  2. #
  3. # Software Update Set & Confirm script, ©2013 David Koff
  4. # Unix Tool for allowing users to toggle Apple Software Updates between
  5. # Apple's Servers and The Getty's hosted XServe.
  6. #
  7. # Created: 9.5.2011
  8. # Last Updated: 6.14.13
  9.  
  10. #----------------------------------------
  11. # set to Apple
  12. #----------------------------------------
  13. set_Apple() {
  14. # resets software update server back to apple
  15. defaults delete /Library/Preferences/com.apple.SoftwareUpdate CatalogURL
  16. echo "This Mac will point to APPLE'S SERVERS."
  17. sleep 2
  18. open /System/Library/CoreServices/Software\ Update.app/
  19. sleep 2
  20. exit_script;
  21. }
  22.  
  23. #----------------------------------------
  24. # set to Reposado Production Branch
  25. #----------------------------------------
  26. set_RepoProd() {
  27.  
  28. case `sw_vers -productVersion | awk -F . '{print $2}'` in
  29.     5) URL="${URL}/content/catalogs/others/index-leopard.merged-1_production.sucatalog" ;;      
  30.     6) URL="${URL}/content/catalogs/others/index-leopard-snowleopard.merged-1_production.sucatalog" ;;  
  31.     7) URL="${URL}/content/catalogs/others/index-lion-snowleopard-leopard.merged-1_production.sucatalog" ;;
  32.     8) URL="${URL}/content/catalogs/others/index-mountainlion-lion-snowleopard-leopard.merged-1_production.sucatalog" ;;  
  33.     *) echo "Unsupported client OS"; exit 1 ;;
  34. esac
  35.  
  36. defaults write /Library/Preferences/com.apple.SoftwareUpdate CatalogURL "${URL}"
  37.  
  38. echo "This Mac is running OSX:" $OS
  39. echo "Confirming... SuS has been set for this Mac to use the PRODUCTION reposado branch at:"
  40. defaults read /Library/Preferences/com.apple.SoftwareUpdate CatalogURL
  41. sleep 2
  42. open /System/Library/CoreServices/Software\ Update.app/
  43. sleep 2
  44. exit_script;
  45. }
  46.  
  47. #----------------------------------------
  48. # set to Reposado Pilot Tester Branch
  49. #----------------------------------------
  50. set_PilotTest() {
  51.  
  52. case `sw_vers -productVersion | awk -F . '{print $2}'` in
  53.     5) URL="${URL}/content/catalogs/others/index-leopard.merged-1_pilottesters.sucatalog" ;;      
  54.     6) URL="${URL}/content/catalogs/others/index-leopard-snowleopard.merged-1_pilottesters.sucatalog" ;;  
  55.     7) URL="${URL}/content/catalogs/others/index-lion-snowleopard-leopard.merged-1_pilottesters.sucatalog" ;;
  56.     8) URL="${URL}/content/catalogs/others/index-mountainlion-lion-snowleopard-leopard.merged-1_pilottesters.sucatalog" ;;  
  57.     *) echo "Unsupported client OS"; exit 1 ;;
  58. esac
  59.  
  60. defaults write /Library/Preferences/com.apple.SoftwareUpdate CatalogURL "${URL}"
  61.  
  62. echo "This Mac is running OSX:" $OS
  63. echo "Confirming... SuS has been set for this Mac to use the PILOT TESTER reposado branch at:"
  64. defaults read /Library/Preferences/com.apple.SoftwareUpdate CatalogURL
  65. sleep 2
  66. open /System/Library/CoreServices/Software\ Update.app/
  67. sleep 2
  68. exit_script;
  69. }
  70.  
  71. #----------------------------------------
  72. # set to Reposado Lab Tester Branch
  73. #----------------------------------------
  74. set_LabTester() {
  75.  
  76. case `sw_vers -productVersion | awk -F . '{print $2}'` in
  77.     5) URL="${URL}/content/catalogs/others/index-leopard.merged-1_LabTesters.sucatalog" ;;      
  78.     6) URL="${URL}/content/catalogs/others/index-leopard-snowleopard.merged-1_LabTesters.sucatalog" ;;  
  79.     7) URL="${URL}/content/catalogs/others/index-lion-snowleopard-leopard.merged-1_LabTesters.sucatalog" ;;
  80.     8) URL="${URL}/content/catalogs/others/index-mountainlion-lion-snowleopard-leopard.merged-1_LabTesters.sucatalog" ;;  
  81.     *) echo "Unsupported client OS"; exit 1 ;;
  82. esac
  83.  
  84. defaults write /Library/Preferences/com.apple.SoftwareUpdate CatalogURL "${URL}"
  85.  
  86. echo "This Mac is running OSX:" $OS
  87. echo "Confirming... SuS has been set for this Mac to use the LAB TESTER reposado branch at:"
  88. defaults read /Library/Preferences/com.apple.SoftwareUpdate CatalogURL
  89. sleep 2
  90. open /System/Library/CoreServices/Software\ Update.app/
  91. sleep 2
  92. exit_script;
  93. }
  94.  
  95. #----------------------------------------
  96. # choice
  97. #----------------------------------------
  98. set_Choice() {
  99. screen_clear;
  100. echo "Where would you prefer to get your Apple software updates:"
  101. echo ""
  102. echo ""
  103. echo ""
  104. echo "(1) From the Reposado PRODUCTION branch"
  105. echo "(2) From the Reposado PILOT-TESTER branch"
  106. echo "(3) From the Reposado LAB TESTER branch"
  107. echo "(4) From Apple"
  108. echo ""
  109. echo ""
  110. echo ""
  111. echo "Enter the number of your choice and hit return."
  112. read choice
  113. if [ "$choice" != "1" ] && [ "$choice" != "2" ] && [ "$choice" != "3" ] && [ "$choice" != "4" ]; then
  114. echo ""
  115. echo ""
  116. echo ""
  117. echo "YOU MUST TYPE EITHER 1, 2, 3 or 4 AND THEN HIT RETURN. TRY AGAIN."
  118. sleep 3
  119. set_Choice;
  120. else
  121.     case "$choice" in
  122.         "1") set_RepoProd; break;;
  123.         "2") set_PilotTest; break;;
  124.         "3") set_LabTester; break;;
  125.         "4") set_Apple; break;;
  126.     esac
  127. fi
  128. }
  129.  
  130.  
  131. #--------------------------------------------------
  132. # screen clear
  133. #--------------------------------------------------
  134. screen_clear() {
  135. count=0
  136. while [ $count -lt 30 ]
  137. do
  138.     count=`expr $count + 1`
  139.     echo ""
  140. done
  141. }
  142.  
  143.  
  144. #--------------------------------------------------
  145. # exit
  146. #--------------------------------------------------
  147. exit_script() {
  148. screen_clear;
  149. echo "This program will now quit itself. Thank you."
  150. sleep 2
  151. killall Terminal
  152. exit 0
  153. }
  154.  
  155.  
  156. #--------------------------------------------------
  157. # launcher
  158. #--------------------------------------------------
  159. URL='http://xserve-timcook.getty.edu:8088'
  160. OS=`sw_vers -productVersion`
  161.  
  162. #--- Set Logging
  163. exec >> "/Library/Logs/Getty Installations.log" 2>&1
  164.  
  165. screen_clear;
  166. echo "This script allows you to choose the source of your SuS server:"
  167. echo "from any of the Reposado branches at the Getty or from Apple."
  168. echo ""
  169. echo ""
  170. echo "It will ask you a series of questions to assist you."
  171. echo ""
  172. echo ""
  173. echo "Do you wish to continue (y/n)? "
  174. read answer
  175. if [ $answer = "n" ]; then
  176.     exit_script;
  177. else
  178.     set_Choice;
  179. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement