|
- #!/bin/bash
- MY_PARAM=${1:-0}
-
- ####################################################################
-
- red=`tput setaf 1`
- green=`tput setaf 2`
- reset=`tput sgr0`
-
- ####################################################################
-
- if [[ $EUID -ne 0 ]]; then
- echo "${red}This script must be run as root${reset}"
- exit 1
- fi
-
- mkdir /tmp/oracle6-7/
-
- ####################################################################
-
- echo "${green}Oracle 6 to Oracle 7 script started.${reset}"
- echo -e "\n\n\n"
- echo "${green}Performing Pre-Upgradation tasks.${reset}"
- sleep 2
- echo -e "\n\n\n"
-
- ####################################################################
-
- if [[ $MY_PARAM -le 0 ]]
- then
- echo "${green}Updating the Oracle 6 packages${reset}"
-
- yum -y update 2> /tmp/oracle6-7/oracleUpdate.log
- # Updating the Oracle 6 packages
-
- if [[ $? -ne 0 ]]; then
- echo "${red}ERROR...! please check the /tmp/oracle6-7/oracleUpdate.log file for the logs and re-run the script.${reset}"
- exit 1
- else
- echo "${green}CentOS packages successfuly updated${reset}"
- echo -e "\n\n\n"
- fi
- fi
-
- ####################################################################
-
- if [[ $MY_PARAM -le 1 ]]
- then
- echo "${green}Enabling the OL6 Addons${reset}"
-
- yum-config-manager --enable ol6_addons 2> /tmp/oracle6-7/enableAddons.log
- # Enabling the ol6_addons repo
-
- if [[ $? -ne 0 ]]; then
- echo "${red}ERROR...! please check the /tmp/oracle6-7/enableAddons.log file for the logs and run the script with argument '1'.${reset}"
- exit 1
- else
- echo "${green}OL6 addons successfuly enabled${reset}"
- echo -e "\n\n\n"
- fi
- fi
-
- ####################################################################
-
- if [[ $MY_PARAM -le 2 ]]
- then
- echo "${green}Installing the tools required${reset}"
-
- 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
- # Installing the required update tools
-
- if [[ $? -ne 0 ]]; then
- echo "${red}ERROR...! please check the /tmp/oracle6-7/packages.log file for the logs and run the script with argument '2'.${reset}"
- exit 1
- else
- echo "${green}Required tools installed successfully${reset}"
- echo -e "\n\n\n"
- fi
- fi
-
- ####################################################################
-
- echo "${green}Removing pre-defined packages (if-present)${reset}"
-
- yum remove -y modcluster corosync pacemaker pcs ricci ccs
-
- echo "${green}Packages removed successfully${reset}"
- echo -e "\n\n\n"
-
- ####################################################################
-
- echo "${green}Starting the Pre-Upgrade Tool.${reset}"
- sleep 2
- echo -e "\n\n\n"
-
- ####################################################################
-
- echo "${green}Press y to start the pre-upgrade tool.${reset}"
-
- preupg
- # Runs the pre-upgrade tool
- # Manually requires user to enter y
-
- echo "${green}PreUpgrade Tool ran successfully, please check and resolve the errors present in ./preupgrade/result.html${reset}"
- echo -e "\n\n\n"
-
- ####################################################################
-
- if [[ $MY_PARAM -le 3 ]]
- then
- echo "${green}Downloading the OracleLinux7.6.${reset}"
-
- 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
-
- if [[ $? -ne 0 ]]; then
- echo "${red}ERROR...! Download Unsuccessful, please re-run the script with argument '3'.${reset}"
- exit 1
- else
- echo "${green}Oracle Linux 7.6 downloaded successfully${reset}"
- echo -e "\n\n\n"
- fi
- fi
-
- ####################################################################
-
- if [[ $MY_PARAM -le 4 ]]
- then
- echo "${green}Downloading the future required scripts${reset}"
-
- curl https://dms-git.ameyo.net:8265/UpgradeOStoOracle/OracleLinux/raw/branch/master/upgrade-oracle7 --output /usr/bin/upgrade-oracle7
-
- if [[ $? -ne 0 ]]; then
- echo "${red}ERROR...! ISO download failed, please re-run the script with argument '4'.${reset}"
- exit 1
- else
- echo "${green}Scripts downloaded successfuly${reset}"
- echo -e "\n\n\n"
- fi
- fi
-
- ####################################################################
-
- if [[ $MY_PARAM -le 5 ]]
- then
- echo "${green}Adding execute permissions to future scripts${reset}"
-
- chmod +x /usr/bin/upgrade-oracle7 2> /tmp/oracle6-7/future.log
- # Runs the centos2ol script
-
- if [[ $? -ne 0 ]]; then
- echo "${red}ERROR...! please check the /tmp/oracle6-7/future.log file for the logs and run the script with argument '5'.${reset}"
- exit 1
- else
- echo "${green}Execute permissions added successfuly${reset}"
- echo -e "\n\n\n"
- fi
- fi
-
- ####################################################################
-
- echo "${green}Pre-Upgradation tasks completed successfully.${reset}"
- echo -e "\n\n\n"
- sleep 1
- 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}"
- echo -e "\n\n\n"
- sleep 2
-
- ####################################################################
-
- upgrade-oracle7
|