Sebastian Dröge | 3b546b4 | 2015-06-07 10:43:31 +0200 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | set -e |
| 4 | |
| 5 | if [ "$1" = configure ]; then |
| 6 | # If we have setcap is installed, try setting cap_net_bind_service,cap_net_admin+ep, |
| 7 | # which allows us to install our helper binary without the setuid bit. |
| 8 | if command -v setcap > /dev/null; then |
Sebastian Dröge | 651b1d8 | 2015-06-10 10:22:14 +0200 | [diff] [blame] | 9 | if setcap cap_net_bind_service,cap_net_admin+ep /usr/lib/@MULTIARCH@/gstreamer@GST_ABI@/gstreamer-@GST_ABI@/gst-ptp-helper; then |
Sebastian Dröge | 3b546b4 | 2015-06-07 10:43:31 +0200 | [diff] [blame] | 10 | echo "Setcap worked! gst-ptp-helper is not suid!" |
| 11 | else |
| 12 | echo "Setcap failed on gst-ptp-helper, falling back to setuid" >&2 |
Sebastian Dröge | 651b1d8 | 2015-06-10 10:22:14 +0200 | [diff] [blame] | 13 | chmod u+s /usr/lib/@MULTIARCH@/gstreamer@GST_ABI@/gstreamer-@GST_ABI@/gst-ptp-helper |
Sebastian Dröge | 3b546b4 | 2015-06-07 10:43:31 +0200 | [diff] [blame] | 14 | fi |
| 15 | else |
| 16 | echo "Setcap is not installed, falling back to setuid" >&2 |
Sebastian Dröge | 651b1d8 | 2015-06-10 10:22:14 +0200 | [diff] [blame] | 17 | chmod u+s /usr/lib/@MULTIARCH@/gstreamer@GST_ABI@/gstreamer-@GST_ABI@/gst-ptp-helper |
Sebastian Dröge | 3b546b4 | 2015-06-07 10:43:31 +0200 | [diff] [blame] | 18 | fi |
| 19 | fi |
| 20 | |
| 21 | #DEBHELPER# |
| 22 | |
| 23 | exit 0 |
| 24 | |