blob: 82d462f4894bddaa1cc4bf9d58efb842b5d5afb9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#!/bin/bash
# Released into the public domain by B. Watson <urchlay@slackware.uk>
# 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 <<EOF
$( basename $0 ) v1.0: set POSIX realtime priority and unlimited memory lock
capabilities on JACK-using binaries.
Usage: $( basename $0 ) <optional list of directories>
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
|