aboutsummaryrefslogtreecommitdiffstats
path: root/packages/docker/src/main/docker/do-start.sh
blob: 91402e620be2de8fdfa0e53f2392feae77ff6072 (plain)
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
#!/bin/bash
###
# ============LICENSE_START=======================================================
# 
# ================================================================================
# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ============LICENSE_END=========================================================
###

# skip installation if build.info file is present (restarting an existing container)
if [[ -f ${POLICY_HOME}/etc/build.info ]]; then
	echo "Found existing installation, will not reinstall"
	. ${POLICY_HOME}/etc/profile.d/env.sh
else 
	echo "installing .."

	# replace conf files from installer with environment-specific files
	# mounted from the hosting VM
	if [[ -d config ]]; then
		cp config/*.conf .
	fi

	if [[ -f config/drools-preinstall.sh ]] ; then
		echo "found preinstallation script"
		bash config/drools-preinstall.sh
	fi

	# remove broken symbolic links if any in data directory
	if [[ -d ${POLICY_HOME}/config ]]; then
		echo "removing dangling symbolic links"
		find -L ${POLICY_HOME}/config -type l -exec rm -- {} +
	fi

	apps=$(ls config/apps*.zip 2> /dev/null)
	for app in $apps
	do
	    echo "Application found: ${app}"
	    unzip -o ${app}
	done

    feats=$(ls config/feature*.zip 2> /dev/null)
    for feat in $feats
    do
        echo "Feature found: ${feat}"
        cp ${feat} .
    done

	echo "docker install at ${PWD}"

	./docker-install.sh

	. ${POLICY_HOME}/etc/profile.d/env.sh

	# allow user to override the key or/and the trust stores

	if [[ -f config/policy-keystore ]]; then
	    cp -f config/policy-keystore ${POLICY_HOME}/etc/ssl
	fi

	if [[ -f config/policy-truststore ]]; then
	    cp -f config/policy-truststore ${POLICY_HOME}/etc/ssl
	fi

	# allow user to override all or some aaf configuration

	if [[ -f config/aaf.properties ]]; then
	    cp -f config/aaf.properties ${POLICY_HOME}/config/aaf.properties
	fi

	if [[ -f config/aaf-location.properties ]]; then
	    cp -f config/aaf-location.properties ${POLICY_HOME}/config/aaf-location.properties
	fi

	if [[ -f config/aaf-credentials.properties ]]; then
	    cp -f config/aaf-credentials.properties ${POLICY_HOME}/config/aaf-credentials.properties
	fi

	if [[ -f config/aaf-cadi.keyfile ]]; then
	    cp -f config/aaf-cadi.keyfile ${POLICY_HOME}/config/aaf-cadi.keyfile
	fi

	if [[ -f config/drools-tweaks.sh ]] ; then
		echo "Executing tweaks"
		# file may not be executable; running it as an
		# argument to bash avoids needing execute perms.
		bash config/drools-tweaks.sh
	fi
fi

echo "Starting processes"

policy start

tail -f /dev/null