1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
|
#!/bin/bash
# config-changed occurs everytime a new configuration value is updated (juju set)
set -e
WAS_ND_INSTALL_PATH=/root/IBM/WebSphere/AppServer/V85/ND
# Check whether IM is installed
is_im_installed()
{
if [ -f $IM_INSTALL_PATH/eclipse/IBMIM ]; then
echo "True"
else
echo "False"
fi
}
# Check whether WAS ND is installed
is_was_nd_installed()
{
if [ -d $WAS_ND_INSTALL_PATH/bin ]; then
echo "True"
else
echo "False"
fi
}
# Remove was nd, if installed
remove_was_nd_software()
{
was_nd_installed=`is_was_nd_installed`
if [ $was_nd_installed == True ]; then
juju-log "Removing WAS ND Installation"
# Uninstalling WAS ND
cd $IM_INSTALL_PATH/eclipse/tools
sudo ./imcl uninstall com.ibm.websphere.liberty.ND.v85 -installationDirectory $WAS_ND_INSTALL_PATH
fi
juju-log "Uninstalling WAS ND software completed"
}
#Remove IM, if installed
remove_im_software()
{
im_installed=`is_im_installed`
if [ $im_installed == True ]; then
juju-log "Removing IBM WebSphere IM software."
cd /root/var/ibm/InstallationManager/uninstall
#Uninstalling IM
./uninstall --launcher.ini user-silent-uninstall.ini
fi
}
# Remove WAS ND if license not accpeted
remove_unaccepted_software()
{
if [ $1 == False ]; then
juju-log "Removing IBM WebSphere (if installed) as the license agreement is not accepted."
if [ -f $IM_INSTALL_PATH/eclipse/IBMIM ]; then
juju-log "IM exists "
remove_was_nd_software
else
juju-log "IM not exists and hence exiting from WAS unistalling"
exit 0
fi
fi
if [ $2 == False ]; then
juju-log "Removing IBM IM (if installed) as the license agreement is not accepted."
#Check any dependent products exists like WAS
if [ -d $WAS_ND_INSTALL_PATH/bin ]; then
juju-log "Can not uninstall IM as its has WAS product installed"
exit 0
else
juju-log "Uninstall IM software"
remove_im_software
fi
fi
}
juju-log "Websphere WAS ND: Begin config-change hook"
was_nd_license_accepted=`config-get accept-ibm-was-nd-license`
im_license_accepted=`config-get accept-ibm-im-license`
IM_INSTALL_PATH=`config-get im_install_path`
# Remove IM and WAS if license not accepted and exit. Else install it
remove_unaccepted_software $was_nd_license_accepted $im_license_accepted
if [ $im_license_accepted == False ]; then
juju-log "Websphere IM License not accepted."
elif [ $im_license_accepted == True ]; then
juju-log "License accepted"
im_inst=`is_im_installed`
if [ $im_inst == False ]; then
juju-log "IM installation start"
# Check IM package availability
juju-log $CHARM_DIR
if [ -f $CHARM_DIR/files/archives/IM/userinstc ];
then
juju-log "IM Packages available for installation.";
cp $CHARM_DIR/files/archives/IM/install.xml $CHARM_DIR/files/archives/IM/silent_install.xml
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
$CHARM_DIR/files/archives/IM/userinstc -input $CHARM_DIR/files/archives/IM/silent_install.xml -acceptlicense
if [ $? == 0 ]
then
juju-log "IM Is installed successfully"
else
juju-log "Error while installing IM"
exit 1
fi
else
juju-log "IM Packages missing. Please check README file.";
juju-log "Upgrade IM charm after adding the IM packages";
exit 1
fi
fi
else
juju-log " Acceptable values for license is 'True' or 'False'"
fi
if [ $was_nd_license_accepted == False ]; then
juju-log "Websphere ND License not accepted."
elif [ $was_nd_license_accepted == True ]; then
juju-log "Check WAS ND package availability"
# check WAS package availability
if [ -d "$CHARM_DIR/files/archives/disk1" ]; then
juju-log "WAS ND Packages available for installation.";
#Check IM installation
im_installed=`is_im_installed`
if [ $im_installed == True ]; then
juju-log "Installing WAS ND "
cd $IM_INSTALL_PATH/eclipse/tools
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
if [ $? == 0 ]
then
juju-log " WAS Base is installed successfully"
else
juju-log "Error while installing WAS"
exit 1
fi
else
juju-log "IM is not installaed to install WAS"
exit 0
fi
juju-log "creating a profile"
cd $WAS_ND_INSTALL_PATH/bin
#sh does not work in ubuntu so linking to bash
juju-log "Unlink /bin/sh"
sudo unlink /bin/sh
sudo ln -s /bin/bash /bin/sh
juju-log "creating a profile"
juju-log "updating /etc/hosts with hostname"
# Need to update hostname in /etc/hosts
private_address=`unit-get private-address`
juju-log "private_address : $private_address"
echo "$private_address `hostname`" >> /etc/hosts
if [ $? == 0 ]
then
juju-log "hostname updated"
else
juju-log "Error while updating /etc/hosts"
fi
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"
juju-log "Profile creation completed"
#Apply fixpack 8.5.5.4 to upgrade was nd version from 8.5.5.0 to 8.5.5.4
juju-log "Upgrading WAS Base"
cd $IM_INSTALL_PATH/eclipse/tools
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
if [ $? == 0 ]
then
juju-log " WAS fixpack installed successfully"
else
juju-log "Error while installing WAS fixpack"
exit 1
fi
else
juju-log "WAS ND Packages are not available "
fi
fi
|