It's all about the answers!

Ask a question

How to remove IBM Installation Manager repository references using command line script?


0
1
Stefan Kahlhöfer (6111) | asked Nov 03 '14, 5:11 a.m.
Hi guys,

I am silently installing and uninstalling IBM products using the Installation Manager. Therefore my scripts call the imcl command line tool and use response files as well:
:[installPath]:[/]eclipse:[/]tools:[/]imcl -input :[responseFile] -acceptLicense -log :[logFile]

The repositories e.g. their locations are defined in the used response files and I know the attribute
<repository location="..." temporary="true" />
to make Installation Manager not adding the repository to its registry during installation.
But what I want resp. have to do is remove existing repository references after uninstalling a software those installation repository was not temporary.

Repository references are stored in /var/ibm/InstallationManager/.settings/com.ibm.cic.agent.core.prefs which may look like

//com.ibm.cic.common.core.preferences.repositoryLocations./opt/IBM/Repositories/datastudio4110/disk1.RepositoryIsOpen=true
//com.ibm.cic.common.core.preferences.repositoryLocations./opt/IBM/Repositories/rsa\\RSA9001\\disk1.RepositoryIsOpen=true
//com.ibm.cic.common.core.preferences.repositoryLocations.file\:///opt/IBM/portal/base_products/multi/IBM/.RepositoryIsOpen=true
PassportAdvantageIsEnabled=false
com.ibm.cic.agent.ui.displayInternalVersion=false
com.ibm.cic.common.core.preferences.connectTimeout=30
com.ibm.cic.common.core.preferences.downloadAutoRetryCount=0
com.ibm.cic.common.core.preferences.http.disablePreemptiveAuthentication=false
com.ibm.cic.common.core.preferences.http.proxyEnabled=false
com.ibm.cic.common.core.preferences.http.proxyHost=no_proxy_set
com.ibm.cic.common.core.preferences.http.proxyPort=no_proxy_set
com.ibm.cic.common.core.preferences.http.proxyUseSocks=false
com.ibm.cic.common.core.preferences.keepFetchedFiles=false
com.ibm.cic.common.core.preferences.preserveDownloadedArtifacts=true
com.ibm.cic.common.core.preferences.readTimeout=45
com.ibm.cic.common.core.preferences.repositoryLocations=/opt/IBM/Repositories/rsa\\RSA9001\\disk1
com.ibm.cic.common.core.preferences.repositoryLocations_1=/opt/IBM/Repositories/datastudio4110/disk1
com.ibm.cic.common.core.preferences.repositoryLocations_2=file\:///opt/IBM/portal/base_products/multi/IBM/
com.ibm.cic.common.core.preferences.searchForUpdates=false
com.ibm.cic.common.core.preferences.ssl.nonsecureMode=false
com.ibm.cic.common.sharedUI.showErrorLog=true
com.ibm.cic.common.sharedUI.showNoteLog=true
com.ibm.cic.common.sharedUI.showWarningLog=true
eclipse.preferences.version=1
http.ntlm.auth.enableIntegrated.win32=true
http.ntlm.auth.kind=NTLM
offering.service.repositories.areUsed=true

I want to avoid complex file hacking removing the references with sed or awk but I couldn't find any documentation on how to do this with IM command line tools as well.
Any ideas on how to solve my problem?

Thanks in advance!
Stefan

2 answers



permanent link
Dave Hay (21) | answered Sep 03 '15, 2:28 p.m.
For me, I just use the command-line interface for IBM Installation Manager: -

/opt/IBM/InstallationManager/eclipse/tools/imcl -c

and navigate to P ( Preferences ), 1 (Repositories) from which one can add/remove repositories.

The use of temporary="true" in a response file is an EXCELLENT tip, thanks to Stefan :-)

Cheers, Dave


permanent link
Stefan Kahlhöfer (6111) | answered Nov 04 '14, 2:29 a.m.
As I am more and more positive that there isn't such a supported function in the Installation Manager tools, I implemented a little workaround:
The idea is to parse a response file from the current configuration file, filter the repository reference to remove and re-import the configuration using the imcl tool.
This can be done using this small shell/awk script:
#!/bin/sh
# Remove a repository reference from the Installation Manager repository registry.
# Author: Stefan Kahlhoefer
# Version: 20141103
#
# Repository path to remove should be given as first command line parameter.
repositoryPath=$1
installPath='/opt/IBM/InstallationManager'

# Get path to IM configuration file configPath=$(/usr/bin/awk -F '=' '/^cic.appDataLocation=/ { print $2 }' < $installPath/eclipse/configuration/config.ini) configFile="$configPath/.settings/com.ibm.cic.agent.core.prefs" tempResponse=$(/usr/bin/mktemp) # Parse response file from current configuration /usr/bin/echo "Parse response file from current configuration $configFile..." /usr/bin/awk -F '=' ' BEGIN { print ""; print "" } /^\/\// { # ignoring comments / options for open and closed repositories in config file next } # Parse repository references if they are not the path to remove /^com.ibm.cic.common.core.preferences.repositoryLocations/ { sub(/file\\:\/\//, "", $2); if ( $2 == "$repositoryPathToRemove" ) next else print ""; } # Parse all other preferences ! /^com.ibm.cic.common.core.preferences.repositoryLocations/ { print ""; } END { print ""; }' < $configFile > $tempResponse # Import new configuration /usr/bin/echo "Import new configuration using response file $tempResponse..." $installPath/eclipse/tools/imcl input $tempResponse rm -f $tempResponse

Your answer


Register or to post your answer.