Skip to content

Commit b88365b

Browse files
authored
Merge pull request #2221 from k8s-infra-cherrypick-robot/cherry-pick-2216-to-release-1.27
[release-1.27] 🐞 fix: shasum in blobfuse-proxy installer for Flatcar, fix PATH in blobfuse-proxy.service
2 parents 4c08931 + a292b25 commit b88365b

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

pkg/blobfuse-proxy/install-proxy-rhcos.sh

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,12 @@ updateBlobfuse2="true"
3535
if [ "${INSTALL_BLOBFUSE}" = "true" ] || [ "${INSTALL_BLOBFUSE2}" = "true" ]
3636
then
3737
if [ -f "/host${BIN_PATH}/blobfuse2" ];then
38-
old=$(sha256sum /host${BIN_PATH}/blobfuse2 | awk '{print $1}')
38+
if [ "$DISTRIBUTION" = "flatcar" ] ; then
39+
# Flatcar uses a custom binary name and provides a wrapper script library loader, see below
40+
old=$(sha256sum /host${BIN_PATH}/blobfuse2.bin | awk '{print $1}')
41+
else
42+
old=$(sha256sum /host${BIN_PATH}/blobfuse2 | awk '{print $1}')
43+
fi
3944
new=$(sha256sum /usr/bin/blobfuse2 | awk '{print $1}')
4045
if [ "$old" = "$new" ];then
4146
updateBlobfuse2="false"
@@ -48,7 +53,18 @@ else
4853
fi
4954
if [ "$updateBlobfuse2" = "true" ];then
5055
echo "copy blobfuse2...."
51-
cp /usr/bin/blobfuse2 /host${BIN_PATH}/blobfuse2 --force
56+
if [ "$DISTRIBUTION" = "flatcar" ] ; then
57+
# No libfuse.so.* on Flatcar so we ship the container's and provide a wrapper script
58+
find /usr/ -name 'libfuse.so.*' -exec cp '{}' /host${BIN_PATH} \;
59+
cp /usr/bin/blobfuse2 /host${BIN_PATH}/blobfuse2.bin --force
60+
{
61+
echo '#!/usr/bin/bash'
62+
echo "LD_LIBRARY_PATH='${BIN_PATH}' exec ${BIN_PATH}/blobfuse2.bin \"\${@}\""
63+
} >/host${BIN_PATH}/blobfuse2
64+
chmod 755 /host${BIN_PATH}/blobfuse2.bin
65+
else
66+
cp /usr/bin/blobfuse2 /host${BIN_PATH}/blobfuse2 --force
67+
fi
5268
# if both /usr/lib/libfuse3.so.3 and target folder /host/usr/lib64/ exist, copy libfuse3.so.3 to /host/usr/lib64/
5369
if [ -f "/usr/lib/libfuse3.so.3" ] && [ -d "/host/usr/lib64/" ]; then
5470
echo "copy libfuse3.so.3 to /host/usr/lib64/"
@@ -60,15 +76,6 @@ if [ "$updateBlobfuse2" = "true" ];then
6076
cp /usr/lib64/libfuse3.so.3* /host/usr/lib64/
6177
fi
6278
chmod 755 /host${BIN_PATH}/blobfuse2
63-
if [ "$DISTRIBUTION" = "flatcar" ] ; then
64-
find /usr/ -name 'libfuse.so.*' -exec cp '{}' /host${BIN_PATH} \;
65-
mv /host${BIN_PATH}/blobfuse2 /host${BIN_PATH}/blobfuse2.bin
66-
{
67-
echo '#!/usr/bin/bash'
68-
echo "LD_LIBRARY_PATH='${BIN_PATH}' exec ${BIN_PATH}/blobfuse2.bin \"\${@}\""
69-
} >/host${BIN_PATH}/blobfuse2
70-
chmod 755 /host${BIN_PATH}/blobfuse2
71-
fi
7279
fi
7380

7481
if [ "${INSTALL_BLOBFUSE_PROXY}" = "true" ];then
@@ -94,7 +101,7 @@ if [ "${INSTALL_BLOBFUSE_PROXY}" = "true" ];then
94101
sed -i "s|/usr/bin/blobfuse-proxy|${BIN_PATH}/blobfuse-proxy|g" /blobfuse-proxy/blobfuse-proxy.service
95102
if [ "${BIN_PATH}" != "/usr/local/bin" ]; then
96103
echo "add \"PATH=${BIN_PATH}:\$PATH\" in blobfuse-proxy.service ExecStart."
97-
sed "s,^ExecStart[[:space:]]*=\\(.*\\)\$,ExecStart=/usr/bin/bash -c \"PATH=${BIN_PATH}:\$PATH \\1\"," \
104+
sed -i "s,^ExecStart[[:space:]]*=\\(.*\\)\$,ExecStart=/usr/bin/bash -c \"PATH=${BIN_PATH}:\$PATH \\1\"," \
98105
/blobfuse-proxy/blobfuse-proxy.service
99106
fi
100107
if [ -f "/host/etc/systemd/system/blobfuse-proxy.service" ];then

0 commit comments

Comments
 (0)