cnping

Minimal Graphical Ping Tool
git clone https://git.sinitax.com/cnlohr/cnping
Log | Files | Refs | Submodules | README | LICENSE | sfeed.txt

postinst (623B)


      1#!/bin/sh
      2
      3set -e
      4
      5PROGRAM=$(dpkg-divert --truename /usr/bin/cnping)
      6
      7if [ "$1" = configure ]; then
      8    # If we have setcap installed, try setting cap_net_raw+ep,
      9    # which allows us to install our binaries without the setuid
     10    # bit.
     11    if command -v setcap > /dev/null; then
     12        if setcap cap_net_raw+ep $PROGRAM; then
     13            chmod u-s $PROGRAM
     14        else
     15            echo "Setcap failed on $PROGRAM, falling back to setuid" >&2
     16            chmod u+s $PROGRAM
     17        fi
     18    else
     19        echo "Setcap is not installed, falling back to setuid" >&2
     20        chmod u+s $PROGRAM
     21    fi
     22fi
     23
     24#DEBHELPER#
     25
     26exit 0