Advertisement
adamchilcott

java_-_8_-_update.sh

Aug 14th, 2017
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.95 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. ##########################
  4. # Oracle Java 8 Update XXX
  5. ##########################
  6.  
  7. declare tempMountPoint='/tmp/mnt/'
  8. declare dmgLocation='lmnas01.avondale.edu.au/Software/Java'
  9. declare dmgFile='jdk-8u121-macosx-x64.dmg'
  10. declare pkgLocation='/Volumes/JDK 8 Update 121/JDK 8 Update 121.pkg'
  11. declare dmgVolume='/Volumes/JDK 8 Update 121'
  12.  
  13. ###################################
  14. # Remove Existing Java Installation
  15. ###################################
  16. rm -f -r /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
  17. rm -f -r /Library/PreferencePanes/JavaControlPanel.prefPane
  18. rm -f -r ~/Library/Application\ Support/Java
  19.  
  20. ##############################
  21. # Create Temporary Mount Point
  22. ##############################
  23. mkdir "$tempMountPoint"
  24.  
  25. #####################
  26. # Mount Remote Server
  27. #####################
  28. printf "Please Enter Your UserName e.g. s14054524: "
  29. read -r userName
  30. mount -t smbfs //"$userName"@"$dmgLocation" "$tempMountPoint"
  31.  
  32. #############
  33. # Mount *.dmg
  34. #############
  35. hdiutil attach "$tempMountPoint$dmgFile"
  36.  
  37. ###############
  38. # Install *.pkg
  39. ###############
  40. installer -pkg "$pkgLocation" -target /
  41.  
  42. ##########
  43. # Clean-Up
  44. ##########
  45. hdiutil detach -force "$dmgVolume"
  46. sleep .5
  47. umount -f "$tempMountPoint"
  48.  
  49. #############
  50. # START NOTES
  51. #############
  52.  
  53. # 2-clause license ("Simplified BSD License" or "FreeBSD License")
  54. #
  55. # Copyright © 2018, Adam Brian Chilcott
  56. # All rights reserved.
  57. #
  58. # Redistribution and use in source and binary forms, with or without
  59. # modification, are permitted provided that the following conditions are met:
  60. #
  61. # 1. Redistributions of source code must retain the above copyright notice, this
  62. # list of conditions and the following disclaimer.
  63. # 2. Redistributions in binary form must reproduce the above copyright notice,
  64. # this list of conditions and the following disclaimer in the documentation
  65. # and/or other materials provided with the distribution.
  66. #
  67. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  68. # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  69. # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  70. # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
  71. # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  72. # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  73. # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  74. # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  75. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  76. # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  77. #
  78. # The views and conclusions contained in the software and documentation are those
  79. # of the authors and should not be interpreted as representing official policies,
  80. # either expressed or implied, of the FreeBSD Project.
  81.  
  82. ###########
  83. # END NOTES
  84. ###########
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement