From 6c6696362daf0ccfac5a609f2e4edb5c152b0df3 Mon Sep 17 00:00:00 2001 From: weizhichen Date: Tue, 25 Apr 2023 14:49:04 +0000 Subject: [PATCH 1/6] fix : init.sh --- pkg/blobfuse-proxy/init.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/blobfuse-proxy/init.sh b/pkg/blobfuse-proxy/init.sh index 556d5cf65..12045e1cd 100755 --- a/pkg/blobfuse-proxy/init.sh +++ b/pkg/blobfuse-proxy/init.sh @@ -24,7 +24,10 @@ READ_AHEAD_KB=${READ_AHEAD_KB:-15380} HOST_CMD="nsenter --mount=/proc/1/ns/mnt" -if [ "${INSTALL_BLOBFUSE}" = "true" ] || [ "${INSTALL_BLOBFUSE2}" = "true" ] +DISTRIBUTION=$($HOST_CMD cat /etc/os-release | grep ^ID= | cut -d'=' -f2 | tr -d '"') +echo "Linux distribution: $DISTRIBUTION" + +if [ "${DISTRIBUTION}" = "ubuntu" ] && ([ "${INSTALL_BLOBFUSE}" = "true" ] || [ "${INSTALL_BLOBFUSE2}" = "true" ]) then cp /blobfuse-proxy/packages-microsoft-prod.deb /host/etc/ # when running dpkg -i /etc/packages-microsoft-prod.deb, need to enter y to continue. @@ -34,7 +37,9 @@ then pkg_list="" if [ "${INSTALL_BLOBFUSE}" = "true" ] then - pkg_list="${pkg_list} fuse" + if [ "$release" = "18.04" ]; then + pkg_list="${pkg_list} fuse" + fi # install blobfuse with latest version or specific version if [ -z "${BLOBFUSE_VERSION}" ]; then echo "install blobfuse with latest version" From 6ef550abbc9eee94bc6feb502bd1b9eaa60681a4 Mon Sep 17 00:00:00 2001 From: weizhichen Date: Wed, 26 Apr 2023 02:54:16 +0000 Subject: [PATCH 2/6] fix init.sh --- pkg/blobfuse-proxy/init.sh | 18 ++++++++++++------ pkg/blobplugin/Dockerfile | 5 +++-- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/pkg/blobfuse-proxy/init.sh b/pkg/blobfuse-proxy/init.sh index 12045e1cd..e0d481b23 100755 --- a/pkg/blobfuse-proxy/init.sh +++ b/pkg/blobfuse-proxy/init.sh @@ -29,17 +29,24 @@ echo "Linux distribution: $DISTRIBUTION" if [ "${DISTRIBUTION}" = "ubuntu" ] && ([ "${INSTALL_BLOBFUSE}" = "true" ] || [ "${INSTALL_BLOBFUSE2}" = "true" ]) then - cp /blobfuse-proxy/packages-microsoft-prod.deb /host/etc/ + release=$($HOST_CMD lsb_release -rs) + echo "Ubuntu release: $release" + + if [ "$release" = "22.04" ] + then + cp /blobfuse-proxy/packages-microsoft-prod-22.04.deb /host/etc/packages-microsoft-prod.deb + else + cp /blobfuse-proxy/packages-microsoft-prod-18.04.deb /host/etc/packages-microsoft-prod.deb + fi + # when running dpkg -i /etc/packages-microsoft-prod.deb, need to enter y to continue. # refer to https://stackoverflow.com/questions/45349571/how-to-install-deb-with-dpkg-non-interactively yes | $HOST_CMD dpkg -i /etc/packages-microsoft-prod.deb && $HOST_CMD apt update pkg_list="" - if [ "${INSTALL_BLOBFUSE}" = "true" ] + if [ "${INSTALL_BLOBFUSE}" = "true" ] && [ "$release" = "18.04" ] then - if [ "$release" = "18.04" ]; then - pkg_list="${pkg_list} fuse" - fi + pkg_list="${pkg_list} fuse" # install blobfuse with latest version or specific version if [ -z "${BLOBFUSE_VERSION}" ]; then echo "install blobfuse with latest version" @@ -51,7 +58,6 @@ then if [ "${INSTALL_BLOBFUSE2}" = "true" ] then - release=$($HOST_CMD lsb_release -rs) if [ "$release" = "18.04" ]; then echo "install fuse for blobfuse2" pkg_list="${pkg_list} fuse" diff --git a/pkg/blobplugin/Dockerfile b/pkg/blobplugin/Dockerfile index 8be4bb1c9..2dae098c0 100644 --- a/pkg/blobplugin/Dockerfile +++ b/pkg/blobplugin/Dockerfile @@ -33,8 +33,9 @@ RUN apt update && apt upgrade -y && apt-mark unhold libcap2 && clean-install ca- ARG ARCH=amd64 RUN if [ "$ARCH" = "amd64" ] ; then \ clean-install libcurl4-gnutls-dev && \ - wget -O /blobfuse-proxy/packages-microsoft-prod.deb https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb && \ - dpkg -i /blobfuse-proxy/packages-microsoft-prod.deb && apt update && apt install blobfuse blobfuse2 fuse -y && apt remove wget -y; fi + wget -O /blobfuse-proxy/packages-microsoft-prod-22.04.deb https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb && \ + wget -O /blobfuse-proxy/packages-microsoft-prod-18.04.deb https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb && \ + dpkg -i /blobfuse-proxy/packages-microsoft-prod-18.04.deb && apt update && apt install blobfuse blobfuse2 fuse -y && apt remove wget -y; fi LABEL maintainers="andyzhangx" LABEL description="Azure Blob Storage CSI driver" From e08134bebdf20cc0647d97fe80b98155e56b5183 Mon Sep 17 00:00:00 2001 From: weizhichen Date: Wed, 26 Apr 2023 03:05:13 +0000 Subject: [PATCH 3/6] fix init.sh --- pkg/blobfuse-proxy/init.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/blobfuse-proxy/init.sh b/pkg/blobfuse-proxy/init.sh index e0d481b23..1518ff8bf 100755 --- a/pkg/blobfuse-proxy/init.sh +++ b/pkg/blobfuse-proxy/init.sh @@ -32,11 +32,11 @@ then release=$($HOST_CMD lsb_release -rs) echo "Ubuntu release: $release" - if [ "$release" = "22.04" ] + if [ "$release" \< "22.04" ] then - cp /blobfuse-proxy/packages-microsoft-prod-22.04.deb /host/etc/packages-microsoft-prod.deb - else cp /blobfuse-proxy/packages-microsoft-prod-18.04.deb /host/etc/packages-microsoft-prod.deb + else + cp /blobfuse-proxy/packages-microsoft-prod-22.04.deb /host/etc/packages-microsoft-prod.deb fi # when running dpkg -i /etc/packages-microsoft-prod.deb, need to enter y to continue. @@ -44,7 +44,7 @@ then yes | $HOST_CMD dpkg -i /etc/packages-microsoft-prod.deb && $HOST_CMD apt update pkg_list="" - if [ "${INSTALL_BLOBFUSE}" = "true" ] && [ "$release" = "18.04" ] + if [ "${INSTALL_BLOBFUSE}" = "true" ] && [ "$release" \< "22.04" ] then pkg_list="${pkg_list} fuse" # install blobfuse with latest version or specific version @@ -58,7 +58,7 @@ then if [ "${INSTALL_BLOBFUSE2}" = "true" ] then - if [ "$release" = "18.04" ]; then + if [ "$release" \< "22.04" ]; then echo "install fuse for blobfuse2" pkg_list="${pkg_list} fuse" else From 4c400bfb16ac1f20453318ee89b16e81c33cdfb3 Mon Sep 17 00:00:00 2001 From: weizhichen Date: Wed, 26 Apr 2023 03:44:08 +0000 Subject: [PATCH 4/6] fix shellcheck --- pkg/blobfuse-proxy/init.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/blobfuse-proxy/init.sh b/pkg/blobfuse-proxy/init.sh index 1518ff8bf..8aacaad42 100755 --- a/pkg/blobfuse-proxy/init.sh +++ b/pkg/blobfuse-proxy/init.sh @@ -32,7 +32,7 @@ then release=$($HOST_CMD lsb_release -rs) echo "Ubuntu release: $release" - if [ "$release" \< "22.04" ] + if [ $(expr "$release" \< "22.04") -eq 1 ] then cp /blobfuse-proxy/packages-microsoft-prod-18.04.deb /host/etc/packages-microsoft-prod.deb else @@ -44,7 +44,7 @@ then yes | $HOST_CMD dpkg -i /etc/packages-microsoft-prod.deb && $HOST_CMD apt update pkg_list="" - if [ "${INSTALL_BLOBFUSE}" = "true" ] && [ "$release" \< "22.04" ] + if [ "${INSTALL_BLOBFUSE}" = "true" ] && [ $(expr "$release" \< "22.04") -eq 1 ] then pkg_list="${pkg_list} fuse" # install blobfuse with latest version or specific version @@ -58,7 +58,7 @@ then if [ "${INSTALL_BLOBFUSE2}" = "true" ] then - if [ "$release" \< "22.04" ]; then + if [ $(expr "$release" \< "22.04") -eq 1 ]; then echo "install fuse for blobfuse2" pkg_list="${pkg_list} fuse" else From c986b15a8116cc3872d12100e6df4702105234f3 Mon Sep 17 00:00:00 2001 From: weizhichen Date: Wed, 26 Apr 2023 03:54:14 +0000 Subject: [PATCH 5/6] fix shellcheck --- pkg/blobfuse-proxy/init.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/blobfuse-proxy/init.sh b/pkg/blobfuse-proxy/init.sh index 8aacaad42..1461c96c7 100755 --- a/pkg/blobfuse-proxy/init.sh +++ b/pkg/blobfuse-proxy/init.sh @@ -27,12 +27,12 @@ HOST_CMD="nsenter --mount=/proc/1/ns/mnt" DISTRIBUTION=$($HOST_CMD cat /etc/os-release | grep ^ID= | cut -d'=' -f2 | tr -d '"') echo "Linux distribution: $DISTRIBUTION" -if [ "${DISTRIBUTION}" = "ubuntu" ] && ([ "${INSTALL_BLOBFUSE}" = "true" ] || [ "${INSTALL_BLOBFUSE2}" = "true" ]) +if [ "${DISTRIBUTION}" = "ubuntu" ] && { [ "${INSTALL_BLOBFUSE}" = "true" ] || [ "${INSTALL_BLOBFUSE2}" = "true" ]; } then release=$($HOST_CMD lsb_release -rs) echo "Ubuntu release: $release" - if [ $(expr "$release" \< "22.04") -eq 1 ] + if [ "$(expr "$release" \< "22.04")" -eq 1 ] then cp /blobfuse-proxy/packages-microsoft-prod-18.04.deb /host/etc/packages-microsoft-prod.deb else @@ -44,7 +44,7 @@ then yes | $HOST_CMD dpkg -i /etc/packages-microsoft-prod.deb && $HOST_CMD apt update pkg_list="" - if [ "${INSTALL_BLOBFUSE}" = "true" ] && [ $(expr "$release" \< "22.04") -eq 1 ] + if [ "${INSTALL_BLOBFUSE}" = "true" ] && [ "$(expr "$release" \< "22.04")" -eq 1 ] then pkg_list="${pkg_list} fuse" # install blobfuse with latest version or specific version @@ -58,7 +58,7 @@ then if [ "${INSTALL_BLOBFUSE2}" = "true" ] then - if [ $(expr "$release" \< "22.04") -eq 1 ]; then + if [ "$(expr "$release" \< "22.04")" -eq 1 ]; then echo "install fuse for blobfuse2" pkg_list="${pkg_list} fuse" else @@ -75,7 +75,7 @@ then fi fi echo "begin to install ${pkg_list}" - $HOST_CMD apt-get install -y $pkg_list + $HOST_CMD apt-get install -y "$pkg_list" $HOST_CMD rm -f /etc/packages-microsoft-prod.deb fi From 585a69e0501f6cf127818107ff56491392e19de2 Mon Sep 17 00:00:00 2001 From: weizhichen Date: Wed, 26 Apr 2023 04:01:35 +0000 Subject: [PATCH 6/6] fix init.sh --- pkg/blobfuse-proxy/init.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/blobfuse-proxy/init.sh b/pkg/blobfuse-proxy/init.sh index 1461c96c7..40643f51a 100755 --- a/pkg/blobfuse-proxy/init.sh +++ b/pkg/blobfuse-proxy/init.sh @@ -75,7 +75,7 @@ then fi fi echo "begin to install ${pkg_list}" - $HOST_CMD apt-get install -y "$pkg_list" + $HOST_CMD apt-get install -y $pkg_list $HOST_CMD rm -f /etc/packages-microsoft-prod.deb fi