-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathinstall-cnis.sh
executable file
·32 lines (30 loc) · 1018 Bytes
/
install-cnis.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
#!/bin/sh
# Choose which default cni binaries should be copied
SKIP_CNI_BINARIES=${SKIP_CNI_BINARIES:-""}
SKIP_CNI_BINARIES=",$SKIP_CNI_BINARIES,"
UPDATE_CNI_BINARIES=${UPDATE_CNI_BINARIES:-"true"}
# Place the new binaries if the directory is writeable.
for dir in /host/opt/cni/bin
do
if [ ! -w "$dir" ];
then
echo "$dir is non-writeable, skipping"
continue
fi
for path in /opt/cni/bin/*;
do
filename="$(basename "$path")"
tmp=",$filename,"
if [ "${SKIP_CNI_BINARIES#*$tmp}" != "$SKIP_CNI_BINARIES" ];
then
echo "$filename is in SKIP_CNI_BINARIES, skipping"
continue
fi
if [ "${UPDATE_CNI_BINARIES}" != "true" ] && [ -f $dir/"$filename" ];
then
echo "$dir/$filename is already here and UPDATE_CNI_BINARIES isn't true, skipping"
continue
fi
cp "$path" $dir/ && echo "copied $path to $dir correctly" || exit_with_error "Failed to copy $path to $dir. This may be caused by selinux configuration on the host, or something else."
done
done