blob: b46f64b8672bd9258db294b28182b4446872a92c [file] [log] [blame]
Sebastian Dröge3b546b42015-06-07 10:43:31 +02001#!/bin/sh
2
3set -e
4
5if [ "$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öge651b1d82015-06-10 10:22:14 +02009 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öge3b546b42015-06-07 10:43:31 +020010 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öge651b1d82015-06-10 10:22:14 +020013 chmod u+s /usr/lib/@MULTIARCH@/gstreamer@GST_ABI@/gstreamer-@GST_ABI@/gst-ptp-helper
Sebastian Dröge3b546b42015-06-07 10:43:31 +020014 fi
15 else
16 echo "Setcap is not installed, falling back to setuid" >&2
Sebastian Dröge651b1d82015-06-10 10:22:14 +020017 chmod u+s /usr/lib/@MULTIARCH@/gstreamer@GST_ABI@/gstreamer-@GST_ABI@/gst-ptp-helper
Sebastian Dröge3b546b42015-06-07 10:43:31 +020018 fi
19fi
20
21#DEBHELPER#
22
23exit 0
24