You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

170 lines
5.1KB

  1. #!/bin/bash
  2. MY_PARAM=${1:-0}
  3. ####################################################################
  4. red=`tput setaf 1`
  5. green=`tput setaf 2`
  6. reset=`tput sgr0`
  7. ####################################################################
  8. if [[ $EUID -ne 0 ]]; then
  9. echo "${red}This script must be run as root${reset}"
  10. exit 1
  11. fi
  12. mkdir /tmp/oracle6-7/
  13. ####################################################################
  14. echo "${green}Oracle 6 to Oracle 7 script started.${reset}"
  15. echo -e "\n\n\n"
  16. echo "${green}Performing Pre-Upgradation tasks.${reset}"
  17. sleep 2
  18. echo -e "\n\n\n"
  19. ####################################################################
  20. if [[ $MY_PARAM -le 0 ]]
  21. then
  22. echo "${green}Updating the Oracle 6 packages${reset}"
  23. yum -y update 2> /tmp/oracle6-7/oracleUpdate.log
  24. # Updating the Oracle 6 packages
  25. if [[ $? -ne 0 ]]; then
  26. echo "${red}ERROR...! please check the /tmp/oracle6-7/oracleUpdate.log file for the logs and re-run the script.${reset}"
  27. exit 1
  28. else
  29. echo "${green}CentOS packages successfuly updated${reset}"
  30. echo -e "\n\n\n"
  31. fi
  32. fi
  33. ####################################################################
  34. if [[ $MY_PARAM -le 1 ]]
  35. then
  36. echo "${green}Enabling the OL6 Addons${reset}"
  37. yum-config-manager --enable ol6_addons 2> /tmp/oracle6-7/enableAddons.log
  38. # Enabling the ol6_addons repo
  39. if [[ $? -ne 0 ]]; then
  40. echo "${red}ERROR...! please check the /tmp/oracle6-7/enableAddons.log file for the logs and run the script with argument '1'.${reset}"
  41. exit 1
  42. else
  43. echo "${green}OL6 addons successfuly enabled${reset}"
  44. echo -e "\n\n\n"
  45. fi
  46. fi
  47. ####################################################################
  48. if [[ $MY_PARAM -le 2 ]]
  49. then
  50. echo "${green}Installing the tools required${reset}"
  51. yum install -y openscap redhat-upgrade-tool preupgrade-assistant preupgrade-assistant-el6toel7 preupgrade-assistant-el6toel7-data-0 preupgrade-assistant-tools preupgrade-assistant-ui 2> /tmp/oracle6-7/packages.log
  52. # Installing the required update tools
  53. if [[ $? -ne 0 ]]; then
  54. echo "${red}ERROR...! please check the /tmp/oracle6-7/packages.log file for the logs and run the script with argument '2'.${reset}"
  55. exit 1
  56. else
  57. echo "${green}Required tools installed successfully${reset}"
  58. echo -e "\n\n\n"
  59. fi
  60. fi
  61. ####################################################################
  62. echo "${green}Removing pre-defined packages (if-present)${reset}"
  63. yum remove -y modcluster corosync pacemaker pcs ricci ccs
  64. echo "${green}Packages removed successfully${reset}"
  65. echo -e "\n\n\n"
  66. ####################################################################
  67. echo "${green}Starting the Pre-Upgrade Tool.${reset}"
  68. sleep 2
  69. echo -e "\n\n\n"
  70. ####################################################################
  71. echo "${green}Press y to start the pre-upgrade tool.${reset}"
  72. preupg
  73. # Runs the pre-upgrade tool
  74. # Manually requires user to enter y
  75. echo "${green}PreUpgrade Tool ran successfully, please check and resolve the errors present in ./preupgrade/result.html${reset}"
  76. echo -e "\n\n\n"
  77. ####################################################################
  78. if [[ $MY_PARAM -le 3 ]]
  79. then
  80. echo "${green}Downloading the OracleLinux7.6.${reset}"
  81. curl http://mirrors.ircam.fr/pub/oraclelinux/OL7/u6/x86_64/OracleLinux-R7-U6-Server-x86_64-dvd.iso --output ./OracleLinux-R7-U6-Server-x86_64-dvd.iso
  82. if [[ $? -ne 0 ]]; then
  83. echo "${red}ERROR...! Download Unsuccessful, please re-run the script with argument '3'.${reset}"
  84. exit 1
  85. else
  86. echo "${green}Oracle Linux 7.6 downloaded successfully${reset}"
  87. echo -e "\n\n\n"
  88. fi
  89. fi
  90. ####################################################################
  91. if [[ $MY_PARAM -le 4 ]]
  92. then
  93. echo "${green}Downloading the future required scripts${reset}"
  94. curl https://dms-git.ameyo.net:8265/UpgradeOStoOracle/OracleLinux/raw/branch/master/upgrade-oracle7 --output /usr/bin/upgrade-oracle7
  95. if [[ $? -ne 0 ]]; then
  96. echo "${red}ERROR...! ISO download failed, please re-run the script with argument '4'.${reset}"
  97. exit 1
  98. else
  99. echo "${green}Scripts downloaded successfuly${reset}"
  100. echo -e "\n\n\n"
  101. fi
  102. fi
  103. ####################################################################
  104. if [[ $MY_PARAM -le 5 ]]
  105. then
  106. echo "${green}Adding execute permissions to future scripts${reset}"
  107. chmod +x /usr/bin/upgrade-oracle7 2> /tmp/oracle6-7/future.log
  108. # Runs the centos2ol script
  109. if [[ $? -ne 0 ]]; then
  110. echo "${red}ERROR...! please check the /tmp/oracle6-7/future.log file for the logs and run the script with argument '5'.${reset}"
  111. exit 1
  112. else
  113. echo "${green}Execute permissions added successfuly${reset}"
  114. echo -e "\n\n\n"
  115. fi
  116. fi
  117. ####################################################################
  118. echo "${green}Pre-Upgradation tasks completed successfully.${reset}"
  119. echo -e "\n\n\n"
  120. sleep 1
  121. echo "${green}Please resolve any errors in the preuprade, run it again and further run, upgrade-oracle7 and reboot your machine for a complete upgrade.${reset}"
  122. echo -e "\n\n\n"
  123. sleep 2
  124. ####################################################################
  125. upgrade-oracle7