• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2# Meson install script for gst-ptp-helper
3# Fails silently at the moment if setting permissions/capabilities doesn't work
4helpers_install_dir="$1"
5with_ptp_helper_permissions="$2"
6setcap="$3"
7
8ptp_helper="$MESON_INSTALL_DESTDIR_PREFIX/$helpers_install_dir/gst-ptp-helper"
9
10case "$with_ptp_helper_permissions" in
11  setuid-root)
12    echo "$0: permissions before: "
13    ls -l "$ptp_helper"
14    chown root "$ptp_helper" || true
15    chmod u+s "$ptp_helper" || true
16    echo "$0: permissions after: "
17    ls -l "$ptp_helper"
18    ;;
19  capabilities)
20    echo "Calling $setcap cap_net_bind_service,cap_net_admin+ep $ptp_helper"
21    $setcap cap_net_bind_service,cap_net_admin+ep "$ptp_helper" || true
22    ;;
23  none)
24    echo "No perms/caps to set for $ptp_helper"
25    ;;
26  *)
27    echo "$0 ERROR: unexpected permissions value '$with_ptp_helper_permissions'";
28    exit 2;
29esac
30