-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-entrypoint-zowe.sh
executable file
·67 lines (55 loc) · 1.71 KB
/
docker-entrypoint-zowe.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
#!/bin/bash
#########################################################
# Setup ENTRYPOINT script when running the image: #
# - Installs Zowe CLI and plugins for root #
# - Installs Zowe CLI and plugins for jenkins #
#########################################################
# Exit if any commands fail
set -e
# Do the original entrypoint
# Extract Node.js version from env var
VERSION=$NODE_JS_NVM_VERSION
TAG=$PKG_TAG
# Special behavior for root, then jenkins
if [ $UID == "0" ]; then
if [ -z "$VERSION" ]; then
echo "No version specified"
else
# Execute the node installation script
echo "Installing Node.js version $VERSION for current user..."
install_node.sh $VERSION
# Execute the script for user jenkins
echo "Installing Node.js version $VERSION for jenkins user..."
su -c "install_node.sh $VERSION" - jenkins
if [ -z "$TAG" ]; then
TAG=zowe-v3-lts
fi
fi
if [ ! -z "$TAG" ]; then
# Do the install for jenkins
su -w ALLOW_PLUGIN_INSTALL_FAIL -c "install_zowe.sh $TAG" - jenkins
fi
if [ "$USE_ZOWE_DAEMON" == "true" ]; then
su -c "enable_daemon.sh" - jenkins
fi
else
if [ -z "$VERSION" ]; then
echo "No version specified"
else
# Execute the node installation script
echo "Installing Node.js version $VERSION for current user..."
install_node.sh $VERSION
if [ -z "$TAG" ]; then
TAG=zowe-v3-lts
fi
fi
if [ ! -z "$TAG" ]; then
# Do the install
install_zowe.sh $TAG
fi
if [ "$USE_ZOWE_DAEMON" == "true" ]; then
enable_daemon.sh
fi
fi
# Execute passed cmd
exec "$@"