]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
install-deps: extract SUDO variable logic into a reusable function
authorJohn Mulligan <jmulligan@redhat.com>
Sat, 15 Mar 2025 16:44:00 +0000 (12:44 -0400)
committerKamoltat Sirivadhna <ksirivad@redhat.com>
Fri, 10 Oct 2025 19:18:41 +0000 (19:18 +0000)
While the function is pretty simple and could be copy-pasted I
prefer to extract things into functions to indicate that the
logic is used/repeated elsewhere to ward off making changes to
one copy vs the other.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit bbd7933598e11d84758a6f09fd176f47c744aaa2)
(cherry picked from commit 69b7dd8333fbec11db8cb9c9cd70554477034b7c)

install-deps.sh

index 17cff6d6abf28e232f66033737d1d28ff75f91ee..335b348c7fd7792f5a2ab17866ace860495e419c 100755 (executable)
@@ -23,9 +23,7 @@ fi
 DIR=/tmp/install-deps.$$
 trap "rm -fr $DIR" EXIT
 mkdir -p $DIR
-if test $(id -u) != 0 ; then
-    SUDO=sudo
-fi
+wrap_sudo
 # enable UTF-8 encoding for programs like pip that expect to
 # print more than just ascii chars
 export LC_ALL=C.UTF-8