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.

98 lines
2.7KB

  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 -p /tmp/oracle6-7/
  13. ####################################################################
  14. echo "${green}Upgrade Oracle 7 script started.${reset}"
  15. echo -e "\n\n\n"
  16. echo "${green}Performing Upgrade tasks.${reset}"
  17. sleep 2
  18. echo -e "\n\n\n"
  19. ####################################################################
  20. if [[ $MY_PARAM -le 0 ]]
  21. then
  22. echo "${green}Running the redhat upgrade tool${reset}"
  23. redhat-upgrade-tool-cli --iso OracleLinux-R7-U6-Server-x86_64-dvd.iso --debuglog=/tmp/oracle6-7/upgrade.log --cleanup-post
  24. # Updating the Oracle 6 packages
  25. if [[ $? -ne 0 ]]; then
  26. echo "${red}ERROR...! please check the /tmp/oracle6-7/upgrade.log file for the logs and re-run the script.${reset}"
  27. exit 1
  28. else
  29. echo "${green}RedHat Upgrade Tool ran successfully${reset}"
  30. echo -e "\n\n\n"
  31. fi
  32. fi
  33. ####################################################################
  34. echo "${green}Upgrade tasks completed successfully.${reset}"
  35. echo -e "\n\n\n"
  36. sleep 1
  37. echo "${green}Performing Post-Upgradation tasks.${reset}"
  38. echo -e "\n\n\n"
  39. sleep 2
  40. ####################################################################
  41. if [[ $MY_PARAM -le 1 ]]
  42. then
  43. echo "${green}Downloading the future required scripts${reset}"
  44. curl https://dms-git.ameyo.net:8265/UpgradeOStoOracle/OracleLinux/raw/branch/master/fix-oracle7 --output /usr/bin/fix-oracle7
  45. if [[ $? -ne 0 ]]; then
  46. echo "${red}ERROR...! Download failed, please re-run the script with argument '1'.${reset}"
  47. exit 1
  48. else
  49. echo "${green}Scripts downloaded successfuly${reset}"
  50. echo -e "\n\n\n"
  51. fi
  52. fi
  53. ####################################################################
  54. if [[ $MY_PARAM -le 2 ]]
  55. then
  56. echo "${green}Adding execute permissions to future scripts${reset}"
  57. chmod +x /usr/bin/fix-oracle7
  58. # Runs the centos2ol script
  59. if [[ $? -ne 0 ]]; then
  60. echo "${red}ERROR...! Execution permission error re-run the script with argument '2'.${reset}"
  61. exit 1
  62. else
  63. echo "${green}Execute permissions added successfuly${reset}"
  64. echo -e "\n\n\n"
  65. fi
  66. fi
  67. ####################################################################
  68. echo "${green}Post-Upgradation tasks completed successfully.${reset}"
  69. echo -e "\n\n\n"
  70. sleep 1
  71. echo "${green}Please reboot your machine for a complete upgrade.${reset}"
  72. echo -e "\n\n\n"
  73. sleep 2
  74. ####################################################################