summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sys-block/hpacucli/files/hpacucli-wrapper')
-rw-r--r--sys-block/hpacucli/files/hpacucli-wrapper22
1 files changed, 22 insertions, 0 deletions
diff --git a/sys-block/hpacucli/files/hpacucli-wrapper b/sys-block/hpacucli/files/hpacucli-wrapper
new file mode 100644
index 000000000000..c60c205f9cfc
--- /dev/null
+++ b/sys-block/hpacucli/files/hpacucli-wrapper
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+cmd="$(basename "$0")"
+
+HPACUCLI_BASEDIR="/opt/hp/hpacucli"
+HPACUCLI_LOCKDIR="/var/lock/$cmd"
+HPACUCLI_LOCK="${HPACUCLI_LOCKDIR}/CPQACU_MUTEX"
+HPACUCLI_BIN="${HPACUCLI_BASEDIR}/$cmd.bin"
+
+if pgrep -x "$cmd.bin"; then
+ echo "Another instance of $cmd is running! Stop it first."
+ exit 1
+fi
+
+if ! [ -f "${HPACUCLI_LOCK}" ]; then
+ mkdir -p -m 700 "${HPACUCLI_LOCKDIR}"
+ touch "${HPACUCLI_LOCK}"
+fi
+
+export LD_LIBRARY_PATH="${HPACUCLI_BASEDIR}"
+export ACUXE_LOCK_FILES_DIR="${HPACUCLI_LOCKDIR}/"
+exec setarch `uname -m` --uname-2.6 "${HPACUCLI_BIN}" "${@}"