forked from am-td444/openidm-nightly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-openidm.sh
executable file
·39 lines (33 loc) · 1.04 KB
/
run-openidm.sh
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
#!/bin/bash
# openidm=/opt/openidm
# openidmconf=/opt/repo/openidm
# openidmbin=/opt/repo/bin/openidm
# openidmzip=/opt/repo/bin/zip/openidm.zip
if [ -e "$openidmbin" ]; then
cp -r $openidmbin $openidm
else
if [ -s "$openidmzip" ]; then
unzip $openidmzip -d /opt/
else
echo "Did not find any openidm folder at $openidmbin, and don't have any open access to zipfile $openidmzip"
exit 1
fi
fi
# Copy config from repo over the newly copied openidm folder
if [ -e "$openidmconf" ]; then
cp -r $openidmconf/* $openidm/
fi
# Remove OpenDJ as repo, use postgres instead
if [ -s "$openidm/conf/repo.ds.json" ]; then
rm $openidm/conf/repo.ds.json
fi
# Get fully qualified domain name from SSL certificate
cert=/opt/repo/ssl/combined.pem
file=$openidm/resolver/boot.properties
if [ -s "$cert" ] && [ -s "$file" ]; then
export FQDN=$(openssl x509 -noout -subject -in /opt/repo/ssl/combined.pem | sed "s/^.*CN=\*\./iam./" | sed "s/^.*CN=//" | sed "s/\/.*$//")
sed -i 's/openidm.host=localhost/openidm.host=$FQDN/' $file
fi
cd $openidm
sleep 5
./startup.sh