Automate MOS Patch Downloads using WGET
- Get link
- X
- Other Apps
Recently, I was searching for a way to completely automate the process of MOS patch downloads when I stumbled upon this blog post - a very well written blog explaining the intricacies of automating patch download from MOS using CURL.
This set me thinking if it could be done using WGET command instead of CURL and I found out that it can, indeed, be done.
Though the blog post that I have referenced offers a completely automated solution, it uses CURL command beacuse CURL comes installed, by default, with most of the Linux based Docker images, while wget doesn't.
Most of the other blog posts that describe patch download using wget, rely on manual authentication with MOS or manually fetching the download URL from MOS. However, I present to you a completely automated way of My Oracle Support Patch Downloads using wget.
NOTE: I have assumed the OS to be Linux x86-64 bit and accordingly, hard-coded the platform ID as 226P (plat_lang=226P). I plan to publish another blog post detailing the process to fetch all the available platforms and languages shortly.
Briefly, the steps involved in this process are:
1. Login to MOS and save a cookie file
2. Search for the patch number and fetch the patch download URL from the output
3. Download the patch using the patch download URL
Login to MOS and save a cookie file
I have used the below as inputs/references:
a. steps for creating/saving the cookie file, provided in the wget.sh script for downloading any patch in MOS.
b. usage of the WGETRC file with the wget command for storing credentials
There are 3 sub-steps here:
- Create the WGETRC file - by prompting the user and accepting user input for username and password to login to MOS
- Set the variables (including WGETRC)
- Login to MOS and save the cookie file
Fetch the patch download URL from MOS
Below are the sub-steps for doing this:
a. Search for the patch in MOS using the cookie file (saved in the previous step) and save the output in a file
b. Glean the patch download URL from the saved output
Download the patch from MOS and ensure that it is safe
The sub-steps in this phase are:
a. Download the patch using the download URL gleaned from the above step.
b. Also download the patch XML in order to glean the SHA256 checksum of the source patch
c. Find the sha256 checksum of the download patch zip and compare it with the one from the patch XML. Ensure that both match else, delete the patch zip file.
Download the basic script from git.
Bonus: Download the enhanced script that uses:
1. options (-p or --patch) to specify the patch number
2. Functions to perform validations
3. a different way of checking whether the given argument (i.e., patch number) is indeed a numeral.
- Get link
- X
- Other Apps
Comments