Fix the problem with the firewall
[oom/offline-installer.git] / bash / tools / create_si_onap_pkg.sh
1 #! /usr/bin/env bash
2
3 #   COPYRIGHT NOTICE STARTS HERE
4 #
5 #   Copyright 2018 © Samsung Electronics Co., Ltd.
6 #
7 #   Licensed under the Apache License, Version 2.0 (the "License");
8 #   you may not use this file except in compliance with the License.
9 #   You may obtain a copy of the License at
10 #
11 #       http://www.apache.org/licenses/LICENSE-2.0
12 #
13 #   Unless required by applicable law or agreed to in writing, software
14 #   distributed under the License is distributed on an "AS IS" BASIS,
15 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 #   See the License for the specific language governing permissions and
17 #   limitations under the License.
18 #
19 #   COPYRIGHT NOTICE ENDS HERE
20
21
22 # fail fast
23 set -e
24
25 # boilerplate
26 RELATIVE_PATH=./ # relative path from this script to 'common-functions.sh'
27 if [ "$IS_COMMON_FUNCTIONS_SOURCED" != YES ] ; then
28     SCRIPT_DIR=$(dirname "${0}")
29     LOCAL_PATH=$(readlink -f "$SCRIPT_DIR")
30     . "${LOCAL_PATH}"/"${RELATIVE_PATH}"/common-functions.sh
31 fi
32
33 if [ -z "$1" ]; then
34   VERSION="RC3"
35   message info "no argument supplied, keeping default naming: $VERSION"
36 else
37   VERSION="$1"
38 fi
39
40 # name of the self-extract-installer
41 TARGET_FILE="$APROJECT_DIR/selfinstall_onap_beijing_"$VERSION".sh"
42
43 # inserting the head of the script
44 cat > "$TARGET_FILE" <<EOF
45 #! /usr/bin/env bash
46
47 #
48 # This is self-extract installer for onap
49 #
50
51 # fail fast
52 set -e
53
54 # boilerplate
55 SCRIPT_DIR=\$(dirname "\${0}")
56 APROJECT_DIR=\$(readlink -f "\$SCRIPT_DIR")
57 IS_SELF_EXTRACT=YES
58
59 EOF
60
61 # splicing the scripts together
62 cat "${LOCAL_PATH}"/"${RELATIVE_PATH}"/common-functions.sh >> "$TARGET_FILE"
63 cat "${LOCAL_PATH}"/"${RELATIVE_PATH}"/deploy_nexus.sh >> "$TARGET_FILE"
64 cat "${LOCAL_PATH}"/"${RELATIVE_PATH}"/deploy_kube.sh >> "$TARGET_FILE"
65
66 # finishing touches to the script
67 cat >> "$TARGET_FILE" <<EOF
68
69 exit 0
70
71 #
72 # Installer script ends here
73 # The rest of this file is a binary payload
74 # ! DO NOT MODIFY IT !
75 #
76
77 # PAYLOAD BELOW #
78 EOF
79
80 # appending the tar to the script
81 cd "$APROJECT_DIR"
82 tar -h --exclude='.git' --exclude='*.swp' --exclude='selfinstall_onap_*.sh' --exclude='ansible' --exclude='docker' --exclude='local_repo.conf' --exclude='live' -cvf - * >> "$TARGET_FILE"
83 cd -
84
85 chmod 755 "$TARGET_FILE"
86 message info "Created Nexus self installation file: $TARGET_FILE"
87
88 exit 0