From 97ae5166768831d8a117b435bdf2d5206d21a408 Mon Sep 17 00:00:00 2001
From: Andrei Stoian <andrei.stoian@zama.ai>
Date: Fri, 6 Dec 2024 15:27:02 +0100
Subject: [PATCH] fix: install cmake

---
 script/make_utils/setup_os_deps.sh | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/script/make_utils/setup_os_deps.sh b/script/make_utils/setup_os_deps.sh
index 897ba9494..43e2dc302 100755
--- a/script/make_utils/setup_os_deps.sh
+++ b/script/make_utils/setup_os_deps.sh
@@ -90,17 +90,22 @@ linux_install_github_cli () {
 }
 
 linux_install_cmake () {
-    sudo apt-get update
-    sudo apt-get -y install ca-certificates gpg wget
+    ${SUDO_BIN:+$SUDO_BIN} apt-get update
+    ${SUDO_BIN:+$SUDO_BIN} apt-get -y install ca-certificates gpg wget
     test -f /usr/share/doc/kitware-archive-keyring/copyright ||
-    wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
-    echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ focal main' | sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null
-    sudo apt-get update
-    test -f /usr/share/doc/kitware-archive-keyring/copyright || sudo rm /usr/share/keyrings/kitware-archive-keyring.gpg
-    sudo apt-get install -y  kitware-archive-keyring
-    echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ focal-rc main' | sudo tee -a /etc/apt/sources.list.d/kitware.list >/dev/null
-    sudo apt-get update
-    sudo apt-get -y install cmake    
+    wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | \
+        gpg --dearmor - | \
+        ${SUDO_BIN:+$SUDO_BIN} tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
+    echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ focal main' | \
+        ${SUDO_BIN:+$SUDO_BIN} tee /etc/apt/sources.list.d/kitware.list >/dev/null
+    ${SUDO_BIN:+$SUDO_BIN} apt-get update
+    test -f /usr/share/doc/kitware-archive-keyring/copyright || \
+        ${SUDO_BIN:+$SUDO_BIN} rm /usr/share/keyrings/kitware-archive-keyring.gpg
+    ${SUDO_BIN:+$SUDO_BIN} apt-get install -y  kitware-archive-keyring
+    echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ focal-rc main' | \
+        ${SUDO_BIN:+$SUDO_BIN} tee -a /etc/apt/sources.list.d/kitware.list >/dev/null
+    ${SUDO_BIN:+$SUDO_BIN} apt-get update
+    ${SUDO_BIN:+$SUDO_BIN} apt-get -y install cmake    
 }
 
 OS_NAME=$(uname)