]> WPIA git - nre.git/blobdiff - commonFunctions.bash
Allow finding libfaketime in multiple locations
[nre.git] / commonFunctions.bash
index 0d8b897869686aabec612d2ece4a93e5f114120e..36ffa19fad613285b80585cc1a3f0f39fe278020 100644 (file)
@@ -39,3 +39,14 @@ caSign(){ # csr,ca,config,start,end
     echo "Signed"
 }
 
+findLibfaketime() {
+    for candidate in /usr/lib/faketime/libfaketime.so.1 /usr/lib/*/faketime/libfaketime.so.1; do
+        if [[ -f "$candidate" ]]; then
+            printf '%s\n' "$candidate"
+            return
+        fi
+    done
+    printf >&2 'error: no libfaketime found\n'
+    exit 1 # unfortunately, this will only exit the $() subshell
+}
+