#!%{_bindir}/bash # file: irtrans-server.sh # # Stupid IRTrans server does not recognize symlinks. Invoking it as # irtrans-server /dev/irtrans # where `/dev/irtrans` is a symlink to `/dev/ttyUSB0`, causes error "Cannot resolve device # /dev/irtrans". Let's resolve symlink to let it work: set -e args=( "$@" ) if [[ ${#args[@]} -gt 0 ]]; then idx=$(( ${#args[@]} - 1 )) device=${args[$idx]} if [[ -L $device ]]; then device=$( %{_bindir}/realpath -P "$device" ) fi args[$idx]=$device fi exec %{_libexecdir}/irtrans/%{name}.bin "${args[@]}" # end of file #