This repository has been archived by the owner on Dec 15, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathupdate.sh
executable file
·56 lines (49 loc) · 1.93 KB
/
update.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
while getopts ":n:s:" opt; do
case $opt in
n) nexusVersion="$OPTARG";;
s) nexusVersionShort="$OPTARG";;
esac
done
if [[ -z "${nexusVersion+set}" ]]; then
echo 'Nexus Version must be provided with -n'
exit 1
fi
if [[ -z "${nexusVersionShort+set}" ]]; then
echo 'Nexus Version Short (Release Name) must be provided with -s'
exit 1
fi
if ! [ -x "$(command -v md2man-roff)" ]; then
echo 'md2man-roff must be installed to use this update script'
exit 1
fi
sedStr="
s!%%NEXUS_VERSION%%!$nexusVersion!g;
s!%%NEXUS_VERSION_SHORT%%!$nexusVersionShort!g;
"
# Variants that are not compatible with TravisCI
for variant in rhel; do
if [ ! -d "$nexusVersionShort/$variant" ]; then
mkdir -p $nexusVersionShort/$variant
fi
sed -e "$sedStr" "Dockerfile-$variant.template" > $nexusVersionShort/$variant/Dockerfile
md2man-roff help.md > $nexusVersionShort/$variant/help.1
cp uid_entrypoint $nexusVersionShort/$variant/uid_entrypoint
cp -r licenses $nexusVersionShort/$variant
done
travisEnv=
for variant in centos; do
if [ ! -d "$nexusVersionShort/$variant" ]; then
mkdir -p $nexusVersionShort/$variant
fi
sed -e "$sedStr" "Dockerfile-$variant.template" > $nexusVersionShort/$variant/Dockerfile
md2man-roff help.md > $nexusVersionShort/$variant/help.1
cp uid_entrypoint $nexusVersionShort/$variant/uid_entrypoint
cp -r licenses $nexusVersionShort/$variant
travisEnv='\n - VERSION='"$nexusVersionShort VARIANT=$variant$travisEnv"
done
travis="$(awk -v 'RS=\n' '$1 == "env:" { $0 = "env:'"$travisEnv"'" } { printf "%s%s", $0, RS }' .travis.yml)"
echo "$travis" > .travis.yml
osCentos="$(sed -e 's#"contextDir": ".*/centos"#"contextDir": "'"${nexusVersionShort}"'/centos"#g' ./OpenShift/nexus-centos.json)"
echo "$osCentos" > ./OpenShift/nexus-centos.json
osRhel="$(sed -e 's#"contextDir": ".*/rhel"#"contextDir": "'"${nexusVersionShort}"'/rhel"#g' ./OpenShift/nexus-rhel.json)"
echo "$osRhel" > ./OpenShift/nexus-rhel.json