Thursday, 15 August 2013

Unzipping IBM iFixes in a FOR loop

I have a load of iFixes downloaded as .ZIP files: -

7.5.1.1-WS-BPM-IFIC86727.zip  7.5.1.1-WS-BPM-IFJR44463.zip  7.5.1.1-WS-BPM-IFJR45124.zip  7.5.1.1-WS-BPM-IFJR45931.zip
7.5.1.1-WS-BPM-IFJR42774.zip  7.5.1.1-WS-BPM-IFJR44474.zip  7.5.1.1-WS-BPM-IFJR45222.zip  7.5.1.1-WS-BPM-IFJR45939.zip
7.5.1.1-WS-BPM-IFJR44032.zip  7.5.1.1-WS-BPM-IFJR44503.zip  7.5.1.1-WS-BPM-IFJR45344.zip  7.5.1.1-WS-BPM-IFJR46350.zip
7.5.1.1-WS-BPM-IFJR44086.zip  7.5.1.1-WS-BPM-IFJR44606.zip  7.5.1.1-WS-BPM-IFJR45523.zip  7.5.1.1-WS-BPM-Unix-IFJR43774.zip
7.5.1.1-WS-BPM-IFJR44199.zip  7.5.1.1-WS-BPM-IFJR44617.zip  7.5.1.1-WS-BPM-IFJR45532.zip 
7.5.1.1-WS-BPM-IFJR44357.zip  7.5.1.1-WS-BPM-IFJR44690.zip  7.5.1.1-WS-BPM-IFJR45553.zip 
7.5.1.1-WS-BPM-IFJR44397.zip  7.5.1.1-WS-BPM-IFJR44729.zip  7.5.1.1-WS-BPM-IFJR45755.zip
7.5.1.1-WS-BPM-IFJR44428.zip  7.5.1.1-WS-BPM-IFJR45071.zip  7.5.1.1-WS-BPM-IFJR45851.zip


in a directory called /home/wasadmin/Fixes.

Here's a neat little script that I use to expand the fixes, neatly ready to be installed using IBM Installation Manager: -

$ cd /home/wasadmin/Fixes
$ mkdir Install
$ for i in *.zip;do unzip $i -d Install/`echo $i | sed -s 's/.zip//g'`; done

This results in each iFix unzipped into its own private directory: -

drwxr-xr-x  3 wasadmin wasadmins 4096 Aug 15 14:20 7.5.1.1-WS-BPM-IFIC86727
drwxr-xr-x  6 wasadmin wasadmins 4096 Aug 15 14:20 7.5.1.1-WS-BPM-IFJR42774
drwxr-xr-x  6 wasadmin wasadmins 4096 Aug 15 14:20 7.5.1.1-WS-BPM-IFJR44032
drwxr-xr-x  3 wasadmin wasadmins 4096 Aug 15 14:20 7.5.1.1-WS-BPM-IFJR44086
drwxr-xr-x  3 wasadmin wasadmins 4096 Aug 15 14:20 7.5.1.1-WS-BPM-IFJR44199
drwxr-xr-x  6 wasadmin wasadmins 4096 Aug 15 14:20 7.5.1.1-WS-BPM-IFJR44357
drwxr-xr-x  3 wasadmin wasadmins 4096 Aug 15 14:20 7.5.1.1-WS-BPM-IFJR44428
drwxr-xr-x  3 wasadmin wasadmins 4096 Aug 15 14:20 7.5.1.1-WS-BPM-IFJR44397
drwxr-xr-x  3 wasadmin wasadmins 4096 Aug 15 14:20 7.5.1.1-WS-BPM-IFJR44463
drwxr-xr-x  3 wasadmin wasadmins 4096 Aug 15 14:20 7.5.1.1-WS-BPM-IFJR44474
drwxr-xr-x  3 wasadmin wasadmins 4096 Aug 15 14:20 7.5.1.1-WS-BPM-IFJR44503
drwxr-xr-x  3 wasadmin wasadmins 4096 Aug 15 14:20 7.5.1.1-WS-BPM-IFJR44606
drwxr-xr-x  3 wasadmin wasadmins 4096 Aug 15 14:20 7.5.1.1-WS-BPM-IFJR44617
drwxr-xr-x  3 wasadmin wasadmins 4096 Aug 15 14:20 7.5.1.1-WS-BPM-IFJR44690
drwxr-xr-x  3 wasadmin wasadmins 4096 Aug 15 14:20 7.5.1.1-WS-BPM-IFJR44729
drwxr-xr-x  3 wasadmin wasadmins 4096 Aug 15 14:20 7.5.1.1-WS-BPM-IFJR45071
drwxr-xr-x  3 wasadmin wasadmins 4096 Aug 15 14:20 7.5.1.1-WS-BPM-IFJR45124
drwxr-xr-x  3 wasadmin wasadmins 4096 Aug 15 14:20 7.5.1.1-WS-BPM-IFJR45222
drwxr-xr-x  3 wasadmin wasadmins 4096 Aug 15 14:20 7.5.1.1-WS-BPM-IFJR45344
drwxr-xr-x  3 wasadmin wasadmins 4096 Aug 15 14:20 7.5.1.1-WS-BPM-IFJR45523
drwxr-xr-x  3 wasadmin wasadmins 4096 Aug 15 14:20 7.5.1.1-WS-BPM-IFJR45532
drwxr-xr-x  3 wasadmin wasadmins 4096 Aug 15 14:20 7.5.1.1-WS-BPM-IFJR45553
drwxr-xr-x  6 wasadmin wasadmins 4096 Aug 15 14:20 7.5.1.1-WS-BPM-IFJR45755
drwxr-xr-x  3 wasadmin wasadmins 4096 Aug 15 14:20 7.5.1.1-WS-BPM-IFJR45851
drwxr-xr-x  3 wasadmin wasadmins 4096 Aug 15 14:20 7.5.1.1-WS-BPM-IFJR45931
drwxr-xr-x  6 wasadmin wasadmins 4096 Aug 15 14:20 7.5.1.1-WS-BPM-IFJR45939
drwxr-xr-x  6 wasadmin wasadmins 4096 Aug 15 14:20 7.5.1.1-WS-BPM-IFJR46350
drwxr-xr-x  3 wasadmin wasadmins 4096 Aug 15 14:20 7.5.1.1-WS-BPM-Unix-IFJR43774


ready for installation using a response file.


2 comments:

Stevan Bajić said...

There is no need to use SED in this task.

Instead of your last original command one could use:

for i in *.zip;do unzip ${i} -d Install/${i/\.zip/};done

See that backslash in the regex? You missed that one on your original code. I don't know about the naming convention of those packages but should any of those files contain "[any character]zip" in their name (including the extension) then your SED regex will erase this (because of the "g" command).

Dave Hay said...

Stevan

and that's why I love blogging. Getting feedback like this is absolutely sweet. Thanks for the input. I'll update my own notes :-)

Cheers, Dave