forked from adoptium/installer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create-installer-mac.sh
executable file
·92 lines (79 loc) · 2.67 KB
/
create-installer-mac.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
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
#!/bin/bash
################################################################################
# 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
#
# https://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.
################################################################################
set -eu
if [ -f ~/.password ]; then
security unlock-keychain -p `cat ~/.password` login.keychain-db
fi
set +u
if [ -z "$CERTIFICATE" ]; then
SIGN_CMD=
SIGN_CERT=
else
SIGN_CMD="--sign"
SIGN_CERT="${CERTIFICATE}"
fi
set -u
set +u
if [ -z "$SEARCH_PATTERN" ]; then
SEARCH_PATTERN=OpenJDK*-j*.tar.gz
fi
set -u
cd pkgbuild
for f in $WORKSPACE/workspace/target/${SEARCH_PATTERN};
do tar -xf "$f";
echo "Processing: $f"
rm -rf Resources/license.rtf
case $f in
*hotspot*)
export JVM="hotspot"
;;
*openj9*)
export JVM="openj9"
;;
*)
echo Cannot identify variant from filename "${f}" - only hotspot or openj9 are allowable
exit 1
;;
esac
# Detect if JRE or JDK
case $f in
*-jre_*)
TYPE="jre"
;;
*)
TYPE="jdk"
;;
esac
# Detect architecture
case $f in
*x64*)
ARCHITECTURE="x86_64"
;;
*aarch64*)
ARCHITECTURE="arm64"
;;
esac
directory=$(ls -d jdk*)
file=${f%%.tar.gz*}
if [ -z "$SIGN_CMD" ]; then
echo running "./packagesbuild.sh --major_version ${MAJOR_VERSION} --full_version ${FULL_VERSION} --input_directory ${directory} --output_directory ${file}.pkg --jvm ${JVM} --architecture ${ARCHITECTURE} --type ${TYPE}"
./packagesbuild.sh --major_version ${MAJOR_VERSION} --full_version ${FULL_VERSION} --input_directory ${directory} --output_directory ${file}.pkg --jvm ${JVM} --architecture ${ARCHITECTURE} --type ${TYPE}
else
echo running "./packagesbuild.sh ${SIGN_CMD} "${SIGN_CERT}" --major_version ${MAJOR_VERSION} --full_version ${FULL_VERSION} --input_directory ${directory} --output_directory ${file}.pkg --jvm ${JVM} --architecture ${ARCHITECTURE} --type ${TYPE}"
./packagesbuild.sh ${SIGN_CMD} "${SIGN_CERT}" --major_version ${MAJOR_VERSION} --full_version ${FULL_VERSION} --input_directory ${directory} --output_directory ${file}.pkg --jvm ${JVM} --architecture ${ARCHITECTURE} --type ${TYPE}
fi
rm -rf ${directory}
rm -rf ${f}
done