summaryrefslogtreecommitdiffstats
path: root/CMake/run_if_exists.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 09:59:37 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 09:59:37 +0000
commit76e2632459410dec81337edb6a9fee33c9a660f3 (patch)
treea73345df208eede4a4daad340515c9328f34625c /CMake/run_if_exists.sh
parentInitial commit. (diff)
downloadapt-76e2632459410dec81337edb6a9fee33c9a660f3.tar.xz
apt-76e2632459410dec81337edb6a9fee33c9a660f3.zip
Adding upstream version 2.7.12.upstream/2.7.12
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'CMake/run_if_exists.sh')
-rwxr-xr-xCMake/run_if_exists.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/CMake/run_if_exists.sh b/CMake/run_if_exists.sh
new file mode 100755
index 0000000..97edd4c
--- /dev/null
+++ b/CMake/run_if_exists.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+# Small helper for running a command
+out=""
+if [ "$1" = "--stdout" ]; then
+ out="$2"
+ shift 2
+fi
+
+if [ -e "$1" ]; then
+ shift
+ if [ "$out" ]; then
+ exec "$@" > $out
+ else
+ exec "$@"
+ fi
+fi