-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathentrypoint.sh
50 lines (45 loc) · 1.74 KB
/
entrypoint.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
#!/bin/sh
# Make sure openaf can access /var/run/docker.sock
if [ -e /var/run/docker.sock ]; then
sudo chown root:openaf /var/run/docker.sock
fi
# Make sure openaf can access /run/crio/crio.sock
if [ -e /run/crio/crio.sock ]; then
sudo chown root:openaf /run/crio/crio.sock
fi
# Make sure openaf can access /run/containerd/containerd.sock
if [ -e /run/containerd/containerd.sock ]; then
sudo chown root:openaf /run/containerd/containerd.sock
fi
# Using the env variable REGAUTH is a list of new-line separated or '|||' separated registries where each line follows
# the format "registry,username,password" to login to the registry
if [ -n "$REGAUTH" ]; then
OLDIFS="$IFS"
IFS='|||'
for entry in $REGAUTH; do
IFS=','
echo "$entry" | {
read -r registry username password
if [ -n "$registry" ] && [ -n "$username" ] && [ -n "$password" ]; then
echo "Logging into $registry" >&2
echo -n " docker: " >&2 && echo "$password" | docker login "$registry" --username "$username" --password-stdin 2>/dev/null
echo -n " skopeo: " >&2 && echo "$password" | skopeo login --username "$username" --password-stdin "$registry" --tls-verify=false
echo -n " helm : " >&2 && echo "$password" | helm registry login "$registry" --username "$username" --password-stdin --insecure
echo -n " syft : " >&2 && echo "$password" | syft login $registry -u $username --password-stdin
echo "" >&2
fi
}
IFS="$OLDIFS"
done
unset REGAUTH
fi
# Execute /usr/bin/usage-help if no argument is provided otherwise execute the provided command
if [ $# -eq 0 ]; then
/usr/bin/usage-help
else
# if doesn't include sudo include sudo
#if [ "$1" != "sudo" ]; then
# set -- sudo -E "$@"
#fi
exec "$@"
fi