-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathapb-wrapper
More file actions
executable file
·42 lines (31 loc) · 933 Bytes
/
apb-wrapper
File metadata and controls
executable file
·42 lines (31 loc) · 933 Bytes
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
#!/bin/bash
if [ -f /opt/apb/bin/activate ] ; then
source /opt/apb/bin/activate
fi
USER_ID=$(id -u)
if [ x"$USER_ID" != x"0" -a x"$USER_ID" != x"1001" ]; then
NSS_WRAPPER_PASSWD=/tmp/passwd.nss_wrapper
NSS_WRAPPER_GROUP=/etc/group
cp /etc/passwd $NSS_WRAPPER_PASSWD
echo "${USER_NAME:-apb}:x:$(id -u):0:${USER_NAME:-apb} user:${HOME}:/sbin/nologin" >> $NSS_WRAPPER_PASSWD
export NSS_WRAPPER_PASSWD
export NSS_WRAPPER_GROUP
LD_PRELOAD=/usr/lib64/libnss_wrapper.so
export LD_PRELOAD
fi
if ! [[ "${MINISHIFT_REGISTRY}" == "" ]]; then
gid=$(stat -c '%g' ${DOCKER_CERT_PATH}/ca.pem)
else
gid=$(stat -c '%g' /var/run/docker.sock)
fi
if GROUP=$(getent group -i $gid); then
group=$(echo $GROUP | awk -F ":" '{ print $1 }')
else
group=docker
sudo groupadd $group -g $gid
fi
if [ $UID != 0 ]; then
sudo usermod -a -G $group apb
fi
command="apb --config /.apb $@"
sg $group -c "$command"