File tree Expand file tree Collapse file tree 4 files changed +46
-5
lines changed
Expand file tree Collapse file tree 4 files changed +46
-5
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ # Copyright 2020 Crunchy Data Solutions, Inc.
4+ # Licensed under the Apache License, Version 2.0 (the "License");
5+ # you may not use this file except in compliance with the License.
6+ # You may obtain a copy of the License at
7+ #
8+ # http://www.apache.org/licenses/LICENSE-2.0
9+ #
10+ # Unless required by applicable law or agreed to in writing, software
11+ # distributed under the License is distributed on an "AS IS" BASIS,
12+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ # See the License for the specific language governing permissions and
14+ # limitations under the License.
15+
16+ if ! whoami & > /dev/null
17+ then
18+ if [[ -w /etc/passwd ]]
19+ then
20+ sed " /daemon:x:2:/d" /etc/passwd >> /tmp/uid.tmp
21+ cp /tmp/uid.tmp /etc/passwd
22+ rm -f /tmp/uid.tmp
23+ echo " ${USER_NAME:- daemon} :x:$( id -u) :0:${USER_NAME:- daemon} user:${HOME} :/bin/bash" >> /etc/passwd
24+ fi
25+ fi
26+ exec " $@ "
Original file line number Diff line number Diff line change @@ -16,8 +16,16 @@ RUN yum -y install epel-release \
1616 which \
1717 gettext
1818
19- USER daemon
20-
2119COPY installers/ansible /ansible
2220COPY installers/image/bin/pgo-deploy.sh /pgo-deploy.sh
2321COPY installers/image/inventory_template /inventory_template
22+ COPY bin/uid_daemon.sh /uid_daemon.sh
23+
24+ RUN chmod g=u /etc/passwd
25+ RUN chmod g=u /uid_daemon.sh
26+
27+ ENTRYPOINT ["/uid_daemon.sh"]
28+
29+ USER daemon
30+
31+ CMD ["/pgo-deploy.sh"]
Original file line number Diff line number Diff line change @@ -134,7 +134,6 @@ spec:
134134 restartPolicy : Never
135135 containers :
136136 - name : pgo-deploy
137- command : ["/pgo-deploy.sh"]
138137 image : registry.developers.crunchydata.com/crunchydata/pgo-deployer:centos7-4.3.1
139138 imagePullPolicy : IfNotPresent
140139 env :
Original file line number Diff line number Diff line change @@ -16,8 +16,16 @@ RUN yum install -y https://download.fedoraproject.org/pub/epel/epel-release-late
1616 which \
1717 gettext
1818
19- USER daemon
20-
2119COPY installers/ansible /ansible
2220COPY installers/image/bin/pgo-deploy.sh /pgo-deploy.sh
2321COPY installers/image/inventory_template /inventory_template
22+ COPY bin/uid_daemon.sh /uid_daemon.sh
23+
24+ RUN chmod g=u /etc/passwd
25+ RUN chmod g=u /uid_daemon.sh
26+
27+ ENTRYPOINT ["/uid_daemon.sh"]
28+
29+ USER daemon
30+
31+ CMD ["/pgo-deploy.sh"]
You can’t perform that action at this time.
0 commit comments