if [ -x /sbin/setcap ]; then
    # Give all binaries in the package realtime capabilities:
    JACKBINS=( jack_control
jack_cpu_load
jack_midiseq
jack_midi_latency_test
jack_property
jack_cpu
jack_net_slave
jack_unload
jack_simple_session_client
jack_midi_dump
jack_netsource
alsa_out
jack_wait
jack_simple_client
jack_server_control
alsa_in
jack_test
jack_load
jack_bufsize
jack_alias
jack_thru
jack_net_master
jack_session_notify
jack_multiple_metro
jack_midisine
jack_samplerate
jack_transport
jack_latent_client
jack_connect
jackd
jack_simdtests
jack_evmon
jack_metro
jack_zombie
jackdbus
jack_monitor_client
jack_rec
jack_showtime
jack_iodelay
jack_freewheel
jack_lsp )
    for EXE in ${JACKBINS[@]}; do
      /sbin/setcap cap_ipc_lock,cap_sys_nice=ep usr/bin/$EXE
    done
fi

# Write an entry into fstab for the RAM-based tmpfs that jack wants to
# see mounted on /dev/shm (for the low-latency!!!).
if [ -f etc/fstab ]; then
  if ! grep -q "/dev/shm" etc/fstab ; then
    echo "# Next line added for jack audio - it will not harm your system" >> etc/fstab
    echo "none    /dev/shm    tmpfs    defaults    0 0" >> etc/fstab
  fi
fi
if ! mount | grep -q "/dev/shm" ; then
  mount /dev/shm 2>/dev/null
fi
( cd usr/bin ; rm -rf jack_disconnect )
( cd usr/bin ; ln -sf jack_connect jack_disconnect )
( cd usr/lib64 ; rm -rf libjack.so )
( cd usr/lib64 ; ln -sf libjack.so.0.1.0 libjack.so )
( cd usr/lib64 ; rm -rf libjack.so.0 )
( cd usr/lib64 ; ln -sf libjack.so.0.1.0 libjack.so.0 )
( cd usr/lib64 ; rm -rf libjacknet.so )
( cd usr/lib64 ; ln -sf libjacknet.so.0.1.0 libjacknet.so )
( cd usr/lib64 ; rm -rf libjacknet.so.0 )
( cd usr/lib64 ; ln -sf libjacknet.so.0.1.0 libjacknet.so.0 )
( cd usr/lib64 ; rm -rf libjackserver.so )
( cd usr/lib64 ; ln -sf libjackserver.so.0.1.0 libjackserver.so )
( cd usr/lib64 ; rm -rf libjackserver.so.0 )
( cd usr/lib64 ; ln -sf libjackserver.so.0.1.0 libjackserver.so.0 )
