From 122f3c401f23f84799802c7b9667bda222646487 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Wed, 8 Apr 2015 03:18:53 -0400 Subject: initial commit --- fixrtcaps | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 fixrtcaps (limited to 'fixrtcaps') diff --git a/fixrtcaps b/fixrtcaps new file mode 100755 index 0000000..ba7978d --- /dev/null +++ b/fixrtcaps @@ -0,0 +1,36 @@ +#!/bin/bash + +# Released into the public domain by B. Watson +# No warranty of any kind. If it breaks, you get to keep both pieces. + +BINDIRS="/usr/bin /usr/local/bin" + +fix_rt_caps() { + echo "Looking for JACK binaries in $1" + cd "$1" || return + find . -type f | xargs file | grep ELF.*executable | cut -d: -f1 | while read bin; do + if ldd $bin 2>/dev/null | grep -q libjack; then + echo "setting caps on $( readlink -f $1/$bin )" + /sbin/setcap cap_ipc_lock,cap_sys_nice=ep $bin + fi + done +} + +if [ "$1" = "-h" -o "$1" = "--help" ]; then + cat < + +With no arguments, the default list of directories is: + $BINDIRS +EOF + exit 0 +fi + +if [ $# = 0 ]; then + set $BINDIRS +fi + +for dir in "$@"; do fix_rt_caps $dir; done -- cgit v1.2.3