aboutgitcodelistschat:MatrixIRC
path: root/seitan-run
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2023-06-02 19:40:31 +0200
committerStefano Brivio <sbrivio@redhat.com>2023-06-02 19:40:31 +0200
commitd5e4e57926308e72bbfdda19ba148654fd3eac62 (patch)
tree9735ae100115d2c49a48238b2876177d101b96e8 /seitan-run
parentab0013984c8d4f38b4898b1ccc19d198bef0f371 (diff)
downloadseitan-d5e4e57926308e72bbfdda19ba148654fd3eac62.tar
seitan-d5e4e57926308e72bbfdda19ba148654fd3eac62.tar.gz
seitan-d5e4e57926308e72bbfdda19ba148654fd3eac62.tar.bz2
seitan-d5e4e57926308e72bbfdda19ba148654fd3eac62.tar.lz
seitan-d5e4e57926308e72bbfdda19ba148654fd3eac62.tar.xz
seitan-d5e4e57926308e72bbfdda19ba148654fd3eac62.tar.zst
seitan-d5e4e57926308e72bbfdda19ba148654fd3eac62.zip
Introduce seitan-run
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'seitan-run')
-rwxr-xr-xseitan-run37
1 files changed, 37 insertions, 0 deletions
diff --git a/seitan-run b/seitan-run
new file mode 100755
index 0000000..76986e1
--- /dev/null
+++ b/seitan-run
@@ -0,0 +1,37 @@
+# SPDX-License-Identifier: AGPL-3.0-or-later
+#
+#!/bin/sh -ex
+#
+# seitan - Syscall Expressive Interpreter, Transformer and Notifier
+#
+# seitan-run - Convenience script: run target command with syscall model
+#
+# Copyright (c) 2022 Red Hat GmbH
+# Authors: Alice Frosi <afrosi@redhat.com>
+# Stefano Brivio <sbrivio@redhat.com>
+
+usage() {
+ echo "${0} JSON COMMAND"
+ exit 1
+}
+
+[ ${#} -lt 2 ] && usage
+
+[ -z "${DIR}" ] && DIR="$(mktemp -d)"
+
+[ -z "${COOKER}" ] && COOKER="$(command -v ./seitan-cooker seitan-cooker)"
+[ -z "${COOKER}" ] && echo "seitan-cooker not found" && exit 1
+
+[ -z "${EATER}" ] && EATER="$(command -v ./seitan-eater seitan-eater)"
+[ -z "${EATER}" ] && echo "seitan-eater not found" && exit 1
+
+[ -z "${SEITAN}" ] && SEITAN="$(command -v ./seitan seitan)"
+[ -z "${SEITAN}" ] && echo "seitan not found" && exit 1
+
+"${COOKER}" "${1}" "${DIR}/gluten" "${DIR}/bpf"
+shift
+( "${EATER}" -i "${DIR}/bpf" -- ${@} & echo "${!}" > "${DIR}/eater.pid" 2>&1 ) &
+sleep 1
+"${SEITAN}" -p "$(cat ${DIR}/eater.pid)" -i "${DIR}/gluten"
+
+rm -rf "${DIR}"