forked from coldnew/docker-yocto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint
executable file
·42 lines (28 loc) · 927 Bytes
/
entrypoint
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 [ -z "${HOST_USER}" ]; then
echo "ERROR: We need HOST_USER to be set!"; exit 100
fi
if [ -z "${HOST_UID}" ]; then
echo "ERROR: We need HOST_UID be set" ; exit 100
fi
if [ -z "${HOST_GID}" ]; then
echo "ERROR: We need HOST_GID be set" ; exit 100
fi
if [ -z "${HOST_GROUP}" ]; then
echo "ERROR: We need HOST_GROUP be set" ; exit 100
fi
groupadd -g ${HOST_GID} ${HOST_GROUP}
useradd ${HOST_USER} --shell /bin/bash --create-home \
--uid ${HOST_UID} --gid ${HOST_GID}
echo ${HOST_USER} ${HOST_UID} ${HOST_GID}
ls /home
tail -n 1 /etc/sudoers | grep -q "ALL ALL = (ALL) NOPASSWD: ALL" || \
echo 'ALL ALL = (ALL) NOPASSWD: ALL' >> /etc/sudoers
chown -R ${HOST_UID}:${HOST_GID} /home/${HOST_USER}
az extension add --name azure-devops
sudo mkdir /yocto-cache
sudo chown ${HOST_USER}:${HOST_USER} /yocto-cache
# switch to current user
#exec su "${HOST_USER}"
# enter to shell
exec /bin/bash