entrypoint
1.12 KB
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
#!/bin/bash
set -ex
TARGET_USER=hostuser
TARGET_GROUP=hostgroup
target_home="$(getent passwd "$TARGET_USER" | cut -f 6 -d :)"
if [[ $GID && $GID -ne 0 ]]; then
groupmod -g $GID "$TARGET_GROUP"
fi
if [[ $UID && $UID -ne 0 ]]; then
usermod -u $UID "$TARGET_USER"
fi
find "$target_home" \
'(' -not -user "$TARGET_USER" -a -not -group "$TARGET_GROUP" -exec chown "$TARGET_USER:$TARGET_GROUP" '{}' + ')' -o \
'(' -not -user "$TARGET_USER" -exec chown "$TARGET_USER" '{}' + ')' -o \
'(' -not -group "$TARGET_GROUP" -exec chgrp "$TARGET_GROUP" '{}' + ')' -o \
-true
if [[ $http_proxy =~ ^([^:]+)://([^/:]*)(:([0-9]+?))?(/.*)?$ ]]; then
http_proxy_protocol="${BASH_REMATCH[1]}"
http_proxy_domain="${BASH_REMATCH[2]}"
http_proxy_port="${BASH_REMATCH[4]}"
fi
if [[ $http_proxy ]]; then
mkdir -p "$target_home/.m2"
cat > "$target_home/.m2/settings.xml" << _EOF_
<settings>
<proxies>
<proxy>
<id>app-build-proxy</id>
<active>true</active>
<protocol>${http_proxy_protocol}</protocol>
<host>${http_proxy_domain}</host>
<port>${http_proxy_port}</port>
</proxy>
</proxies>
</settings>
_EOF_
fi
exec "$@"