@@ -50,7 +50,7 @@ get_openssl_version() {
5050 openssl_version=$( openssl version -v | cut -d' ' -f2 | cut -d' .' -f1)
5151 elif command -v rpm > /dev/null 2>&1 ; then
5252 echo " [INFO] rpm command is available"
53- openssl_version=$( rpm -qa | grep openssl-libs | cut -d ' - ' -f3 | cut -d' .' -f1)
53+ openssl_version=$( rpm -q --qf ' %{VERSION}\n ' openssl-libs 2> /dev/null | cut -d' .' -f1)
5454 else
5555 echo " [INFO] openssl and rpm commands are not available, trying to detect OpenSSL version..."
5656 get_libssl_version
@@ -73,47 +73,55 @@ ls -la /checode/
7373export MACHINE_EXEC_PORT=3333
7474nohup /checode/bin/machine-exec --url " 127.0.0.1:${MACHINE_EXEC_PORT} " &
7575
76- # Start the checode component based on musl or libc
77-
78- # detect if we're using alpine/musl
79- libc=$( ldd /bin/ls | grep ' musl' | head -1 | cut -d ' ' -f1)
80- if [ -n " $libc " ]; then
81- echo " [INFO] Using linux-musl assembly..."
82- export LD_LIBRARY_PATH=" /checode/checode-linux-musl/ld_libs:${LD_LIBRARY_PATH:- } "
83- echo " [INFO] LD_LIBRARY_PATH is: $LD_LIBRARY_PATH "
84- cd /checode/checode-linux-musl || exit
85- else
76+ runtime_ld_library_path=" "
8677
78+ # detect if we're using alpine/musl (avoid grep dependency for micro images)
79+ ldd_output=$( ldd /bin/ls 2> /dev/null || true)
80+ case " $ldd_output " in
81+ * musl* )
82+ echo " [INFO] Using linux-musl assembly..."
83+ runtime_ld_library_path=" /checode/checode-linux-musl/ld_libs"
84+ cd /checode/checode-linux-musl || exit
85+ ;;
86+ * )
87+
8788 get_openssl_version
8889 echo " [INFO] OpenSSL major version is: $openssl_version ."
8990
9091 case " ${openssl_version} " in
9192 * " 1" * )
92- export LD_LIBRARY_PATH=" /checode/checode-linux-libc/ubi8/ld_libs:${LD_LIBRARY_PATH:- } "
93- echo " [INFO] LD_LIBRARY_PATH is: $LD_LIBRARY_PATH "
9493 echo " [INFO] Using linux-libc ubi8-based assembly..."
94+ runtime_ld_library_path=" /checode/checode-linux-libc/ubi8/ld_libs"
9595 cd /checode/checode-linux-libc/ubi8 || exit
9696 ;;
9797 * " 3" * )
98- export LD_LIBRARY_PATH=" /checode/checode-linux-libc/ubi9/ld_libs:${LD_LIBRARY_PATH:- } "
99- echo " [INFO] LD_LIBRARY_PATH is: $LD_LIBRARY_PATH "
10098 echo " [INFO] Using linux-libc ubi9-based assembly..."
99+ runtime_ld_library_path=" /checode/checode-linux-libc/ubi9/ld_libs/core"
100+ if [ -d " /checode/checode-linux-libc/ubi9/ld_libs/openssl" ]; then
101+ runtime_ld_library_path=" /checode/checode-linux-libc/ubi9/ld_libs/openssl:${runtime_ld_library_path} "
102+ fi
101103 cd /checode/checode-linux-libc/ubi9 || exit
102104 ;;
103105 * )
104106 echo " [WARNING] Unsupported OpenSSL major version, linux-libc ubi9-based assembly will be used by default..."
105- export LD_LIBRARY_PATH=" /checode/checode-linux-libc/ubi9/ld_libs:${LD_LIBRARY_PATH:- } "
106- echo " [INFO] LD_LIBRARY_PATH is: $LD_LIBRARY_PATH "
107+ runtime_ld_library_path=" /checode/checode-linux-libc/ubi9/ld_libs/core"
108+ if [ -d " /checode/checode-linux-libc/ubi9/ld_libs/openssl" ]; then
109+ runtime_ld_library_path=" /checode/checode-linux-libc/ubi9/ld_libs/openssl:${runtime_ld_library_path} "
110+ fi
107111 cd /checode/checode-linux-libc/ubi9 || exit
108112 ;;
109113 esac
114+ ;;
115+ esac
116+
117+ if [ -n " $runtime_ld_library_path " ]; then
118+ export LD_LIBRARY_PATH=" ${runtime_ld_library_path}${LD_LIBRARY_PATH: +: $LD_LIBRARY_PATH } "
119+ echo " [INFO] LD_LIBRARY_PATH is: $LD_LIBRARY_PATH "
110120fi
111121
112122# Set the default path to the serverDataFolderName
113123# into a persistent volume
114124export VSCODE_AGENT_FOLDER=/checode/remote
115- # Prevent bundled runtime LD_LIBRARY_PATH from leaking into integrated terminal shell env.
116- export CHECODE_STRIP_LD_LIBRARY_PATH_FOR_SHELL_ENV=1
117125
118126if [ -z " $VSCODE_NODEJS_RUNTIME_DIR " ]; then
119127 export VSCODE_NODEJS_RUNTIME_DIR=" $( pwd) "
0 commit comments