mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2025-01-31 16:36:14 +00:00
Newer, better, tsocks(1)-like wrapper script for D.U.M.A.
/trunk/scripts/build/debug/duma.in | 44 44 0 0 ++++++++++++++++++++++++++++++++++++++++ /trunk/scripts/build/debug/200-duma.sh | 12 3 9 0 +++-------- 2 files changed, 47 insertions(+), 9 deletions(-)
This commit is contained in:
parent
15483af16b
commit
08ca782e76
@ -58,15 +58,9 @@ do_debug_duma_build() {
|
|||||||
CT_DoLog EXTRA "Installing wrapper script"
|
CT_DoLog EXTRA "Installing wrapper script"
|
||||||
mkdir -p "${CT_DEBUG_INSTALL_DIR}/usr/bin"
|
mkdir -p "${CT_DEBUG_INSTALL_DIR}/usr/bin"
|
||||||
# Install a simpler, smaller, safer wrapper than the one provided by D.U.M.A.
|
# Install a simpler, smaller, safer wrapper than the one provided by D.U.M.A.
|
||||||
cat >"${CT_DEBUG_INSTALL_DIR}/usr/bin/duma" <<_EOF_
|
sed -r -e 's:^LIBDUMA_SO=.*:LIBDUMA_SO=/usr/lib/'"${duma_so}"':;' \
|
||||||
#!/bin/sh
|
"${CT_LIB_DIR}/scripts/build/debug/duma.in" \
|
||||||
if [ \$# -eq 0 ]; then
|
>"${CT_DEBUG_INSTALL_DIR}/usr/bin/duma"
|
||||||
echo "Usage: \$0 <executable [args]>"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
export LD_PRELOAD="${duma_so}"
|
|
||||||
exec "\$@"
|
|
||||||
_EOF_
|
|
||||||
chmod 755 "${CT_DEBUG_INSTALL_DIR}/usr/bin/duma"
|
chmod 755 "${CT_DEBUG_INSTALL_DIR}/usr/bin/duma"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
44
scripts/build/debug/duma.in
Normal file
44
scripts/build/debug/duma.in
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# (C) 2008 Yann E. MORIN <yann.morin.1998@anciens.enib.fr>
|
||||||
|
# Licensed under the GPL v.2
|
||||||
|
|
||||||
|
LIBDUMA_SO=
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
-on)
|
||||||
|
case "${LD_PRELOAD}" in
|
||||||
|
*${LIBDUMA_SO}*) ;;
|
||||||
|
*) LD_PRELOAD="${LIBDUMA_SO} ${LD_PRELOAD}";;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-off)
|
||||||
|
LD_PRELOAD="${LD_PRELOAD//${LIBDUMA_SO}/}"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-show)
|
||||||
|
case "${LD_PRELOAD}" in
|
||||||
|
*${LIBDUMA_SO}*) echo "duma is enabled";;
|
||||||
|
*) echo "duma is disabled";;
|
||||||
|
esac
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
"")
|
||||||
|
cat <<_EOF_
|
||||||
|
Usage:
|
||||||
|
. $0 <-on|-off|-show>
|
||||||
|
Sets, unsets or show DUMA usage.
|
||||||
|
$0 <executable [arg...]>
|
||||||
|
Execute 'executable' (with arguments 'args') using DUMA.
|
||||||
|
_EOF_
|
||||||
|
false # Don't 'exit', we could well be source'd
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
exec "$0" -on "$@"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
export LD_PRELOAD
|
||||||
|
if [ -n "$1" ]; then
|
||||||
|
exec "$@"
|
||||||
|
fi
|
Loading…
x
Reference in New Issue
Block a user