2
# config-changed occurs everytime a new configuration value is updated (juju set)
6
WAS_ND_INSTALL_PATH=/root/IBM/WebSphere/AppServer/V85/ND
7
# Check whether IM is installed
10
if [ -f $IM_INSTALL_PATH/eclipse/IBMIM ]; then
19
# Check whether WAS ND is installed
22
if [ -d $WAS_ND_INSTALL_PATH/bin ]; then
31
# Remove was nd, if installed
32
remove_was_nd_software()
35
was_nd_installed=`is_was_nd_installed`
36
if [ $was_nd_installed == True ]; then
37
juju-log "Removing WAS ND Installation"
39
cd $IM_INSTALL_PATH/eclipse/tools
40
sudo ./imcl uninstall com.ibm.websphere.liberty.ND.v85 -installationDirectory $WAS_ND_INSTALL_PATH
42
juju-log "Uninstalling WAS ND software completed"
45
#Remove IM, if installed
49
im_installed=`is_im_installed`
50
if [ $im_installed == True ]; then
51
juju-log "Removing IBM WebSphere IM software."
52
cd /root/var/ibm/InstallationManager/uninstall
54
./uninstall --launcher.ini user-silent-uninstall.ini
59
# Remove WAS ND if license not accpeted
60
remove_unaccepted_software()
63
if [ $1 == False ]; then
64
juju-log "Removing IBM WebSphere (if installed) as the license agreement is not accepted."
65
if [ -f $IM_INSTALL_PATH/eclipse/IBMIM ]; then
67
remove_was_nd_software
69
juju-log "IM not exists and hence exiting from WAS unistalling"
75
if [ $2 == False ]; then
76
juju-log "Removing IBM IM (if installed) as the license agreement is not accepted."
78
#Check any dependent products exists like WAS
80
if [ -d $WAS_ND_INSTALL_PATH/bin ]; then
81
juju-log "Can not uninstall IM as its has WAS product installed"
84
juju-log "Uninstall IM software"
92
juju-log "Websphere WAS ND: Begin config-change hook"
93
was_nd_license_accepted=`config-get accept-ibm-was-nd-license`
94
im_license_accepted=`config-get accept-ibm-im-license`
95
IM_INSTALL_PATH=`config-get im_install_path`
96
# Remove IM and WAS if license not accepted and exit. Else install it
97
remove_unaccepted_software $was_nd_license_accepted $im_license_accepted
98
if [ $im_license_accepted == False ]; then
99
juju-log "Websphere IM License not accepted."
101
elif [ $im_license_accepted == True ]; then
103
juju-log "License accepted"
104
im_inst=`is_im_installed`
105
if [ $im_inst == False ]; then
106
juju-log "IM installation start"
107
# Check IM package availability
109
if [ -f $CHARM_DIR/files/archives/IM/userinstc ];
111
juju-log "IM Packages available for installation.";
112
cp $CHARM_DIR/files/archives/IM/install.xml $CHARM_DIR/files/archives/IM/silent_install.xml
113
sed -i "2 a \<profile kind='self' installLocation='$IM_INSTALL_PATH' id='IBM Installation Manager'>\n <data key='eclipseLocation' value='$IM_INSTALL_PATH' />\n</profile>" $CHARM_DIR/files/archives/IM/silent_install.xml
114
$CHARM_DIR/files/archives/IM/userinstc -input $CHARM_DIR/files/archives/IM/silent_install.xml -acceptlicense
117
juju-log "IM Is installed successfully"
119
juju-log "Error while installing IM"
124
juju-log "IM Packages missing. Please check README file.";
125
juju-log "Upgrade IM charm after adding the IM packages";
130
juju-log " Acceptable values for license is 'True' or 'False'"
134
if [ $was_nd_license_accepted == False ]; then
135
juju-log "Websphere ND License not accepted."
137
elif [ $was_nd_license_accepted == True ]; then
138
juju-log "Check WAS ND package availability"
139
# check WAS package availability
140
if [ -d "$CHARM_DIR/files/archives/disk1" ]; then
141
juju-log "WAS ND Packages available for installation.";
142
#Check IM installation
143
im_installed=`is_im_installed`
144
if [ $im_installed == True ]; then
145
juju-log "Installing WAS ND "
146
cd $IM_INSTALL_PATH/eclipse/tools
147
sudo ./imcl install com.ibm.websphere.ND.v85 -repositories $CHARM_DIR/files/archives/ -installationDirectory $WAS_ND_INSTALL_PATH -sharedResourcesDirectory $IM_INSTALL_PATH/IMShared -acceptLicense -showProgress
150
juju-log " WAS Base is installed successfully"
152
juju-log "Error while installing WAS"
156
juju-log "IM is not installaed to install WAS"
160
juju-log "creating a profile"
161
cd $WAS_ND_INSTALL_PATH/bin
162
#sh does not work in ubuntu so linking to bash
164
juju-log "Unlink /bin/sh"
166
sudo ln -s /bin/bash /bin/sh
167
juju-log "creating a profile"
169
juju-log "updating /etc/hosts with hostname"
170
# Need to update hostname in /etc/hosts
171
private_address=`unit-get private-address`
172
juju-log "private_address : $private_address"
173
echo "$private_address `hostname`" >> /etc/hosts
176
juju-log "hostname updated"
178
juju-log "Error while updating /etc/hosts"
181
sudo ./manageprofiles.sh -create -profileName "test" -profilePath "$WAS_ND_INSTALL_PATH/profiles/test" -templatePath "$WAS_ND_INSTALL_PATH/profileTemplates/default/" -nodeName "node1" -cellName "cell1" -serverName "server1" -adminUserName "wasadmin" -adminPassword "wasadmin"
182
juju-log "Profile creation completed"
184
#Apply fixpack 8.5.5.4 to upgrade was nd version from 8.5.5.0 to 8.5.5.4
186
juju-log "Upgrading WAS Base"
187
cd $IM_INSTALL_PATH/eclipse/tools
188
sudo ./imcl install com.ibm.websphere.ND.v85_8.5.5004.20141119_1746 -repositories $CHARM_DIR/files/archives/was_fixpack/ -installationDirectory $WAS_ND_INSTALL_PATH -sharedResourcesDirectory $IM_INSTALL_PATH/IMShared -acceptLicense -showProgress
191
juju-log " WAS fixpack installed successfully"
193
juju-log "Error while installing WAS fixpack"
198
juju-log "WAS ND Packages are not available "