Skip to content

Commit 7c42bf4

Browse files
t-lok8s-infra-cherrypick-robot
authored andcommitted
fix: shasum correct binary in blobfuse-proxy installer for Flatcar
The blobfuse-proxy installer script used with Flatcar, install-proxy-rhcos.sh, uses sha256sum to check whether blobfuse binaries need to be (re-installed). If the checksum of blobfuse2 on the host and blobfuse2 shipped with the container differ, the host blobfuse2 is replaced. However, for Flatcar, we use a custom name for the blobfuse2 binary on the host ("blobfuse2.bin") and ship a wrapper script named "blobfuse2" to update the linker path for blobfuse2. The shasum check did not account for this and inadvertently generated a checksum for the wrapper script instead of the actual binary. This change fixes that. Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
1 parent 121070f commit 7c42bf4

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

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

Lines changed: 18 additions & 11 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

0 commit comments

Comments
 (0)