@@ -29,101 +29,98 @@ echo "Linux distribution: $DISTRIBUTION"
2929ARCH=$( $HOST_CMD uname -m)
3030echo " Linux Arch is $( uname -m) "
3131
32- if [ " ${ARCH } " ! = " aarch64 " ]
32+ if [ " ${DISTRIBUTION } " = " ubuntu " ] && { [ " ${INSTALL_BLOBFUSE} " = " true " ] || [ " ${INSTALL_BLOBFUSE2} " = " true " ] ; }
3333then
34- if [ " ${DISTRIBUTION} " = " ubuntu" ] && { [ " ${INSTALL_BLOBFUSE} " = " true" ] || [ " ${INSTALL_BLOBFUSE2} " = " true" ]; }
34+ release=$( $HOST_CMD lsb_release -rs)
35+ echo " Ubuntu release: $release "
36+
37+ if [ " $( expr " $release " \< " 22.04" ) " -eq 1 ]
3538 then
36- release=$( $HOST_CMD lsb_release -rs)
37- echo " Ubuntu release: $release "
38-
39- if [ " $( expr " $release " \< " 22.04" ) " -eq 1 ]
40- then
41- cp /blobfuse-proxy/packages-microsoft-prod-18.04.deb /host/etc/packages-microsoft-prod.deb
39+ cp /blobfuse-proxy/packages-microsoft-prod-18.04.deb /host/etc/packages-microsoft-prod.deb
40+ else
41+ cp /blobfuse-proxy/packages-microsoft-prod-22.04.deb /host/etc/packages-microsoft-prod.deb
42+ fi
43+
44+ # when running dpkg -i /etc/packages-microsoft-prod.deb, need to enter y to continue.
45+ # refer to https://stackoverflow.com/questions/45349571/how-to-install-deb-with-dpkg-non-interactively
46+ yes | $HOST_CMD dpkg -i /etc/packages-microsoft-prod.deb && $HOST_CMD apt update
47+
48+ pkg_list=" "
49+ if [ " ${INSTALL_BLOBFUSE} " = " true" ] && [ " $( expr " $release " \< " 22.04" ) " -eq 1 ]
50+ then
51+ pkg_list=" ${pkg_list} fuse"
52+ # install blobfuse with latest version or specific version
53+ if [ -z " ${BLOBFUSE_VERSION} " ]; then
54+ echo " install blobfuse with latest version"
55+ pkg_list=" ${pkg_list} blobfuse"
4256 else
43- cp / blobfuse-proxy/packages-microsoft-prod-22.04.deb /host/etc/packages-microsoft-prod.deb
57+ pkg_list= " ${pkg_list} blobfuse= ${BLOBFUSE_VERSION} "
4458 fi
45-
46- # when running dpkg -i /etc/packages-microsoft-prod.deb, need to enter y to continue.
47- # refer to https://stackoverflow.com/questions/45349571/how-to-install-deb-with-dpkg-non-interactively
48- yes | $HOST_CMD dpkg -i /etc/packages-microsoft-prod.deb && $HOST_CMD apt update
49-
50- pkg_list=" "
51- if [ " ${INSTALL_BLOBFUSE} " = " true" ] && [ " $( expr " $release " \< " 22.04" ) " -eq 1 ]
52- then
59+ fi
60+
61+ if [ " ${INSTALL_BLOBFUSE2} " = " true" ]
62+ then
63+ if [ " $( expr " $release " \< " 22.04" ) " -eq 1 ]; then
64+ echo " install fuse for blobfuse2"
5365 pkg_list=" ${pkg_list} fuse"
54- # install blobfuse with latest version or specific version
55- if [ -z " ${BLOBFUSE_VERSION} " ]; then
56- echo " install blobfuse with latest version"
57- pkg_list=" ${pkg_list} blobfuse"
58- else
59- pkg_list=" ${pkg_list} blobfuse=${BLOBFUSE_VERSION} "
60- fi
66+ else
67+ echo " install fuse3 for blobfuse2, current release is $release "
68+ pkg_list=" ${pkg_list} fuse3"
6169 fi
6270
63- if [ " ${INSTALL_BLOBFUSE2} " = " true" ]
64- then
65- if [ " $( expr " $release " \< " 22.04" ) " -eq 1 ]; then
66- echo " install fuse for blobfuse2"
67- pkg_list=" ${pkg_list} fuse"
68- else
69- echo " install fuse3 for blobfuse2, current release is $release "
70- pkg_list=" ${pkg_list} fuse3"
71- fi
72-
73- # install blobfuse2 with latest version or specific version
74- if [ -z " ${BLOBFUSE2_VERSION} " ]; then
75- echo " install blobfuse2 with latest version"
76- pkg_list=" ${pkg_list} blobfuse2"
77- else
78- pkg_list=" ${pkg_list} blobfuse2=${BLOBFUSE2_VERSION} "
79- fi
71+ # install blobfuse2 with latest version or specific version
72+ if [ -z " ${BLOBFUSE2_VERSION} " ]; then
73+ echo " install blobfuse2 with latest version"
74+ pkg_list=" ${pkg_list} blobfuse2"
75+ else
76+ pkg_list=" ${pkg_list} blobfuse2=${BLOBFUSE2_VERSION} "
8077 fi
81- echo " begin to install ${pkg_list} "
82- $HOST_CMD apt-get install -y $pkg_list
83- $HOST_CMD rm -f /etc/packages-microsoft-prod.deb
8478 fi
79+ echo " begin to install ${pkg_list} "
80+ $HOST_CMD apt-get install -y $pkg_list
81+ $HOST_CMD rm -f /etc/packages-microsoft-prod.deb
82+ fi
8583
86- updateBlobfuseProxy=" true"
87- if [ -f " /host/usr/bin/blobfuse-proxy" ]; then
88- old=$( sha256sum /host/usr/bin/blobfuse-proxy | awk ' {print $1}' )
89- new=$( sha256sum /blobfuse-proxy/blobfuse-proxy | awk ' {print $1}' )
90- if [ " $old " = " $new " ]; then
91- updateBlobfuseProxy=" false"
92- echo " no need to update blobfuse-proxy"
93- fi
84+ updateBlobfuseProxy=" true"
85+ if [ -f " /host/usr/bin/blobfuse-proxy" ]; then
86+ old=$( sha256sum /host/usr/bin/blobfuse-proxy | awk ' {print $1}' )
87+ new=$( sha256sum /blobfuse-proxy/blobfuse-proxy | awk ' {print $1}' )
88+ if [ " $old " = " $new " ]; then
89+ updateBlobfuseProxy=" false"
90+ echo " no need to update blobfuse-proxy"
9491 fi
92+ fi
9593
96- if [ " $updateBlobfuseProxy " = " true" ]; then
97- echo " copy blobfuse-proxy...."
98- rm -rf /host/var/lib/kubelet/plugins/blob.csi.azure.com/blobfuse-proxy.sock
99- rm -rf /host/usr/bin/blobfuse-proxy
100- cp /blobfuse-proxy/blobfuse-proxy /host/usr/bin/blobfuse-proxy
101- chmod 755 /host/usr/bin/blobfuse-proxy
102- fi
94+ if [ " $updateBlobfuseProxy " = " true" ]; then
95+ echo " copy blobfuse-proxy...."
96+ rm -rf /host/var/lib/kubelet/plugins/blob.csi.azure.com/blobfuse-proxy.sock
97+ rm -rf /host/usr/bin/blobfuse-proxy
98+ cp /blobfuse-proxy/blobfuse-proxy /host/usr/bin/blobfuse-proxy
99+ chmod 755 /host/usr/bin/blobfuse-proxy
100+ fi
103101
104- updateService=" true"
105- if [ -f " /host/usr/lib/systemd/system/blobfuse-proxy.service" ]; then
106- old=$( sha256sum /host/usr/lib/systemd/system/blobfuse-proxy.service | awk ' {print $1}' )
107- new=$( sha256sum /blobfuse-proxy/blobfuse-proxy.service | awk ' {print $1}' )
108- if [ " $old " = " $new " ]; then
109- updateService=" false"
110- echo " no need to update blobfuse-proxy.service"
111- fi
102+ updateService=" true"
103+ if [ -f " /host/usr/lib/systemd/system/blobfuse-proxy.service" ]; then
104+ old=$( sha256sum /host/usr/lib/systemd/system/blobfuse-proxy.service | awk ' {print $1}' )
105+ new=$( sha256sum /blobfuse-proxy/blobfuse-proxy.service | awk ' {print $1}' )
106+ if [ " $old " = " $new " ]; then
107+ updateService=" false"
108+ echo " no need to update blobfuse-proxy.service"
112109 fi
110+ fi
113111
114- if [ " $updateService " = " true" ]; then
115- echo " copy blobfuse-proxy.service...."
116- mkdir -p /host/usr/lib/systemd/system
117- cp /blobfuse-proxy/blobfuse-proxy.service /host/usr/lib/systemd/system/blobfuse-proxy.service
118- fi
112+ if [ " $updateService " = " true" ]; then
113+ echo " copy blobfuse-proxy.service...."
114+ mkdir -p /host/usr/lib/systemd/system
115+ cp /blobfuse-proxy/blobfuse-proxy.service /host/usr/lib/systemd/system/blobfuse-proxy.service
116+ fi
119117
120- if [ " ${INSTALL_BLOBFUSE_PROXY} " = " true" ]; then
121- if [ " $updateBlobfuseProxy " = " true" ] || [ " $updateService " = " true" ]; then
122- echo " start blobfuse-proxy...."
123- $HOST_CMD systemctl daemon-reload
124- $HOST_CMD systemctl enable blobfuse-proxy.service
125- $HOST_CMD systemctl restart blobfuse-proxy.service
126- fi
118+ if [ " ${INSTALL_BLOBFUSE_PROXY} " = " true" ]; then
119+ if [ " $updateBlobfuseProxy " = " true" ] || [ " $updateService " = " true" ]; then
120+ echo " start blobfuse-proxy...."
121+ $HOST_CMD systemctl daemon-reload
122+ $HOST_CMD systemctl enable blobfuse-proxy.service
123+ $HOST_CMD systemctl restart blobfuse-proxy.service
127124 fi
128125fi
129126
0 commit comments